chore: sync feature into next

This commit is contained in:
thinkasany
2025-09-21 13:57:19 +08:00
47 changed files with 109 additions and 78 deletions

View File

@@ -1,5 +1,6 @@
import * as React from 'react';
import { Tag, TagProps } from 'antd';
import { Tag } from 'antd';
import type { TagProps } from 'antd';
// https://github.com/umijs/dumi/blob/master/src/client/theme-default/builtins/Badge/index.tsx
interface BadgeProps extends TagProps {

View File

@@ -1,4 +1,4 @@
import { Project, ProjectFiles } from '@stackblitz/sdk';
import type { Project, ProjectFiles } from '@stackblitz/sdk';
const getStackblitzConfig = ({
title = '',

View File

@@ -2,7 +2,8 @@ import * as React from 'react';
import { BugOutlined } from '@ant-design/icons';
import { Button, Flex, Popover, theme } from 'antd';
import { createStyles } from 'antd-style';
import dayjs, { Dayjs } from 'dayjs';
import dayjs from 'dayjs';
import type { Dayjs } from 'dayjs';
import useLocale from '../../../hooks/useLocale';
import { matchDeprecated } from '../../utils';

View File

@@ -27,7 +27,12 @@ const BezierVisualizer = (props: BezierVisualizerProps) => {
const controls = useMemo(() => {
const m = RE.exec(value.toLowerCase().trim());
if (m) {
return m[1].split(',').map((v) => parseFloat(v.trim())) as [number, number, number, number];
return m[1].split(',').map((v) => Number.parseFloat(v.trim())) as [
number,
number,
number,
number,
];
}
return null;
}, [value]);

View File

@@ -40,31 +40,23 @@
"linter": {
"rules": {
"style": {
"useImportType": "off",
"useNumberNamespace": "off",
"useNodejsImportProtocol": "off",
"noNonNullAssertion": "off",
"noUnusedTemplateLiteral": "off"
"noNonNullAssertion": "off"
},
"complexity": {
"noUselessTypeConstraint": "off",
"noForEach": "off",
"useDateNow": "off",
"noImportantStyles": "off",
"useIndexOf": "off",
"useOptionalChain": "off"
},
"correctness": {
"useUniqueElementIds": "off",
"useExhaustiveDependencies": "off",
"useHookAtTopLevel": "off",
"noUnusedFunctionParameters": "off",
"noUnusedVariables": "off"
},
"suspicious": {
"noTsIgnore": "off",
"noGlobalIsNan": "off",
"noGlobalIsFinite": "off",
"noExplicitAny": "off",
"noArrayIndexKey": "off",
"noConfusingVoidType": "off",
@@ -74,12 +66,10 @@
"noUnknownAtRules": "off"
},
"performance": {
"noDelete": "off",
"noAccumulatingSpread": "off",
"noDynamicNamespaceImportAccess": "off"
},
"a11y": {
"noAriaHiddenOnFocusable": "off",
"noLabelWithoutControl": "off",
"useFocusableInteractive": "off",
"useKeyWithClickEvents": "off",

View File

@@ -2,7 +2,7 @@ import * as React from 'react';
import classnames from 'classnames';
import type { AnyObject } from '../../type';
import { ValidChar } from './interface';
import type { ValidChar } from './interface';
type TemplateSemanticClassNames<T extends string> = Partial<Record<T, string>>;

View File

@@ -65,8 +65,8 @@ const WaveEffect = (props: WaveEffectProps) => {
// Rect
const { borderLeftWidth, borderTopWidth } = nodeStyle;
setLeft(isStatic ? target.offsetLeft : validateNum(-parseFloat(borderLeftWidth)));
setTop(isStatic ? target.offsetTop : validateNum(-parseFloat(borderTopWidth)));
setLeft(isStatic ? target.offsetLeft : validateNum(-Number.parseFloat(borderLeftWidth)));
setTop(isStatic ? target.offsetTop : validateNum(-Number.parseFloat(borderTopWidth)));
setWidth(target.offsetWidth);
setHeight(target.offsetHeight);
@@ -84,7 +84,7 @@ const WaveEffect = (props: WaveEffectProps) => {
borderTopRightRadius,
borderBottomRightRadius,
borderBottomLeftRadius,
].map((radius) => validateNum(parseFloat(radius))),
].map((radius) => validateNum(Number.parseFloat(radius))),
);
}

View File

@@ -216,10 +216,6 @@ const Affix = React.forwardRef<AffixRef, InternalAffixProps>((props, ref) => {
};
const removeListeners = () => {
if (timer.current) {
clearTimeout(timer.current);
timer.current = null;
}
const newTarget = targetFunc?.();
TRIGGER_EVENTS.forEach((eventName) => {
newTarget?.removeEventListener(eventName, lazyUpdatePosition);
@@ -238,7 +234,14 @@ const Affix = React.forwardRef<AffixRef, InternalAffixProps>((props, ref) => {
// [Legacy] Wait for parent component ref has its value.
// We should use target as directly element instead of function which makes element check hard.
timer.current = setTimeout(addListeners);
return () => removeListeners();
return () => {
if (timer.current) {
clearTimeout(timer.current);
timer.current = null;
}
removeListeners();
};
}, []);
React.useEffect(() => {

View File

@@ -130,9 +130,9 @@ const InternalBadge = React.forwardRef<HTMLSpanElement, BadgeProps>((props, ref)
const offsetStyle: React.CSSProperties = { marginTop: offset[1] };
if (direction === 'rtl') {
offsetStyle.left = parseInt(offset[0] as string, 10);
offsetStyle.left = Number.parseInt(offset[0] as string, 10);
} else {
offsetStyle.right = -parseInt(offset[0] as string, 10);
offsetStyle.right = -Number.parseInt(offset[0] as string, 10);
}
return { ...offsetStyle, ...contextStyle, ...style };

View File

@@ -14,7 +14,7 @@ const defaultReactRender: RenderType = (node, container) => {
// TODO: Remove in v6
// Warning for React 19
if (process.env.NODE_ENV !== 'production') {
const majorVersion = parseInt(React.version.split('.')[0], 10);
const majorVersion = Number.parseInt(React.version.split('.')[0], 10);
const fullKeys = Object.keys(ReactDOM);
warning(

View File

@@ -16,7 +16,7 @@ describe('UnstableContext', () => {
// TODO: Remove in v6
it('should warning', async () => {
const majorVersion = parseInt(version.split('.')[0], 10);
const majorVersion = Number.parseInt(version.split('.')[0], 10);
if (majorVersion >= 19) {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});

View File

@@ -8,7 +8,7 @@ type WaveConfig = GetProp<ConfigProviderProps, 'wave'>;
// Prepare effect holder
const createHolder = (node: HTMLElement) => {
const { borderWidth } = getComputedStyle(node);
const borderWidthNum = parseInt(borderWidth, 10);
const borderWidthNum = Number.parseInt(borderWidth, 10);
const div = document.createElement('div');
div.style.position = 'absolute';

View File

@@ -55,7 +55,7 @@ const App: React.FC = () => (
format="YYYY-MM-DD HH:mm:ss"
disabledDate={disabledDate}
disabledTime={disabledDateTime}
showTime={{ defaultValue: dayjs('00:00:00', 'HH:mm:ss') }}
showTime={{ defaultOpenValue: dayjs('00:00:00', 'HH:mm:ss') }}
/>
<DatePicker picker="month" disabledDate={disabledDateForMonth} />
<RangePicker disabledDate={disabledDate} />
@@ -64,7 +64,7 @@ const App: React.FC = () => (
disabledTime={disabledRangeTime}
showTime={{
hideDisabledOptions: true,
defaultValue: [dayjs('00:00:00', 'HH:mm:ss'), dayjs('11:59:59', 'HH:mm:ss')],
defaultOpenValue: [dayjs('00:00:00', 'HH:mm:ss'), dayjs('11:59:59', 'HH:mm:ss')],
}}
format="YYYY-MM-DD HH:mm:ss"
/>

View File

@@ -1,7 +1,8 @@
import React from 'react';
import { DownOutlined } from '@ant-design/icons';
import { DatePicker, Dropdown, Space } from 'antd';
import dayjs, { Dayjs } from 'dayjs';
import dayjs from 'dayjs';
import type { Dayjs } from 'dayjs';
const DatePickerDemo: React.FC = () => {
const [visible, setVisible] = React.useState(false);

View File

@@ -153,7 +153,8 @@ The following APIs are shared by DatePicker, RangePicker.
| renderExtraFooter | Render extra footer in panel | (mode) => React.ReactNode | - | |
| showNow | Show the fast access of current datetime | boolean | - | 4.4.0 |
| showTime | To provide an additional time selection | object \| boolean | [TimePicker Options](/components/time-picker/#api) | |
| showTime.defaultValue | To set default time of selected date, [demo](#date-picker-demo-disabled-date) | [dayjs](https://day.js.org/) | dayjs() | |
| ~~showTime.defaultValue~~ | Use `showTime.defaultOpenValue` instead | [dayjs](https://day.js.org/) | dayjs() | 5.27.3 |
| showTime.defaultOpenValue | To set default time of selected date, [demo](#date-picker-demo-disabled-date) | [dayjs](https://day.js.org/) | dayjs() | |
| showWeek | Show week info when in DatePicker | boolean | false | 5.14.0 |
| value | To set date | [dayjs](https://day.js.org/) | - | |
| onChange | Callback function, can be executed when the selected time is changing | function(date: dayjs, dateString: string) | - | |
@@ -225,7 +226,8 @@ Added in `4.1.0`.
| renderExtraFooter | Render extra footer in panel | () => React.ReactNode | - | |
| separator | Set separator between inputs | React.ReactNode | `<SwapRightOutlined />` | |
| showTime | To provide an additional time selection | object \| boolean | [TimePicker Options](/components/time-picker/#api) | |
| showTime.defaultValue | To set default time of selected date, [demo](#date-picker-demo-disabled-date) | [dayjs](https://day.js.org/)\[] | \[dayjs(), dayjs()] | |
| ~~showTime.defaultValue~~ | Use `showTime.defaultOpenValue` instead | [dayjs](https://day.js.org/)\[] | \[dayjs(), dayjs()] | 5.27.3 |
| showTime.defaultOpenValue | To set default time of selected date, [demo](#date-picker-demo-disabled-date) | [dayjs](https://day.js.org/)\[] | \[dayjs(), dayjs()] | |
| value | To set date | \[[dayjs](https://day.js.org/), [dayjs](https://day.js.org/)] | - | |
| onCalendarChange | Callback function, can be executed when the start time or the end time of the range is changing. `info` argument is added in 4.4.0 | function(dates: \[dayjs, dayjs], dateStrings: \[string, string], info: { range:`start`\|`end` }) | - | |
| onChange | Callback function, can be executed when the selected time is changing | function(dates: \[dayjs, dayjs], dateStrings: \[string, string]) | - | |

View File

@@ -154,7 +154,8 @@ dayjs.locale('zh-cn');
| renderExtraFooter | 在面板中添加额外的页脚 | (mode) => React.ReactNode | - | |
| showNow | 显示当前日期时间的快捷选择 | boolean | - | |
| showTime | 增加时间选择功能 | Object \| boolean | [TimePicker Options](/components/time-picker-cn#api) | |
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](#date-picker-demo-disabled-date) | [dayjs](https://day.js.org/) | dayjs() | |
| ~~showTime.defaultValue~~ | 请使用 `showTime.defaultOpenValue` | [dayjs](https://day.js.org/) | dayjs() | 5.27.3 |
| showTime.defaultOpenValue | 设置用户选择日期时默认的时分秒,[例子](#date-picker-demo-disabled-date) | [dayjs](https://day.js.org/) | dayjs() | |
| showWeek | DatePicker 下展示当前周 | boolean | false | 5.14.0 |
| value | 日期 | [dayjs](https://day.js.org/) | - | |
| onChange | 时间发生变化的回调 | function(date: dayjs, dateString: string) | - | |
@@ -226,7 +227,8 @@ dayjs.locale('zh-cn');
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | |
| separator | 设置分隔符 | React.ReactNode | `<SwapRightOutlined />` | |
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker-cn#api) | |
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](#date-picker-demo-disabled-date) | [dayjs](https://day.js.org/)\[] | \[dayjs(), dayjs()] | |
| ~~showTime.defaultValue~~ | 请使用 `showTime.defaultOpenValue` | [dayjs](https://day.js.org/)\[] | \[dayjs(), dayjs()] | 5.27.3 |
| showTime.defaultOpenValue | 设置用户选择日期时默认的时分秒,[例子](#date-picker-demo-disabled-date) | [dayjs](https://day.js.org/)\[] | \[dayjs(), dayjs()] | |
| value | 日期 | [dayjs](https://day.js.org/)\[] | - | |
| onCalendarChange | 待选日期发生变化的回调。`info` 参数自 4.4.0 添加 | function(dates: \[dayjs, dayjs], dateStrings: \[string, string], info: { range:`start`\|`end` }) | - | |
| onChange | 日期范围发生变化的回调 | function(dates: \[dayjs, dayjs], dateStrings: \[string, string]) | - | |

View File

@@ -8,7 +8,7 @@ import type { Orientation } from '../_util/hooks/useOrientation';
import { devUseWarning } from '../_util/warning';
import { useComponentConfig } from '../config-provider/context';
import useSize from '../config-provider/hooks/useSize';
import { SizeType } from '../config-provider/SizeContext';
import type { SizeType } from '../config-provider/SizeContext';
import useStyle from './style';
type SemanticName = 'root' | 'rail' | 'content';

View File

@@ -102,10 +102,12 @@ const InternalForm: React.ForwardRefRenderFunction<FormRef, FormProps> = (props,
const contextValidateMessages = React.useContext(ValidateMessagesContext);
/* eslint-disable react-hooks/rules-of-hooks */
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line react-hooks/rules-of-hooks
// biome-ignore lint/correctness/useHookAtTopLevel: Development-only warning hook called conditionally
useFormWarning(props);
}
/* eslint-enable */
const mergedRequiredMark = React.useMemo(() => {
if (requiredMark !== undefined) {

View File

@@ -72,7 +72,7 @@ export default function ItemHolder(props: ItemHolderProps) {
// The element must be part of the DOMTree to use getComputedStyle
// https://stackoverflow.com/questions/35360711/getcomputedstyle-returns-a-cssstyledeclaration-but-all-properties-are-empty-on-a
const itemStyle = getComputedStyle(itemRef.current);
setMarginBottom(parseInt(itemStyle.marginBottom, 10));
setMarginBottom(Number.parseInt(itemStyle.marginBottom, 10));
}
}, [hasError, isOnScreen]);

View File

@@ -1,7 +1,8 @@
import React from 'react';
import type { FormRef } from '@rc-component/form/lib/interface';
import Form, { FormInstance } from '..';
import Form from '..';
import type { FormInstance } from '..';
import { fireEvent, render } from '../../../tests/utils';
import Button from '../../button';
import type { InputRef } from '../../input';

View File

@@ -26,7 +26,7 @@ const PriceInput: React.FC<PriceInputProps> = (props) => {
};
const onNumberChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newNumber = parseInt(e.target.value || '0', 10);
const newNumber = Number.parseInt(e.target.value || '0', 10);
if (Number.isNaN(number)) {
return;
}

View File

@@ -1,7 +1,8 @@
import React, { forwardRef, useContext, useEffect, useRef } from 'react';
import type { InputRef, InputProps as RcInputProps } from '@rc-component/input';
import RcInput from '@rc-component/input';
import { InputFocusOptions, triggerFocus } from '@rc-component/input/lib/utils/commonUtils';
import { triggerFocus } from '@rc-component/input/lib/utils/commonUtils';
import type { InputFocusOptions } from '@rc-component/input/lib/utils/commonUtils';
import { composeRef } from '@rc-component/util/lib/ref';
import cls from 'classnames';
@@ -142,6 +143,7 @@ const Input = forwardRef<InputRef, InputProps>((props, ref) => {
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Input');
// biome-ignore lint/correctness/useHookAtTopLevel: Development-only warning hook called conditionally
useEffect(() => {
if (inputHasPrefixSuffix && !prevHasPrefixSuffix.current) {
warning(

View File

@@ -20,7 +20,8 @@ const dimensionMaxMap = {
xxl: '1599.98px',
};
const isNumeric = (value: any) => !Number.isNaN(Number.parseFloat(value)) && isFinite(value);
const isNumeric = (val: any) =>
!Number.isNaN(Number.parseFloat(val)) && Number.isFinite(Number(val));
export interface SiderContextProps {
siderCollapsed?: boolean;
@@ -148,7 +149,7 @@ const Sider = React.forwardRef<HTMLDivElement, SiderProps>((props, ref) => {
const siderWidth = isNumeric(rawWidth) ? `${rawWidth}px` : String(rawWidth);
// special trigger when collapsedWidth == 0
const zeroWidthTrigger =
parseFloat(String(collapsedWidth || 0)) === 0 ? (
Number.parseFloat(String(collapsedWidth || 0)) === 0 ? (
<span
onClick={toggle}
className={classNames(
@@ -194,7 +195,7 @@ const Sider = React.forwardRef<HTMLDivElement, SiderProps>((props, ref) => {
[`${prefixCls}-collapsed`]: !!collapsed,
[`${prefixCls}-has-trigger`]: collapsible && trigger !== null && !zeroWidthTrigger,
[`${prefixCls}-below`]: !!below,
[`${prefixCls}-zero-width`]: parseFloat(siderWidth) === 0,
[`${prefixCls}-zero-width`]: Number.parseFloat(siderWidth) === 0,
},
className,
hashId,

View File

@@ -11,7 +11,8 @@ import {
verticalListSortingStrategy,
} from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities';
import { Button, GetProps, List } from 'antd';
import { Button, List } from 'antd';
import type { GetProps } from 'antd';
interface SortableListItemContextProps {
setActivatorNodeRef?: (element: HTMLElement | null) => void;

View File

@@ -5,7 +5,8 @@ import { DndContext } from '@dnd-kit/core';
import type { SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities';
import { arrayMove, SortableContext, useSortable } from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities';
import { Button, Card, GetProps, List } from 'antd';
import { Button, Card, List } from 'antd';
import type { GetProps } from 'antd';
interface SortableListItemContextProps {
setActivatorNodeRef?: (element: HTMLElement | null) => void;

View File

@@ -80,10 +80,10 @@ import {
Popconfirm,
Select,
Table,
TableProps,
TimePicker,
Transfer,
} from '../..';
import type { TableProps } from '../..';
import mountTest from '../../../tests/shared/mountTest';
import { render } from '../../../tests/utils';
import arEG from '../../locale/ar_EG';

View File

@@ -10,7 +10,7 @@ import useMergedMask from '../_util/hooks/useMergedMask';
import useMergeSemantic from '../_util/hooks/useMergeSemantic';
import { useZIndex } from '../_util/hooks/useZIndex';
import { getTransitionName } from '../_util/motion';
import { Breakpoint } from '../_util/responsiveObserver';
import type { Breakpoint } from '../_util/responsiveObserver';
import { canUseDocElement } from '../_util/styleChecker';
import { devUseWarning } from '../_util/warning';
import zIndexContext from '../_util/zindexContext';

View File

@@ -6,8 +6,9 @@ import { resetWarned } from '@rc-component/util/lib/warning';
import type { ModalFuncProps } from '..';
import Modal from '..';
import { act, fireEvent, render, waitFakeTimer } from '../../../tests/utils';
import ConfigProvider, { defaultPrefixCls } from '../../config-provider';
import App from '../../app';
import ConfigProvider, { defaultPrefixCls, GlobalConfigProps } from '../../config-provider';
import type { GlobalConfigProps } from '../../config-provider';
import type { ModalFunc } from '../confirm';
import destroyFns from '../destroyFns';

View File

@@ -4,7 +4,8 @@ import KeyCode from '@rc-component/util/lib/KeyCode';
import Modal from '..';
import { act, fireEvent, render, waitFakeTimer } from '../../../tests/utils';
import Button from '../../button';
import ConfigProvider, { ConfigProviderProps } from '../../config-provider';
import ConfigProvider from '../../config-provider';
import type { ConfigProviderProps } from '../../config-provider';
import Input from '../../input';
import zhCN from '../../locale/zh_CN';
import type { ModalFunc } from '../confirm';

View File

@@ -2,7 +2,8 @@ import React, { useContext } from 'react';
import warning from '../_util/warning';
import ConfigProvider, { ConfigContext, globalConfig, warnContext } from '../config-provider';
import { unstableSetRender, UnmountType } from '../config-provider/UnstableContext';
import { unstableSetRender } from '../config-provider/UnstableContext';
import type { UnmountType } from '../config-provider/UnstableContext';
import type { ConfirmDialogProps } from './ConfirmDialog';
import ConfirmDialog from './ConfirmDialog';
import destroyFns from './destroyFns';

View File

@@ -1,9 +1,9 @@
import type React from 'react';
import type { DialogProps } from '@rc-component/dialog';
import { ClosableType } from '../_util/hooks/useClosable';
import type { ClosableType } from '../_util/hooks/useClosable';
import type { MaskType } from '../_util/hooks/useMergedMask';
import { Breakpoint } from '../_util/responsiveObserver';
import type { Breakpoint } from '../_util/responsiveObserver';
import type { ButtonProps, LegacyButtonType } from '../button/button';
import type { DirectionType } from '../config-provider';

View File

@@ -35,7 +35,7 @@ interface LineProps extends ProgressProps {
export const sortGradient = (gradients: StringGradients) => {
let tempArr: { key: number; value?: string }[] = [];
Object.keys(gradients).forEach((key) => {
const formattedKey = parseFloat(key.replace(/%/g, ''));
const formattedKey = Number.parseFloat(key.replace(/%/g, ''));
if (!Number.isNaN(formattedKey)) {
tempArr.push({ key: formattedKey, value: gradients[key] });
}

View File

@@ -111,7 +111,7 @@ const Progress = React.forwardRef<HTMLDivElement, ProgressProps>((props, ref) =>
const percentNumber = React.useMemo<number>(() => {
const successPercent = getSuccessPercent(props);
return parseInt(
return Number.parseInt(
successPercent !== undefined ? (successPercent ?? 0)?.toString() : (percent ?? 0)?.toString(),
10,
);

View File

@@ -13,7 +13,12 @@ const App: React.FC = () => {
return nextPercent > 150 ? -50 : nextPercent;
});
}, 100);
return () => clearTimeout(timerRef.current!);
return () => {
if (timerRef.current) {
clearTimeout(timerRef.current);
timerRef.current = null;
}
};
}, [percent]);
const mergedPercent = auto ? 'auto' : percent;

View File

@@ -38,7 +38,10 @@ export default function usePercent(
}
return () => {
clearInterval(mockIntervalRef.current!);
if (mockIntervalRef.current) {
clearInterval(mockIntervalRef.current);
mockIntervalRef.current = null;
}
};
}, [isAuto, spinning]);

View File

@@ -5,7 +5,7 @@ import { createEvent, fireEvent, render } from '@testing-library/react';
import { Splitter } from 'antd';
import { triggerResize, waitFakeTimer } from '../../../tests/utils';
import { PanelProps, SplitterProps } from '../interface';
import type { PanelProps, SplitterProps } from '../interface';
const SplitterDemo = ({ items = [{}, {}], ...props }: { items?: PanelProps[] } & SplitterProps) => (
<Splitter {...props}>

View File

@@ -281,7 +281,7 @@ describe('Table.pagination', () => {
fireEvent.mouseDown(container.querySelector('.ant-select-selector')!);
expect(container.querySelectorAll('.ant-select-item-option').length).toBe(4);
fireEvent.click(container.querySelectorAll('.ant-select-item-option')[1]);
const newPageSize = parseInt(
const newPageSize = Number.parseInt(
container.querySelectorAll('.ant-select-item-option')?.[1]?.textContent!,
10,
);
@@ -308,7 +308,7 @@ describe('Table.pagination', () => {
fireEvent.mouseDown(container.querySelector('.ant-select-selector')!);
expect(container.querySelectorAll('.ant-select-item-option').length).toBe(4);
fireEvent.click(container.querySelectorAll('.ant-select-item-option')[1]);
const newPageSize = parseInt(
const newPageSize = Number.parseInt(
container.querySelectorAll('.ant-select-item-option')?.[1]?.textContent!,
10,
);

View File

@@ -7,9 +7,8 @@ export default function useContainerWidth(prefixCls: string) {
if (container) {
const style = getComputedStyle(container);
const borderLeft = parseInt(style.borderLeftWidth, 10);
const borderRight = parseInt(style.borderRightWidth, 10);
const borderLeft = Number.parseInt(style.borderLeftWidth, 10);
const borderRight = Number.parseInt(style.borderRightWidth, 10);
returnWidth = width - borderLeft - borderRight;
}

View File

@@ -278,7 +278,7 @@ const useFilter = <RecordType extends AnyObject = AnyObject>(
return filterStates
.filter(({ key }) => keyList.includes(key))
.map((item) => {
const col = mergedColumns[keyList.findIndex((key) => key === item.key)];
const col = mergedColumns[keyList.indexOf(item.key)];
return {
...item,
column: {

View File

@@ -564,7 +564,7 @@ const useSelection = <RecordType extends AnyObject = AnyObject>(
onChange={(event) => {
const { nativeEvent } = event;
const { shiftKey } = nativeEvent;
const currentSelectedIndex = recordKeys.findIndex((item) => item === key);
const currentSelectedIndex = recordKeys.indexOf(key);
const isMultiple = derivedSelectedKeys.some((item) => recordKeys.includes(item));
if (shiftKey && checkStrictly && isMultiple) {

View File

@@ -2,7 +2,7 @@ import type * as React from 'react';
import classNames from 'classnames';
import { isPresetColor } from '../_util/colors';
import { ColorGenInput } from '../color-picker/interface';
import type { ColorGenInput } from '../color-picker/interface';
import { generateColor } from '../color-picker/util';
export function parseColor(prefixCls: string, color?: string) {

View File

@@ -2146,7 +2146,7 @@ Array [
<div
aria-label="this is a multiline
text that has many
lines and
lines and
- render like this
- and this
and that"
@@ -2155,7 +2155,7 @@ Array [
>
this is a multiline
text that has many
lines and
lines and
- render like this
- and this
and that

View File

@@ -1562,7 +1562,7 @@ Array [
>
this is a multiline
text that has many
lines and
lines and
- render like this
- and this
and that

View File

@@ -246,9 +246,13 @@ describe('Typography copy', () => {
const Test = () => {
const [dynamicText, setDynamicText] = React.useState(originText);
React.useEffect(() => {
setTimeout(() => {
const timer = setTimeout(() => {
setDynamicText(nextText);
}, 500);
return () => {
clearTimeout(timer);
};
}, []);
return (
<Base component="p" copyable>

View File

@@ -8,10 +8,10 @@ const templateStr =
const text = `this is a multiline
text that has many
lines and
lines and
- render like this
- and this
and that`;
const App: React.FC = () => {
@@ -23,9 +23,13 @@ const App: React.FC = () => {
const [display, setDisplay] = useState('none');
React.useEffect(() => {
setTimeout(() => {
const timer = setTimeout(() => {
setDisplay('block');
}, 100);
return () => {
clearTimeout(timer);
};
}, []);
return (

View File

@@ -25,7 +25,7 @@ const props: UploadProps = {
'100%': '#87d068',
},
strokeWidth: 3,
format: (percent) => percent && `${parseFloat(percent.toFixed(2))}%`,
format: (percent) => percent && `${Number.parseFloat(percent.toFixed(2))}%`,
},
};

View File

@@ -4,15 +4,15 @@ import os from 'os';
import path from 'path';
import { Readable } from 'stream';
import { finished } from 'stream/promises';
import blazediff from '@blazediff/core';
import chalk from 'chalk';
import fse from 'fs-extra';
import difference from 'lodash/difference';
import filter from 'lodash/filter';
import minimist from 'minimist';
import blazediff from '@blazediff/core';
import { PNG } from 'pngjs';
import sharp from 'sharp';
import simpleGit from 'simple-git';
import filter from 'lodash/filter';
import markdown2Html from './convert';
import { generate as genAlternativeReport } from './reportAdapter';
@@ -157,7 +157,7 @@ async function parseArgs() {
const baseRef = argv['base-ref'];
assert(baseRef, 'Missing --base-ref');
const maxWorkers = argv['max-workers'] ? parseInt(argv['max-workers'], 10) : 1;
const maxWorkers = argv['max-workers'] ? Number.parseInt(argv['max-workers'], 10) : 1;
const { latest } = await git.log();