chore: auto merge branches (#38514)

chore: sync master to feature
This commit is contained in:
github-actions[bot] 2022-11-11 11:29:58 +00:00 committed by GitHub
commit 4d17466411
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
81 changed files with 1020 additions and 441 deletions

21
.github/workflows/codeball.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Codeball
on:
pull_request: {}
pull_request_review_comment:
types: [created, edited]
jobs:
codeball_job:
runs-on: ubuntu-latest
name: Codeball
steps:
# Run Codeball on all new Pull Requests and Review Comments! 🚀
# For customizations and more documentation, see https://github.com/sturdy-dev/codeball-action
- name: Codeball
uses: sturdy-dev/codeball-action@v2
with:
# Settings for "Codeball Approver"
approvePullRequests: "false"
labelPullRequestsWhenApproved: "true"
labelPullRequestsWhenReviewNeeded: "true"
failJobsWhenReviewNeeded: "false"

View File

@ -34,7 +34,18 @@ jobs:
prettier: true
prerelease-filter: '-, a, b, A, B'
- name: release bigfish
- name: notice next
uses: actions-cool/release-helper@v2
with:
triger: 'tag'
dingding-token: ${{ secrets.DINGDING_BOT_V5_PRE_TOKEN }}
msg-title: '# Ant Design {{v}} 发布日志'
msg-poster: 'https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*zx7LTI_ECSAAAAAAAAAAAABkARQnAQ'
msg-footer: '💬 前往 [**Ant Design Releases**]({{url}}) 查看更新日志'
prerelease-filter: '-, a, b, A, B'
prerelease-notice: true
- name: notice bigfish
uses: actions-cool/release-helper@v2
with:
triger: 'tag'

1
.husky/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
_

View File

@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install pretty-quick --staged
npx --no-install lint-staged

View File

@ -28,6 +28,7 @@
]
}
],
"import-notation": null,
"no-descending-specificity": null,
"no-invalid-position-at-import-rule": null,
"declaration-empty-line-before": null,

View File

@ -152,7 +152,7 @@ describe('Test utils function', () => {
describe('TransButton', () => {
it('can be focus/blur', () => {
const ref = React.createRef<any>();
const ref = React.createRef<HTMLDivElement>();
render(<TransButton ref={ref}>TransButton</TransButton>);
expect(typeof ref.current?.focus).toBe('function');
expect(typeof ref.current?.blur).toBe('function');

View File

@ -174,7 +174,7 @@ describe('Wave component', () => {
});
it('bindAnimationEvent should return when node is null', () => {
const ref = React.createRef<any>();
const ref = React.createRef<Wave>();
render(
<Wave ref={ref}>
<button type="button" disabled>
@ -186,7 +186,7 @@ describe('Wave component', () => {
});
it('bindAnimationEvent.onClick should return when children is hidden', () => {
const ref = React.createRef<any>();
const ref = React.createRef<Wave>();
render(
<Wave ref={ref}>
<button type="button" style={{ display: 'none' }}>
@ -198,7 +198,7 @@ describe('Wave component', () => {
});
it('bindAnimationEvent.onClick should return when children is input', () => {
const ref = React.createRef<any>();
const ref = React.createRef<Wave>();
render(
<Wave ref={ref}>
<input />

View File

@ -9,9 +9,8 @@ export const getRenderPropValue = (
return null;
}
const isRenderFunction = typeof propValue === 'function';
if (isRenderFunction) {
return (propValue as RenderFunction)();
if (typeof propValue === 'function') {
return propValue();
}
return propValue;

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import useForceUpdate from './useForceUpdate';
type UseSyncStateProps<T> = [() => T, (newValue: T) => void];
type UseSyncStateProps<T> = readonly [() => T, (newValue: T) => void];
export default function useSyncState<T>(initialValue: T): UseSyncStateProps<T> {
const ref = React.useRef<T>(initialValue);
@ -14,5 +14,5 @@ export default function useSyncState<T>(initialValue: T): UseSyncStateProps<T> {
// re-render
forceUpdate();
},
];
] as const;
}

View File

@ -160,7 +160,7 @@ class Wave extends React.Component<WaveProps> {
: `${getPrefixCls('')}-click-animating-without-extra-node`;
}
bindAnimationEvent = (node: HTMLElement) => {
bindAnimationEvent = (node?: HTMLElement) => {
if (
!node ||
!node.getAttribute ||

View File

@ -15,6 +15,7 @@ class AffixMounter extends React.Component<{
onTestUpdatePosition?(): void;
onChange?: () => void;
getInstance?: (inst: InternalAffixClass) => void;
style?: React.CSSProperties;
}> {
private container: HTMLDivElement;
@ -201,6 +202,7 @@ describe('Affix Render', () => {
expect(getObserverEntities()).toHaveLength(1);
expect(getObserverEntities()[0].target).toBe(window);
});
it('check position change before measure', async () => {
const { container } = render(
<>
@ -216,6 +218,35 @@ describe('Affix Render', () => {
await movePlaceholder(1000);
expect(container.querySelector('.ant-affix')).toBeTruthy();
});
it('do not measure when hidden', async () => {
let affixInstance: InternalAffixClass | null = null;
const { rerender } = render(
<AffixMounter
getInstance={inst => {
affixInstance = inst;
}}
offsetBottom={0}
/>,
);
await waitFakeTimer();
const firstAffixStyle = affixInstance!.state.affixStyle;
rerender(
<AffixMounter
getInstance={inst => {
affixInstance = inst;
}}
offsetBottom={0}
style={{ display: 'none' }}
/>,
);
await waitFakeTimer();
const secondAffixStyle = affixInstance!.state.affixStyle;
expect(firstAffixStyle).toEqual(secondAffixStyle);
});
});
describe('updatePosition when size changed', () => {

View File

@ -169,6 +169,15 @@ class Affix extends React.Component<InternalAffixProps, AffixState> {
const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop);
const fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom);
if (
placeholderReact.top === 0 &&
placeholderReact.left === 0 &&
placeholderReact.width === 0 &&
placeholderReact.height === 0
) {
return;
}
if (fixedTop !== undefined) {
newState.affixStyle = {
position: 'fixed',

View File

@ -75,7 +75,7 @@ const ScrollNumber: React.FC<ScrollNumberProps> = ({
className: classNames(`${prefixCls}-custom-component`, oriProps?.className, motionClassName),
}));
}
return React.createElement(component as any, newProps, numberNodes);
return React.createElement(component, newProps, numberNodes);
};
export default ScrollNumber;

View File

@ -19255,7 +19255,6 @@ exports[`ConfigProvider components Pagination configProvider 1`] = `
<div>
<ul
class="config-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -19402,7 +19401,6 @@ exports[`ConfigProvider components Pagination configProvider 1`] = `
</ul>
<ul
class="config-pagination config-pagination-mini"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -19554,7 +19552,6 @@ exports[`ConfigProvider components Pagination configProvider componentDisabled 1
<div>
<ul
class="config-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -19702,7 +19699,6 @@ exports[`ConfigProvider components Pagination configProvider componentDisabled 1
</ul>
<ul
class="config-pagination config-pagination-mini"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -19855,7 +19851,6 @@ exports[`ConfigProvider components Pagination configProvider componentSize large
<div>
<ul
class="config-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -20002,7 +19997,6 @@ exports[`ConfigProvider components Pagination configProvider componentSize large
</ul>
<ul
class="config-pagination config-pagination-mini"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -20154,7 +20148,6 @@ exports[`ConfigProvider components Pagination configProvider componentSize middl
<div>
<ul
class="config-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -20301,7 +20294,6 @@ exports[`ConfigProvider components Pagination configProvider componentSize middl
</ul>
<ul
class="config-pagination config-pagination-mini"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -20453,7 +20445,6 @@ exports[`ConfigProvider components Pagination configProvider virtual and dropdow
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -20600,7 +20591,6 @@ exports[`ConfigProvider components Pagination configProvider virtual and dropdow
</ul>
<ul
class="ant-pagination ant-pagination-mini"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -20752,7 +20742,6 @@ exports[`ConfigProvider components Pagination normal 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -20899,7 +20888,6 @@ exports[`ConfigProvider components Pagination normal 1`] = `
</ul>
<ul
class="ant-pagination ant-pagination-mini"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -21051,7 +21039,6 @@ exports[`ConfigProvider components Pagination prefixCls 1`] = `
<div>
<ul
class="prefix-Pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -21198,7 +21185,6 @@ exports[`ConfigProvider components Pagination prefixCls 1`] = `
</ul>
<ul
class="prefix-Pagination prefix-Pagination-mini"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -22184,6 +22170,7 @@ exports[`ConfigProvider components Popover prefixCls 1`] = `
exports[`ConfigProvider components Progress configProvider 1`] = `
<div
class="config-progress config-progress-line config-progress-status-normal config-progress-show-info config-progress-default"
role="progressbar"
>
<div
class="config-progress-outer"
@ -22209,6 +22196,7 @@ exports[`ConfigProvider components Progress configProvider 1`] = `
exports[`ConfigProvider components Progress configProvider componentDisabled 1`] = `
<div
class="config-progress config-progress-line config-progress-status-normal config-progress-show-info config-progress-default"
role="progressbar"
>
<div
class="config-progress-outer"
@ -22234,6 +22222,7 @@ exports[`ConfigProvider components Progress configProvider componentDisabled 1`]
exports[`ConfigProvider components Progress configProvider componentSize large 1`] = `
<div
class="config-progress config-progress-line config-progress-status-normal config-progress-show-info config-progress-default"
role="progressbar"
>
<div
class="config-progress-outer"
@ -22259,6 +22248,7 @@ exports[`ConfigProvider components Progress configProvider componentSize large 1
exports[`ConfigProvider components Progress configProvider componentSize middle 1`] = `
<div
class="config-progress config-progress-line config-progress-status-normal config-progress-show-info config-progress-default"
role="progressbar"
>
<div
class="config-progress-outer"
@ -22284,6 +22274,7 @@ exports[`ConfigProvider components Progress configProvider componentSize middle
exports[`ConfigProvider components Progress configProvider virtual and dropdownMatchSelectWidth 1`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -22309,6 +22300,7 @@ exports[`ConfigProvider components Progress configProvider virtual and dropdownM
exports[`ConfigProvider components Progress normal 1`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -22334,6 +22326,7 @@ exports[`ConfigProvider components Progress normal 1`] = `
exports[`ConfigProvider components Progress prefixCls 1`] = `
<div
class="prefix-Progress prefix-Progress-line prefix-Progress-status-normal prefix-Progress-show-info prefix-Progress-default"
role="progressbar"
>
<div
class="prefix-Progress-outer"
@ -26954,7 +26947,7 @@ exports[`ConfigProvider components Table configProvider 1`] = `
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="config-table-cell config-table-column-has-sorters"
tabindex="0"
>
@ -27260,7 +27253,7 @@ exports[`ConfigProvider components Table configProvider componentDisabled 1`] =
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="config-table-cell config-table-column-has-sorters"
tabindex="0"
>
@ -27568,7 +27561,7 @@ exports[`ConfigProvider components Table configProvider componentSize large 1`]
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="config-table-cell config-table-column-has-sorters"
tabindex="0"
>
@ -27874,7 +27867,7 @@ exports[`ConfigProvider components Table configProvider componentSize middle 1`]
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="config-table-cell config-table-column-has-sorters"
tabindex="0"
>
@ -28180,7 +28173,7 @@ exports[`ConfigProvider components Table configProvider virtual and dropdownMatc
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -28486,7 +28479,7 @@ exports[`ConfigProvider components Table normal 1`] = `
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -28792,7 +28785,7 @@ exports[`ConfigProvider components Table prefixCls 1`] = `
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="prefix-Table-cell prefix-Table-column-has-sorters"
tabindex="0"
>

View File

@ -2,6 +2,7 @@ import React from 'react';
import { act } from 'react-dom/test-utils';
import ConfigProvider from '..';
import { render } from '../../../tests/utils';
import type { FormInstance } from '../../form';
import Form from '../../form';
import zhCN from '../../locale/zh_CN';
@ -16,7 +17,7 @@ describe('ConfigProvider.Form', () => {
describe('form validateMessages', () => {
const renderComponent = ({ validateMessages }: { validateMessages?: any }) => {
const formRef = React.createRef<any>();
const formRef = React.createRef<FormInstance>();
const { container } = render(
<ConfigProvider locale={zhCN} form={{ validateMessages }}>
<Form ref={formRef} initialValues={{ age: 18 }}>

View File

@ -131,4 +131,18 @@ describe('DropdownButton', () => {
'ant-btn',
);
});
it('should console Error then `overlay` in props', () => {
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
render(<DropdownButton overlay={<div>test</div>} />);
expect(errSpy).toHaveBeenCalledWith(
'Warning: [antd: Dropdown] `overlay` is deprecated. Please use `menu` instead.',
);
errSpy.mockRestore();
});
it('should not console Error then `overlay` not in props', () => {
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
render(<DropdownButton />);
expect(errSpy).not.toHaveBeenCalled();
errSpy.mockRestore();
});
});

View File

@ -79,7 +79,6 @@ const DropdownButton: DropdownButtonInterface = props => {
arrow,
autoFocus,
align,
overlay,
disabled,
trigger: disabled ? [] : trigger,
onOpenChange: onOpenChange || onVisibleChange,
@ -90,10 +89,15 @@ const DropdownButton: DropdownButtonInterface = props => {
overlayStyle,
destroyPopupOnHide,
};
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
const classes = classNames(prefixCls, compactItemClassnames, className);
if ('overlay' in props) {
dropdownProps.overlay = overlay;
}
if ('open' in props) {
dropdownProps.open = open;
} else if ('visible' in props) {

View File

@ -213,7 +213,7 @@ const Dropdown: DropdownInterface = props => {
if (menu?.items) {
overlayNode = <Menu {...menu} />;
} else if (typeof overlay === 'function') {
overlayNode = (overlay as OverlayFunc)();
overlayNode = overlay();
} else {
overlayNode = overlay;
}

View File

@ -276,27 +276,31 @@ function InternalFormItem<Values = any>(props: FormItemProps<Values>): React.Rea
warning(
!(shouldUpdate && dependencies),
'Form.Item',
"`shouldUpdate` and `dependencies` shouldn't be used together. See https://ant.design/components/form/#dependencies.",
"`shouldUpdate` and `dependencies` shouldn't be used together. See https://u.ant.design/#form-deps.",
);
if (Array.isArray(children) && hasName) {
warning(false, 'Form.Item', '`children` is array of render props cannot have `name`.');
warning(
false,
'Form.Item',
'A `Form.Item` with a `name` prop must have a single child element. For information on how to render more complex form items, see https://u.ant.design/#complex-form-item.',
);
childNode = children;
} else if (isRenderProps && (!(shouldUpdate || dependencies) || hasName)) {
warning(
!!(shouldUpdate || dependencies),
'Form.Item',
'`children` of render props only work with `shouldUpdate` or `dependencies`.',
'A `Form.Item` with a render function must have either `shouldUpdate` or `dependencies`.',
);
warning(
!hasName,
'Form.Item',
"Do not use `name` with `children` of render props since it's not a field.",
"A `Form.Item` with a render function cannot be a field, and thus cannot have a `name` prop.",
);
} else if (dependencies && !isRenderProps && !hasName) {
warning(
false,
'Form.Item',
'Must set `name` or use render props when `dependencies` is set.',
'Must set `name` or use a render function when `dependencies` is set.',
);
} else if (isValidElement(children)) {
warning(

View File

@ -5883,7 +5883,7 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.md extend con
<form
autocomplete="off"
class="ant-form ant-form-horizontal"
id="dynamic_form_nest_item"
id="dynamic_form_complex"
>
<div
class="ant-form-item"
@ -5896,7 +5896,7 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.md extend con
>
<label
class="ant-form-item-required"
for="dynamic_form_nest_item_area"
for="dynamic_form_complex_area"
title="Area"
>
Area
@ -5922,15 +5922,15 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.md extend con
class="ant-select-selection-search"
>
<input
aria-activedescendant="dynamic_form_nest_item_area_list_0"
aria-activedescendant="dynamic_form_complex_area_list_0"
aria-autocomplete="list"
aria-controls="dynamic_form_nest_item_area_list"
aria-controls="dynamic_form_complex_area_list"
aria-haspopup="listbox"
aria-owns="dynamic_form_nest_item_area_list"
aria-owns="dynamic_form_complex_area_list"
aria-required="true"
autocomplete="off"
class="ant-select-selection-search-input"
id="dynamic_form_nest_item_area"
id="dynamic_form_complex_area"
readonly=""
role="combobox"
style="opacity:0"
@ -5950,14 +5950,14 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.md extend con
>
<div>
<div
id="dynamic_form_nest_item_area_list"
id="dynamic_form_complex_area_list"
role="listbox"
style="height:0;width:0;overflow:hidden"
>
<div
aria-label="Beijing"
aria-selected="false"
id="dynamic_form_nest_item_area_list_0"
id="dynamic_form_complex_area_list_0"
role="option"
>
Beijing
@ -5965,7 +5965,7 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.md extend con
<div
aria-label="Shanghai"
aria-selected="false"
id="dynamic_form_nest_item_area_list_1"
id="dynamic_form_complex_area_list_1"
role="option"
>
Shanghai
@ -6145,7 +6145,7 @@ exports[`renders ./components/form/demo/dynamic-form-items-no-style.md extend co
<form
autocomplete="off"
class="ant-form ant-form-horizontal"
id="dynamic_form_nest_item"
id="dynamic_form_no_style"
>
<div
class="ant-form-item"

View File

@ -3366,7 +3366,7 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.md correctly
<form
autocomplete="off"
class="ant-form ant-form-horizontal"
id="dynamic_form_nest_item"
id="dynamic_form_complex"
>
<div
class="ant-form-item"
@ -3379,7 +3379,7 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.md correctly
>
<label
class="ant-form-item-required"
for="dynamic_form_nest_item_area"
for="dynamic_form_complex_area"
title="Area"
>
Area
@ -3405,15 +3405,15 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.md correctly
class="ant-select-selection-search"
>
<input
aria-activedescendant="dynamic_form_nest_item_area_list_0"
aria-activedescendant="dynamic_form_complex_area_list_0"
aria-autocomplete="list"
aria-controls="dynamic_form_nest_item_area_list"
aria-controls="dynamic_form_complex_area_list"
aria-haspopup="listbox"
aria-owns="dynamic_form_nest_item_area_list"
aria-owns="dynamic_form_complex_area_list"
aria-required="true"
autocomplete="off"
class="ant-select-selection-search-input"
id="dynamic_form_nest_item_area"
id="dynamic_form_complex_area"
readonly=""
role="combobox"
style="opacity:0"
@ -3546,7 +3546,7 @@ exports[`renders ./components/form/demo/dynamic-form-items-no-style.md correctly
<form
autocomplete="off"
class="ant-form ant-form-horizontal"
id="dynamic_form_nest_item"
id="dynamic_form_no_style"
>
<div
class="ant-form-item"

View File

@ -192,14 +192,14 @@ describe('Form', () => {
});
});
it('`shouldUpdate` should work with render props', () => {
it('render functions require either `shouldUpdate` or `dependencies`', () => {
render(
<Form>
<Form.Item>{() => null}</Form.Item>
</Form>,
);
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: Form.Item] `children` of render props only work with `shouldUpdate` or `dependencies`.',
'Warning: [antd: Form.Item] A `Form.Item` with a render function must have either `shouldUpdate` or `dependencies`.',
);
});
@ -212,7 +212,7 @@ describe('Form', () => {
</Form>,
);
expect(errorSpy).toHaveBeenCalledWith(
"Warning: [antd: Form.Item] `shouldUpdate` and `dependencies` shouldn't be used together. See https://ant.design/components/form/#dependencies.",
"Warning: [antd: Form.Item] `shouldUpdate` and `dependencies` shouldn't be used together. See https://u.ant.design/#form-deps.",
);
});
@ -225,11 +225,11 @@ describe('Form', () => {
</Form>,
);
expect(errorSpy).toHaveBeenCalledWith(
"Warning: [antd: Form.Item] Do not use `name` with `children` of render props since it's not a field.",
"Warning: [antd: Form.Item] A `Form.Item` with a render function cannot be a field, and thus cannot have a `name` prop.",
);
});
it('children is array has name props', () => {
it('multiple children with a name prop', () => {
render(
<Form>
<Form.Item name="test">
@ -239,7 +239,7 @@ describe('Form', () => {
</Form>,
);
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: Form.Item] `children` is array of render props cannot have `name`.',
'Warning: [antd: Form.Item] A `Form.Item` with a `name` prop must have a single child element. For information on how to render more complex form items, see https://u.ant.design/#complex-form-item.',
);
});
@ -619,7 +619,7 @@ describe('Form', () => {
</Form>,
);
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: Form.Item] Must set `name` or use render props when `dependencies` is set.',
'Warning: [antd: Form.Item] Must set `name` or use a render function when `dependencies` is set.',
);
});

View File

@ -44,7 +44,7 @@ const App: React.FC = () => {
};
return (
<Form form={form} name="dynamic_form_nest_item" onFinish={onFinish} autoComplete="off">
<Form form={form} name="dynamic_form_complex" onFinish={onFinish} autoComplete="off">
<Form.Item name="area" label="Area" rules={[{ required: true, message: 'Missing area' }]}>
<Select options={areas} onChange={handleChange} />
</Form.Item>

View File

@ -25,7 +25,7 @@ const App: React.FC = () => {
};
return (
<Form name="dynamic_form_nest_item" onFinish={onFinish} autoComplete="off">
<Form name="dynamic_form_no_style" onFinish={onFinish} autoComplete="off">
<Form.Item label="Users">
<Form.List name="users">
{(fields, { add, remove }) => (

View File

@ -1,48 +1,38 @@
import React, { memo, useContext, useRef, useState } from 'react';
import React, { memo, useContext } from 'react';
import Row from '../row';
import RowContext from '../RowContext';
import { render, fireEvent } from '../../../tests/utils';
import { fireEvent, pureRender } from '../../../tests/utils';
const CacheInner = memo(() => {
const countRef = useRef(0);
countRef.current++;
let innerCount = 0;
let outerCount = 0;
const handleClick = () => {
outerCount++;
};
const CacheInner: React.FC = memo(() => {
innerCount++;
useContext(RowContext);
return (
<div>
Child Rendering Count: <span id="child_count">{countRef.current}</span>
</div>
);
return null;
});
const CacheOuter = () => {
const [count, setCount] = useState(1);
const handleClick = () => {
setCount(count + 1);
};
return (
<div>
const CacheOuter: React.FC = memo(() => (
<>
<button type="button" onClick={handleClick} id="parent_btn">
Click
</button>
Parent Rendering Count: <span id="parent_count">{count}</span>
<Row>
<CacheInner />
</Row>
</div>
);
};
</>
));
it('Cached RowContext is working', () => {
const { container } = render(<CacheOuter />);
const childCount = container.querySelector('#child_count')?.textContent;
const { container, unmount } = pureRender(<CacheOuter />);
expect(outerCount).toBe(0);
expect(innerCount).toBe(1);
fireEvent.click(container.querySelector('#parent_btn')!);
expect(container.querySelector('#parent_count')?.textContent).toBe('2');
// child component won't rerender
expect(container.querySelector('#child_count')?.textContent).toBe(childCount);
fireEvent.click(container.querySelector('#parent_btn')!);
expect(container.querySelector('#parent_count')?.textContent).toBe('3');
// child component won't rerender
expect(container.querySelector('#child_count')?.textContent).toBe(childCount);
expect(outerCount).toBe(1);
expect(innerCount).toBe(1);
unmount();
});

View File

@ -105,16 +105,19 @@
z-index: @zindex-image;
}
&-operations {
.reset-component();
position: absolute;
&-operations-wrapper {
position: fixed;
top: 0;
right: 0;
z-index: 1;
z-index: @zindex-image + 1;
width: 100%;
}
&-operations {
.reset-component();
display: flex;
flex-direction: row-reverse;
align-items: center;
width: 100%;
color: @image-preview-operation-color;
list-style: none;
background: fade(@modal-mask-bg, 10%);
@ -124,6 +127,11 @@
margin-left: @control-padding-horizontal;
padding: @control-padding-horizontal;
cursor: pointer;
transition: all 0.3s;
&:hover {
background: fade(@modal-mask-bg, 20%);
}
&-disabled {
color: @image-preview-operation-disabled-color;
@ -148,40 +156,48 @@
&-switch-left,
&-switch-right {
position: absolute;
position: fixed;
top: 50%;
right: 10px;
z-index: 1;
right: 8px;
z-index: @zindex-image + 1;
display: flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
margin-top: -22px;
color: @image-preview-operation-color;
background: fade(@modal-mask-bg, 10%);
border-radius: 50%;
transform: translateY(-50%);
cursor: pointer;
transition: all 0.3s;
pointer-events: auto;
&-disabled {
&:hover {
background: fade(@modal-mask-bg, 20%);
}
&-disabled,
&-disabled:hover {
color: @image-preview-operation-disabled-color;
background: fade(@modal-mask-bg, 10%);
cursor: not-allowed;
> .@{iconfont-css-prefix} {
cursor: not-allowed;
}
}
> .@{iconfont-css-prefix} {
font-size: 18px;
}
}
&-switch-left {
left: 10px;
left: 8px;
}
&-switch-right {
right: 10px;
right: 8px;
}
}
}

View File

@ -11,7 +11,7 @@ import useRemovePasswordTimeout from './hooks/useRemovePasswordTimeout';
import type { InputProps, InputRef } from './Input';
import Input from './Input';
const defaultIconRender = (visible: boolean) =>
const defaultIconRender = (visible: boolean): React.ReactNode =>
visible ? <EyeOutlined /> : <EyeInvisibleOutlined />;
type VisibilityToggle = {

View File

@ -3,6 +3,7 @@ import React from 'react';
import Input from '..';
import { fireEvent, render } from '../../../tests/utils';
import type { InputRef } from '../Input';
import type { TextAreaRef } from '../TextArea';
const { TextArea } = Input;
@ -49,7 +50,7 @@ describe('Input.Focus', () => {
});
it('all', () => {
const ref = React.createRef<any>();
const ref = React.createRef<TextAreaRef>();
render(<TextArea ref={ref} defaultValue="light" />);
ref.current!.focus({ cursor: 'all' });

View File

@ -5,10 +5,10 @@ export default function useRemovePasswordTimeout(
inputRef: React.RefObject<InputRef>,
triggerOnMount?: boolean,
) {
const removePasswordTimeoutRef = useRef<number[]>([]);
const removePasswordTimeoutRef = useRef<NodeJS.Timer[]>([]);
const removePasswordTimeout = () => {
removePasswordTimeoutRef.current.push(
window.setTimeout(() => {
setTimeout(() => {
if (
inputRef.current?.input &&
inputRef.current?.input.getAttribute('type') === 'password' &&
@ -25,7 +25,12 @@ export default function useRemovePasswordTimeout(
removePasswordTimeout();
}
return () => removePasswordTimeoutRef.current.forEach(item => window.clearTimeout(item));
return () =>
removePasswordTimeoutRef.current.forEach(timer => {
if (timer) {
clearTimeout(timer);
}
});
}, []);
return removePasswordTimeout;

View File

@ -317,12 +317,12 @@ describe('Sider', () => {
).toBeTruthy();
});
['Layout', 'Header', 'Footer', 'Sider'].forEach(tag => {
(['Layout', 'Header', 'Footer', 'Sider'] as const).forEach(tag => {
const ComponentMap = { Layout, Header, Footer, Sider };
it(`should get ${tag} element from ref`, () => {
const ref = React.createRef<any>();
const ref = React.createRef<HTMLDivElement>();
const onSelect = jest.fn();
const Component = ComponentMap[tag as keyof typeof ComponentMap];
const Component = ComponentMap[tag];
render(
<Component onSelect={onSelect} ref={ref}>
{tag}

View File

@ -1,6 +1,6 @@
import React from 'react';
import React, { useEffect } from 'react';
import List from '..';
import { render } from '../../../tests/utils';
import { pureRender, render } from '../../../tests/utils';
import ConfigProvider from '../../config-provider';
describe('List Item Layout', () => {
@ -204,4 +204,30 @@ describe('List Item Layout', () => {
);
expect(ref.current).toHaveClass('ant-col');
});
it('react key', () => {
const loadId: number[] = [];
const Demo = ({ id }: { id: number }) => {
useEffect(() => {
loadId.push(id);
}, []);
return <div>{id}</div>;
};
const getDom = (id = 1) => (
<List
dataSource={[{ id, title: `ant design` }]}
rowKey={item => item.id}
renderItem={item => (
<List.Item>
<Demo id={item.id} />
</List.Item>
)}
/>
);
const { rerender } = pureRender(getDom(1));
rerender(getDom(3));
rerender(getDom(5));
expect(loadId).toEqual([1, 3, 5]);
});
});

View File

@ -2151,7 +2151,6 @@ exports[`renders ./components/list/demo/vertical.md extend context correctly 1`]
>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -2151,7 +2151,6 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -31,7 +31,6 @@ exports[`List.pagination renders pagination correctly 1`] = `
>
<ul
class="ant-pagination my-page"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -127,7 +126,6 @@ exports[`List.pagination renders pagination correctly 1`] = `
exports[`List.pagination should change page size work 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -277,7 +275,6 @@ exports[`List.pagination should change page size work 1`] = `
exports[`List.pagination should change page size work 2`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -546,7 +543,6 @@ exports[`List.pagination should change page size work 2`] = `
exports[`List.pagination should default work 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="false"

View File

@ -104,8 +104,6 @@ function List<T>({
total: 0,
};
const listItemsKeys: { [index: number]: React.Key } = {};
const triggerPaginationEvent = (eventName: string) => (page: number, pageSize: number) => {
setPaginationCurrent(page);
setPaginationSize(pageSize);
@ -135,9 +133,7 @@ function List<T>({
key = `list-item-${index}`;
}
listItemsKeys[index] = key;
return renderItem(item, index);
return <React.Fragment key={key}>{renderItem(item, index)}</React.Fragment>;
};
const isSomethingAfterLastItem = () => !!(loadMore || pagination || footer);
@ -249,13 +245,14 @@ function List<T>({
let childrenContent = isLoading && <div style={{ minHeight: 53 }} />;
if (splitDataSource.length > 0) {
const items = splitDataSource.map((item: T, index: number) => renderInnerItem(item, index));
const childrenList = React.Children.map(items, (child: React.ReactNode, index: number) => (
<div key={listItemsKeys[index]} style={colStyle}>
childrenContent = grid ? (
<Row gutter={grid.gutter}>
{React.Children.map(items, child => (
<div key={child?.key} style={colStyle}>
{child}
</div>
));
childrenContent = grid ? (
<Row gutter={grid.gutter}>{childrenList}</Row>
))}
</Row>
) : (
<ul className={`${prefixCls}-items`}>{items}</ul>
);

View File

@ -1870,7 +1870,6 @@ exports[`Locale Provider should display the text as ar 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -6963,7 +6962,6 @@ exports[`Locale Provider should display the text as az 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -12056,7 +12054,6 @@ exports[`Locale Provider should display the text as bg 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -17149,7 +17146,6 @@ exports[`Locale Provider should display the text as bn-bd 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -22242,7 +22238,6 @@ exports[`Locale Provider should display the text as by 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -27335,7 +27330,6 @@ exports[`Locale Provider should display the text as ca 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -32428,7 +32422,6 @@ exports[`Locale Provider should display the text as cs 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -37521,7 +37514,6 @@ exports[`Locale Provider should display the text as da 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -42614,7 +42606,6 @@ exports[`Locale Provider should display the text as de 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -47707,7 +47698,6 @@ exports[`Locale Provider should display the text as el 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -52800,7 +52790,6 @@ exports[`Locale Provider should display the text as en 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -57893,7 +57882,6 @@ exports[`Locale Provider should display the text as en-gb 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -62986,7 +62974,6 @@ exports[`Locale Provider should display the text as es 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -68079,7 +68066,6 @@ exports[`Locale Provider should display the text as et 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -73172,7 +73158,6 @@ exports[`Locale Provider should display the text as fa 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -78265,7 +78250,6 @@ exports[`Locale Provider should display the text as fi 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -83358,7 +83342,6 @@ exports[`Locale Provider should display the text as fr 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -88451,7 +88434,6 @@ exports[`Locale Provider should display the text as fr 2`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -93544,7 +93526,6 @@ exports[`Locale Provider should display the text as fr 3`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -98637,7 +98618,6 @@ exports[`Locale Provider should display the text as ga 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -103730,7 +103710,6 @@ exports[`Locale Provider should display the text as gl 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -108823,7 +108802,6 @@ exports[`Locale Provider should display the text as he 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -113916,7 +113894,6 @@ exports[`Locale Provider should display the text as hi 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -119009,7 +118986,6 @@ exports[`Locale Provider should display the text as hr 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -124102,7 +124078,6 @@ exports[`Locale Provider should display the text as hu 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -129195,7 +129170,6 @@ exports[`Locale Provider should display the text as hy-am 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -134288,7 +134262,6 @@ exports[`Locale Provider should display the text as id 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -139381,7 +139354,6 @@ exports[`Locale Provider should display the text as is 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -144474,7 +144446,6 @@ exports[`Locale Provider should display the text as it 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -149567,7 +149538,6 @@ exports[`Locale Provider should display the text as ja 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -154660,7 +154630,6 @@ exports[`Locale Provider should display the text as ka 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -159753,7 +159722,6 @@ exports[`Locale Provider should display the text as kk 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -164846,7 +164814,6 @@ exports[`Locale Provider should display the text as km 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -169937,7 +169904,6 @@ exports[`Locale Provider should display the text as kn 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -175030,7 +174996,6 @@ exports[`Locale Provider should display the text as ko 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -180123,7 +180088,6 @@ exports[`Locale Provider should display the text as ku 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -185216,7 +185180,6 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -190309,7 +190272,6 @@ exports[`Locale Provider should display the text as lt 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -195402,7 +195364,6 @@ exports[`Locale Provider should display the text as lv 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -200495,7 +200456,6 @@ exports[`Locale Provider should display the text as mk 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -205588,7 +205548,6 @@ exports[`Locale Provider should display the text as ml 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -210681,7 +210640,6 @@ exports[`Locale Provider should display the text as mn-mn 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -215774,7 +215732,6 @@ exports[`Locale Provider should display the text as ms-my 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -220867,7 +220824,6 @@ exports[`Locale Provider should display the text as nb 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -225960,7 +225916,6 @@ exports[`Locale Provider should display the text as ne-np 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -231053,7 +231008,6 @@ exports[`Locale Provider should display the text as nl 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -236146,7 +236100,6 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -241239,7 +241192,6 @@ exports[`Locale Provider should display the text as pl 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -246332,7 +246284,6 @@ exports[`Locale Provider should display the text as pt 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -251425,7 +251376,6 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -256518,7 +256468,6 @@ exports[`Locale Provider should display the text as ro 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -261611,7 +261560,6 @@ exports[`Locale Provider should display the text as ru 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -266704,7 +266652,6 @@ exports[`Locale Provider should display the text as si 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -271797,7 +271744,6 @@ exports[`Locale Provider should display the text as sk 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -276890,7 +276836,6 @@ exports[`Locale Provider should display the text as sl 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -281983,7 +281928,6 @@ exports[`Locale Provider should display the text as sr 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -287076,7 +287020,6 @@ exports[`Locale Provider should display the text as sv 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -292169,7 +292112,6 @@ exports[`Locale Provider should display the text as ta 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -297262,7 +297204,6 @@ exports[`Locale Provider should display the text as th 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -302355,7 +302296,6 @@ exports[`Locale Provider should display the text as tk 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -307448,7 +307388,6 @@ exports[`Locale Provider should display the text as tr 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -312541,7 +312480,6 @@ exports[`Locale Provider should display the text as uk 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -317634,7 +317572,6 @@ exports[`Locale Provider should display the text as ur 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -322727,7 +322664,6 @@ exports[`Locale Provider should display the text as vi 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -327820,7 +327756,6 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -332913,7 +332848,6 @@ exports[`Locale Provider should display the text as zh-hk 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -338006,7 +337940,6 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
<div>
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -71,4 +71,9 @@
&-success &-body > .@{iconfont-css-prefix} {
color: @success-color;
}
// https://github.com/ant-design/ant-design/issues/37329
.@{ant-prefix}-zoom-leave .@{confirm-prefix-cls}-btns {
pointer-events: none;
}
}

View File

@ -28,7 +28,7 @@ const ElementsHolder = React.memo(
);
export default function useModal(): [Omit<ModalStaticFunctions, 'warn'>, React.ReactElement] {
const holderRef = React.useRef<ElementsHolderRef>(null as any);
const holderRef = React.useRef<ElementsHolderRef>(null);
// ========================== Effect ==========================
const [actionQueue, setActionQueue] = React.useState<(() => void)[]>([]);
@ -52,14 +52,14 @@ export default function useModal(): [Omit<ModalStaticFunctions, 'warn'>, React.R
const modalRef = React.createRef<HookModalRef>();
let closeFunc: Function;
let closeFunc: Function | undefined;
const modal = (
<HookModal
key={`modal-${uuid}`}
config={withFunc(config)}
ref={modalRef}
afterClose={() => {
closeFunc();
closeFunc?.();
}}
/>
);

View File

@ -3,7 +3,6 @@
exports[`renders ./components/pagination/demo/all.md extend context correctly 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
class="ant-pagination-total-text"
@ -377,7 +376,6 @@ exports[`renders ./components/pagination/demo/all.md extend context correctly 1`
exports[`renders ./components/pagination/demo/basic.md extend context correctly 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -505,7 +503,6 @@ exports[`renders ./components/pagination/demo/changer.md extend context correctl
Array [
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -861,7 +858,6 @@ Array [
<br />,
<ul
class="ant-pagination ant-pagination-disabled"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -1221,7 +1217,6 @@ Array [
exports[`renders ./components/pagination/demo/controlled.md extend context correctly 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -1348,7 +1343,6 @@ exports[`renders ./components/pagination/demo/controlled.md extend context corre
exports[`renders ./components/pagination/demo/itemRender.md extend context correctly 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -1664,7 +1658,6 @@ exports[`renders ./components/pagination/demo/jump.md extend context correctly 1
Array [
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -2031,7 +2024,6 @@ Array [
<br />,
<ul
class="ant-pagination ant-pagination-disabled"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -2404,7 +2396,6 @@ exports[`renders ./components/pagination/demo/mini.md extend context correctly 1
Array [
<ul
class="ant-pagination ant-pagination-mini"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -2528,7 +2519,6 @@ Array [
</ul>,
<ul
class="ant-pagination ant-pagination-mini"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -2845,7 +2835,6 @@ Array [
</ul>,
<ul
class="ant-pagination ant-pagination-mini"
unselectable="unselectable"
>
<li
class="ant-pagination-total-text"
@ -2974,7 +2963,6 @@ Array [
</ul>,
<ul
class="ant-pagination ant-pagination-mini ant-pagination-disabled"
unselectable="unselectable"
>
<li
class="ant-pagination-total-text"
@ -3302,7 +3290,6 @@ Array [
exports[`renders ./components/pagination/demo/more.md extend context correctly 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -3885,7 +3872,6 @@ exports[`renders ./components/pagination/demo/total.md extend context correctly
Array [
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
class="ant-pagination-total-text"
@ -4197,7 +4183,6 @@ Array [
<br />,
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
class="ant-pagination-total-text"

View File

@ -3,7 +3,6 @@
exports[`renders ./components/pagination/demo/all.md correctly 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
class="ant-pagination-total-text"
@ -261,7 +260,6 @@ exports[`renders ./components/pagination/demo/all.md correctly 1`] = `
exports[`renders ./components/pagination/demo/basic.md correctly 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -389,7 +387,6 @@ exports[`renders ./components/pagination/demo/changer.md correctly 1`] = `
Array [
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -629,7 +626,6 @@ Array [
<br />,
<ul
class="ant-pagination ant-pagination-disabled"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -873,7 +869,6 @@ Array [
exports[`renders ./components/pagination/demo/controlled.md correctly 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -1000,7 +995,6 @@ exports[`renders ./components/pagination/demo/controlled.md correctly 1`] = `
exports[`renders ./components/pagination/demo/itemRender.md correctly 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -1200,7 +1194,6 @@ exports[`renders ./components/pagination/demo/jump.md correctly 1`] = `
Array [
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -1451,7 +1444,6 @@ Array [
<br />,
<ul
class="ant-pagination ant-pagination-disabled"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -1708,7 +1700,6 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
Array [
<ul
class="ant-pagination ant-pagination-mini"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -1832,7 +1823,6 @@ Array [
</ul>,
<ul
class="ant-pagination ant-pagination-mini"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -2033,7 +2023,6 @@ Array [
</ul>,
<ul
class="ant-pagination ant-pagination-mini"
unselectable="unselectable"
>
<li
class="ant-pagination-total-text"
@ -2162,7 +2151,6 @@ Array [
</ul>,
<ul
class="ant-pagination ant-pagination-mini ant-pagination-disabled"
unselectable="unselectable"
>
<li
class="ant-pagination-total-text"
@ -2374,7 +2362,6 @@ Array [
exports[`renders ./components/pagination/demo/more.md correctly 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -2841,7 +2828,6 @@ exports[`renders ./components/pagination/demo/total.md correctly 1`] = `
Array [
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
class="ant-pagination-total-text"
@ -3037,7 +3023,6 @@ Array [
<br />,
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
class="ant-pagination-total-text"

View File

@ -3,7 +3,6 @@
exports[`Pagination ConfigProvider should be rendered correctly in RTL 1`] = `
<ul
class="ant-pagination ant-pagination-rtl"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -130,7 +129,6 @@ exports[`Pagination ConfigProvider should be rendered correctly in RTL 1`] = `
exports[`Pagination ConfigProvider should be rendered correctly when componentSize is large 1`] = `
<ul
class="ant-pagination"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -324,7 +322,6 @@ exports[`Pagination ConfigProvider should be rendered correctly when componentSi
exports[`Pagination rtl render component should be rendered correctly in RTL direction 1`] = `
<ul
class="ant-pagination ant-pagination-rtl"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -0,0 +1,12 @@
import React from 'react';
import Pagination from '..';
import { render } from '../../../tests/utils';
describe('Pagination simple mode', () => {
it('should support showTotal in simple mode', () => {
const { container } = render(
<Pagination simple total={100} showTotal={(total: number, range: number[]) => `${range[0]}-${range[1]} of ${total} items`} />,
);
expect(container?.querySelector('.ant-pagination-total-text')).toHaveTextContent('1-10 of 100 items');
});
});

View File

@ -4,6 +4,7 @@ exports[`renders ./components/progress/demo/circle.md extend context correctly 1
Array [
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -54,6 +55,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-exception ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -121,6 +123,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -193,6 +196,7 @@ exports[`renders ./components/progress/demo/circle-dynamic.md extend context cor
Array [
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -306,6 +310,7 @@ exports[`renders ./components/progress/demo/circle-mini.md extend context correc
Array [
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -356,6 +361,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-exception ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -423,6 +429,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -495,6 +502,7 @@ exports[`renders ./components/progress/demo/dashboard.md extend context correctl
Array [
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -545,6 +553,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -600,6 +609,7 @@ exports[`renders ./components/progress/demo/dynamic.md extend context correctly
Array [
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -685,6 +695,7 @@ exports[`renders ./components/progress/demo/format.md extend context correctly 1
Array [
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -735,6 +746,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -790,6 +802,7 @@ exports[`renders ./components/progress/demo/gradient-line.md extend context corr
Array [
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -812,6 +825,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-line ant-progress-status-active ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -834,6 +848,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner ant-progress-circle-gradient"
@ -903,6 +918,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner ant-progress-circle-gradient"
@ -994,6 +1010,7 @@ exports[`renders ./components/progress/demo/line.md extend context correctly 1`]
Array [
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1016,6 +1033,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-line ant-progress-status-active ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1038,6 +1056,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-line ant-progress-status-exception ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1077,6 +1096,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-line ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1116,6 +1136,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1139,6 +1160,7 @@ exports[`renders ./components/progress/demo/line-mini.md extend context correctl
>
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-small"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1161,6 +1183,7 @@ exports[`renders ./components/progress/demo/line-mini.md extend context correctl
</div>
<div
class="ant-progress ant-progress-line ant-progress-status-active ant-progress-show-info ant-progress-small"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1183,6 +1206,7 @@ exports[`renders ./components/progress/demo/line-mini.md extend context correctl
</div>
<div
class="ant-progress ant-progress-line ant-progress-status-exception ant-progress-show-info ant-progress-small"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1222,6 +1246,7 @@ exports[`renders ./components/progress/demo/line-mini.md extend context correctl
</div>
<div
class="ant-progress ant-progress-line ant-progress-status-success ant-progress-show-info ant-progress-small"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1266,6 +1291,7 @@ exports[`renders ./components/progress/demo/linecap.md extend context correctly
Array [
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1289,6 +1315,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -1339,6 +1366,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -1394,6 +1422,7 @@ exports[`renders ./components/progress/demo/segment.md extend context correctly
Array [
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1444,6 +1473,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -1518,6 +1548,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -1597,6 +1628,7 @@ exports[`renders ./components/progress/demo/steps.md extend context correctly 1`
Array [
<div
class="ant-progress ant-progress-steps ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-steps-outer"
@ -1624,6 +1656,7 @@ Array [
<br />,
<div
class="ant-progress ant-progress-steps ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-steps-outer"
@ -1659,6 +1692,7 @@ Array [
<br />,
<div
class="ant-progress ant-progress-steps ant-progress-status-success ant-progress-show-info ant-progress-small"
role="progressbar"
>
<div
class="ant-progress-steps-outer"
@ -1711,6 +1745,7 @@ Array [
<br />,
<div
class="ant-progress ant-progress-steps ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-steps-outer"

View File

@ -4,6 +4,7 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
Array [
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -54,6 +55,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-exception ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -121,6 +123,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -193,6 +196,7 @@ exports[`renders ./components/progress/demo/circle-dynamic.md correctly 1`] = `
Array [
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -306,6 +310,7 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
Array [
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -356,6 +361,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-exception ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -423,6 +429,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -495,6 +502,7 @@ exports[`renders ./components/progress/demo/dashboard.md correctly 1`] = `
Array [
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -545,6 +553,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -600,6 +609,7 @@ exports[`renders ./components/progress/demo/dynamic.md correctly 1`] = `
Array [
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -685,6 +695,7 @@ exports[`renders ./components/progress/demo/format.md correctly 1`] = `
Array [
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -735,6 +746,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -790,6 +802,7 @@ exports[`renders ./components/progress/demo/gradient-line.md correctly 1`] = `
Array [
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -812,6 +825,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-line ant-progress-status-active ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -834,6 +848,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner ant-progress-circle-gradient"
@ -903,6 +918,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner ant-progress-circle-gradient"
@ -994,6 +1010,7 @@ exports[`renders ./components/progress/demo/line.md correctly 1`] = `
Array [
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1016,6 +1033,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-line ant-progress-status-active ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1038,6 +1056,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-line ant-progress-status-exception ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1077,6 +1096,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-line ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1116,6 +1136,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1139,6 +1160,7 @@ exports[`renders ./components/progress/demo/line-mini.md correctly 1`] = `
>
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-small"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1161,6 +1183,7 @@ exports[`renders ./components/progress/demo/line-mini.md correctly 1`] = `
</div>
<div
class="ant-progress ant-progress-line ant-progress-status-active ant-progress-show-info ant-progress-small"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1183,6 +1206,7 @@ exports[`renders ./components/progress/demo/line-mini.md correctly 1`] = `
</div>
<div
class="ant-progress ant-progress-line ant-progress-status-exception ant-progress-show-info ant-progress-small"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1222,6 +1246,7 @@ exports[`renders ./components/progress/demo/line-mini.md correctly 1`] = `
</div>
<div
class="ant-progress ant-progress-line ant-progress-status-success ant-progress-show-info ant-progress-small"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1266,6 +1291,7 @@ exports[`renders ./components/progress/demo/linecap.md correctly 1`] = `
Array [
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1289,6 +1315,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -1339,6 +1366,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -1394,6 +1422,7 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
Array [
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -1420,6 +1449,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -1470,6 +1500,7 @@ Array [
</div>,
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -1525,6 +1556,7 @@ exports[`renders ./components/progress/demo/steps.md correctly 1`] = `
Array [
<div
class="ant-progress ant-progress-steps ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-steps-outer"
@ -1552,6 +1584,7 @@ Array [
<br />,
<div
class="ant-progress ant-progress-steps ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-steps-outer"
@ -1587,6 +1620,7 @@ Array [
<br />,
<div
class="ant-progress ant-progress-steps ant-progress-status-success ant-progress-show-info ant-progress-small"
role="progressbar"
>
<div
class="ant-progress-steps-outer"
@ -1639,6 +1673,7 @@ Array [
<br />,
<div
class="ant-progress ant-progress-steps ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-steps-outer"

View File

@ -3,6 +3,7 @@
exports[`Progress render dashboard 295 gapDegree 1`] = `
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -56,6 +57,7 @@ exports[`Progress render dashboard 295 gapDegree 1`] = `
exports[`Progress render dashboard 296 gapDegree 1`] = `
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -109,6 +111,7 @@ exports[`Progress render dashboard 296 gapDegree 1`] = `
exports[`Progress render dashboard zero gapDegree 1`] = `
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -162,6 +165,7 @@ exports[`Progress render dashboard zero gapDegree 1`] = `
exports[`Progress render format 1`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -191,6 +195,7 @@ exports[`Progress render format 1`] = `
exports[`Progress render negative progress 1`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -216,6 +221,7 @@ exports[`Progress render negative progress 1`] = `
exports[`Progress render negative successPercent 1`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -245,6 +251,7 @@ exports[`Progress render negative successPercent 1`] = `
exports[`Progress render normal progress 1`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -270,6 +277,7 @@ exports[`Progress render normal progress 1`] = `
exports[`Progress render out-of-range progress 1`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -312,6 +320,7 @@ exports[`Progress render out-of-range progress 1`] = `
exports[`Progress render out-of-range progress with info 1`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-success ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -354,6 +363,7 @@ exports[`Progress render out-of-range progress with info 1`] = `
exports[`Progress render strokeColor 1`] = `
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -407,6 +417,7 @@ exports[`Progress render strokeColor 1`] = `
exports[`Progress render strokeColor 2`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -432,6 +443,7 @@ exports[`Progress render strokeColor 2`] = `
exports[`Progress render strokeColor 3`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -457,6 +469,7 @@ exports[`Progress render strokeColor 3`] = `
exports[`Progress render successColor progress 1`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -486,6 +499,7 @@ exports[`Progress render successColor progress 1`] = `
exports[`Progress render successColor progress type="circle" 1`] = `
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -539,6 +553,7 @@ exports[`Progress render successColor progress type="circle" 1`] = `
exports[`Progress render successColor progress type="dashboard" 1`] = `
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -592,6 +607,7 @@ exports[`Progress render successColor progress type="dashboard" 1`] = `
exports[`Progress render trailColor progress 1`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -618,6 +634,7 @@ exports[`Progress render trailColor progress 1`] = `
exports[`Progress rtl render component should be rendered correctly in RTL direction 1`] = `
<div
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default ant-progress-rtl"
role="progressbar"
>
<div
class="ant-progress-outer"
@ -643,6 +660,7 @@ exports[`Progress rtl render component should be rendered correctly in RTL direc
exports[`Progress should support steps 1`] = `
<div
class="ant-progress ant-progress-steps ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-steps-outer"

View File

@ -176,6 +176,7 @@ const Progress: React.FC<ProgressProps> = (props: ProgressProps) => {
'successPercent',
])}
className={classString}
role="progressbar"
>
{progress}
</div>

View File

@ -67,4 +67,11 @@ describe('Result', () => {
warnSpy.mockRestore();
});
it('should hide icon by setting icon to false or null', () => {
const { container } = render(<Result title="404" icon={null} />);
expect(container.querySelectorAll('.ant-result-icon')).toHaveLength(0);
const { container: container2 } = render(<Result title="404" icon={false} />);
expect(container2.querySelectorAll('.ant-result-icon')).toHaveLength(0);
});
});

View File

@ -73,10 +73,15 @@ const Icon: React.FC<IconProps> = ({ prefixCls, icon, status }) => {
</div>
);
}
const iconNode = React.createElement(
IconMap[status as Exclude<ResultStatusType, ExceptionStatusType>],
);
if (icon === null || icon === false) {
return null;
}
return <div className={className}>{icon || iconNode}</div>;
};

View File

@ -1200,6 +1200,7 @@ Array [
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -1965,6 +1966,7 @@ exports[`renders ./components/steps/demo/progress.md extend context correctly 1`
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -2206,6 +2208,7 @@ Array [
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -2387,6 +2390,7 @@ Array [
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -2568,6 +2572,7 @@ Array [
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -2749,6 +2754,7 @@ Array [
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"

View File

@ -1056,6 +1056,7 @@ Array [
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -1821,6 +1822,7 @@ exports[`renders ./components/steps/demo/progress.md correctly 1`] = `
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -2062,6 +2064,7 @@ Array [
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -2243,6 +2246,7 @@ Array [
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -2424,6 +2428,7 @@ Array [
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"
@ -2605,6 +2610,7 @@ Array [
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-inner"

View File

@ -22,7 +22,7 @@ ReactDOM.render(<Alert message="After version 4.24.0, we provide a simpler usage
```jsx
// works when >=4.24.0, recommended ✅
const items = [{ title: 'first step' }, { title: 'second step' }, { title: 'third step' }];
return <Tabs items={items} />;
return <Steps items={items} />;
// works when <4.24.0, deprecated when >=4.24.0 🙅🏻‍♀️
<Steps>

View File

@ -105,7 +105,9 @@ describe('Table.sorter', () => {
fireEvent.click(container.querySelector('.ant-table-column-sorters')!);
expect(getNameColumn()?.getAttribute('aria-sort')).toEqual(null);
expect(getNameColumn()?.getAttribute('aria-label')).toEqual('Name sortable');
expect(getNameColumn()?.getAttribute('aria-label')).toEqual(
"this column's title is Name,this column is sortable",
);
});
it('sort records', () => {

View File

@ -287,6 +287,53 @@ describe('Table', () => {
expect(warnSpy).not.toHaveBeenCalled();
});
// https://github.com/ant-design/ant-design/issues/38371
it('should render title', () => {
const columns = [
{
title: (
<div>
<span>name</span>
<span>Jason</span>
</div>
),
key: 'name',
sorter: true,
},
{
title: (
<div>
<i />
</div>
),
key: 'name',
sorter: true,
},
{
title: () => (
<div>
<span>age</span>
<span>20</span>
</div>
),
key: 'name',
sorter: true,
},
{
title: () => 'color',
key: 'name',
sorter: true,
},
{
title: 'sex',
key: 'name',
sorter: true,
},
];
const { container } = render(<Table columns={columns} />);
expect(container).toMatchSnapshot();
});
it('title should support ReactNode', () => {
const { container } = render(
<Table

View File

@ -82,7 +82,6 @@ exports[`Table.expand click to expand 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -84,7 +84,6 @@ exports[`Table.pagination Accepts pagination as true 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -231,7 +230,6 @@ exports[`Table.pagination renders pagination correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right my-page"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -409,7 +407,6 @@ exports[`Table.pagination renders pagination topLeft and bottomRight 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -280,7 +280,6 @@ exports[`Table.rowSelection fix expand on th left when selection column fixed on
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -584,7 +583,6 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -893,7 +891,6 @@ exports[`Table.rowSelection fix selection column on the left when any other colu
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -1308,7 +1305,6 @@ exports[`Table.rowSelection should support getPopupContainer 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -1668,7 +1664,6 @@ exports[`Table.rowSelection should support getPopupContainer from ConfigProvider
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -1944,7 +1939,6 @@ exports[`Table.rowSelection use column as selection column when key is \`selecti
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -6,7 +6,7 @@ exports[`Table.sorter renders sorter icon correctly 1`] = `
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -180,7 +180,6 @@ exports[`Table.sorter should support defaultOrder in Column 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -205,6 +205,426 @@ exports[`Table rtl render component should be rendered correctly in RTL directio
</div>
`;
exports[`Table should render title 1`] = `
<div>
<div
class="ant-table-wrapper"
>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<div
class="ant-table ant-table-empty"
>
<div
class="ant-table-container"
>
<div
class="ant-table-content"
>
<table
style="table-layout: auto;"
>
<colgroup />
<thead
class="ant-table-thead"
>
<tr>
<th
aria-label="this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
<div
class="ant-table-column-sorters"
>
<span
class="ant-table-column-title"
>
<div>
<span>
name
</span>
<span>
Jason
</span>
</div>
</span>
<span
class="ant-table-column-sorter ant-table-column-sorter-full"
>
<span
class="ant-table-column-sorter-inner"
>
<span
aria-label="caret-up"
class="anticon anticon-caret-up ant-table-column-sorter-up"
role="presentation"
>
<svg
aria-hidden="true"
data-icon="caret-up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
>
<path
d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"
/>
</svg>
</span>
<span
aria-label="caret-down"
class="anticon anticon-caret-down ant-table-column-sorter-down"
role="presentation"
>
<svg
aria-hidden="true"
data-icon="caret-down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
>
<path
d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"
/>
</svg>
</span>
</span>
</span>
</div>
</th>
<th
aria-label="this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
<div
class="ant-table-column-sorters"
>
<span
class="ant-table-column-title"
>
<div>
<i />
</div>
</span>
<span
class="ant-table-column-sorter ant-table-column-sorter-full"
>
<span
class="ant-table-column-sorter-inner"
>
<span
aria-label="caret-up"
class="anticon anticon-caret-up ant-table-column-sorter-up"
role="presentation"
>
<svg
aria-hidden="true"
data-icon="caret-up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
>
<path
d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"
/>
</svg>
</span>
<span
aria-label="caret-down"
class="anticon anticon-caret-down ant-table-column-sorter-down"
role="presentation"
>
<svg
aria-hidden="true"
data-icon="caret-down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
>
<path
d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"
/>
</svg>
</span>
</span>
</span>
</div>
</th>
<th
aria-label="this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
<div
class="ant-table-column-sorters"
>
<span
class="ant-table-column-title"
>
<div>
<span>
age
</span>
<span>
20
</span>
</div>
</span>
<span
class="ant-table-column-sorter ant-table-column-sorter-full"
>
<span
class="ant-table-column-sorter-inner"
>
<span
aria-label="caret-up"
class="anticon anticon-caret-up ant-table-column-sorter-up"
role="presentation"
>
<svg
aria-hidden="true"
data-icon="caret-up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
>
<path
d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"
/>
</svg>
</span>
<span
aria-label="caret-down"
class="anticon anticon-caret-down ant-table-column-sorter-down"
role="presentation"
>
<svg
aria-hidden="true"
data-icon="caret-down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
>
<path
d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"
/>
</svg>
</span>
</span>
</span>
</div>
</th>
<th
aria-label="this column's title is color,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
<div
class="ant-table-column-sorters"
>
<span
class="ant-table-column-title"
>
color
</span>
<span
class="ant-table-column-sorter ant-table-column-sorter-full"
>
<span
class="ant-table-column-sorter-inner"
>
<span
aria-label="caret-up"
class="anticon anticon-caret-up ant-table-column-sorter-up"
role="presentation"
>
<svg
aria-hidden="true"
data-icon="caret-up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
>
<path
d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"
/>
</svg>
</span>
<span
aria-label="caret-down"
class="anticon anticon-caret-down ant-table-column-sorter-down"
role="presentation"
>
<svg
aria-hidden="true"
data-icon="caret-down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
>
<path
d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"
/>
</svg>
</span>
</span>
</span>
</div>
</th>
<th
aria-label="this column's title is sex,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
<div
class="ant-table-column-sorters"
>
<span
class="ant-table-column-title"
>
sex
</span>
<span
class="ant-table-column-sorter ant-table-column-sorter-full"
>
<span
class="ant-table-column-sorter-inner"
>
<span
aria-label="caret-up"
class="anticon anticon-caret-up ant-table-column-sorter-up"
role="presentation"
>
<svg
aria-hidden="true"
data-icon="caret-up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
>
<path
d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"
/>
</svg>
</span>
<span
aria-label="caret-down"
class="anticon anticon-caret-down ant-table-column-sorter-down"
role="presentation"
>
<svg
aria-hidden="true"
data-icon="caret-down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
>
<path
d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"
/>
</svg>
</span>
</span>
</span>
</div>
</th>
</tr>
</thead>
<tbody
class="ant-table-tbody"
>
<tr
class="ant-table-placeholder"
>
<td
class="ant-table-cell"
colspan="5"
>
<div
class="ant-empty ant-empty-normal"
>
<div
class="ant-empty-image"
>
<svg
class="ant-empty-img-simple"
height="41"
viewBox="0 0 64 41"
width="64"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill="none"
fill-rule="evenodd"
transform="translate(0 1)"
>
<ellipse
class="ant-empty-img-simple-ellipse"
cx="32"
cy="33"
rx="32"
ry="7"
/>
<g
class="ant-empty-img-simple-g"
fill-rule="nonzero"
>
<path
d="M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"
/>
<path
class="ant-empty-img-simple-path"
d="M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z"
/>
</g>
</g>
</svg>
</div>
<div
class="ant-empty-description"
>
No data
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
`;
exports[`Table title should support ReactNode 1`] = `
<th
class="ant-table-cell"

View File

@ -35,7 +35,7 @@ exports[`renders ./components/table/demo/ajax.md extend context correctly 1`] =
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -662,7 +662,6 @@ exports[`renders ./components/table/demo/basic.md extend context correctly 1`] =
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -879,7 +878,6 @@ exports[`renders ./components/table/demo/bordered.md extend context correctly 1`
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -1159,7 +1157,6 @@ exports[`renders ./components/table/demo/colspan-rowspan.md extend context corre
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -1549,7 +1546,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md extend context c
</div>
</th>
<th
aria-label="Address sortable"
aria-label="this column's title is Address,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -1856,7 +1853,6 @@ exports[`renders ./components/table/demo/custom-filter-panel.md extend context c
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -2056,7 +2052,6 @@ exports[`renders ./components/table/demo/drag-sorting.md extend context correctl
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -3314,7 +3309,7 @@ Array [
Name
</th>
<th
aria-label="Age sortable"
aria-label="this column's title is Age,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -3625,7 +3620,7 @@ Array [
</div>
</th>
<th
aria-label="Action sortable"
aria-label="this column's title is Action,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -4766,7 +4761,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -5145,7 +5139,6 @@ exports[`renders ./components/table/demo/edit-cell.md extend context correctly 1
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -5588,7 +5581,6 @@ exports[`renders ./components/table/demo/edit-row.md extend context correctly 1`
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -6149,7 +6141,6 @@ exports[`renders ./components/table/demo/ellipsis.md extend context correctly 1`
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -6735,7 +6726,6 @@ exports[`renders ./components/table/demo/ellipsis-custom-tooltip.md extend conte
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -7032,7 +7022,6 @@ exports[`renders ./components/table/demo/expand.md extend context correctly 1`]
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -7589,7 +7578,7 @@ exports[`renders ./components/table/demo/filter-in-tree.md extend context correc
</div>
</th>
<th
aria-label="Age sortable"
aria-label="this column's title is Age,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -8029,7 +8018,6 @@ exports[`renders ./components/table/demo/filter-in-tree.md extend context correc
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -8410,7 +8398,7 @@ exports[`renders ./components/table/demo/filter-search.md extend context correct
</div>
</th>
<th
aria-label="Age sortable"
aria-label="this column's title is Age,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -8850,7 +8838,6 @@ exports[`renders ./components/table/demo/filter-search.md extend context correct
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -9273,7 +9260,6 @@ exports[`renders ./components/table/demo/fixed-columns.md extend context correct
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -10240,7 +10226,6 @@ exports[`renders ./components/table/demo/fixed-columns-header.md extend context
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -11700,7 +11685,6 @@ exports[`renders ./components/table/demo/fixed-header.md extend context correctl
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -12254,7 +12238,7 @@ exports[`renders ./components/table/demo/grouping-columns.md extend context corr
</tr>
<tr>
<th
aria-label="Age sortable"
aria-label="this column's title is Age,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
rowspan="3"
tabindex="0"
@ -12968,7 +12952,6 @@ exports[`renders ./components/table/demo/grouping-columns.md extend context corr
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -13354,7 +13337,7 @@ exports[`renders ./components/table/demo/head.md extend context correctly 1`] =
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -14240,7 +14223,6 @@ exports[`renders ./components/table/demo/head.md extend context correctly 1`] =
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -14591,7 +14573,6 @@ exports[`renders ./components/table/demo/jsx.md extend context correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -14707,7 +14688,7 @@ exports[`renders ./components/table/demo/multiple-sorter.md extend context corre
Name
</th>
<th
aria-label="Chinese Score sortable"
aria-label="this column's title is Chinese Score,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -14792,7 +14773,7 @@ exports[`renders ./components/table/demo/multiple-sorter.md extend context corre
</div>
</th>
<th
aria-label="Math Score sortable"
aria-label="this column's title is Math Score,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -14877,7 +14858,7 @@ exports[`renders ./components/table/demo/multiple-sorter.md extend context corre
</div>
</th>
<th
aria-label="English Score sortable"
aria-label="this column's title is English Score,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -15073,7 +15054,6 @@ exports[`renders ./components/table/demo/multiple-sorter.md extend context corre
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -15413,7 +15393,6 @@ exports[`renders ./components/table/demo/narrow.md extend context correctly 1`]
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -16160,7 +16139,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -17200,7 +17178,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -18235,7 +18212,6 @@ Array [
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -19270,7 +19246,6 @@ Array [
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -19640,7 +19615,6 @@ exports[`renders ./components/table/demo/order-column.md extend context correctl
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -19902,7 +19876,6 @@ exports[`renders ./components/table/demo/pagination.md extend context correctly
>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-left"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -20218,7 +20191,6 @@ exports[`renders ./components/table/demo/pagination.md extend context correctly
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -20374,7 +20346,7 @@ Array [
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="ant-table-cell ant-table-cell-ellipsis ant-table-column-has-sorters"
tabindex="0"
title="Name"
@ -20681,7 +20653,7 @@ Array [
</div>
</th>
<th
aria-label="Age sortable"
aria-label="this column's title is Age,this column is sortable"
class="ant-table-cell ant-table-cell-ellipsis ant-table-column-has-sorters"
tabindex="0"
title="Age"
@ -20767,7 +20739,7 @@ Array [
</div>
</th>
<th
aria-label="Address sortable"
aria-label="this column's title is Address,this column is sortable"
class="ant-table-cell ant-table-cell-ellipsis ant-table-column-has-sorters"
tabindex="0"
title="Address"
@ -21177,7 +21149,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -21310,7 +21281,7 @@ exports[`renders ./components/table/demo/resizable-column.md extend context corr
/>
</th>
<th
aria-label="Amount sortable"
aria-label="this column's title is Amount,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters react-resizable"
tabindex="0"
>
@ -21526,7 +21497,6 @@ exports[`renders ./components/table/demo/resizable-column.md extend context corr
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -21665,7 +21635,6 @@ exports[`renders ./components/table/demo/responsive.md extend context correctly
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -22047,7 +22016,6 @@ exports[`renders ./components/table/demo/row-selection.md extend context correct
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -22620,7 +22588,6 @@ exports[`renders ./components/table/demo/row-selection-and-operation.md extend c
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -23541,7 +23508,6 @@ exports[`renders ./components/table/demo/row-selection-custom.md extend context
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -23955,7 +23921,6 @@ exports[`renders ./components/table/demo/row-selection-custom-debug.md extend co
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -24200,7 +24165,6 @@ exports[`renders ./components/table/demo/size.md extend context correctly 1`] =
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -24397,7 +24361,6 @@ exports[`renders ./components/table/demo/size.md extend context correctly 1`] =
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -25414,7 +25377,6 @@ exports[`renders ./components/table/demo/sticky.md extend context correctly 1`]
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -26608,7 +26570,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -27321,7 +27282,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -35,7 +35,7 @@ exports[`renders ./components/table/demo/ajax.md correctly 1`] = `
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -450,7 +450,6 @@ exports[`renders ./components/table/demo/basic.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -667,7 +666,6 @@ exports[`renders ./components/table/demo/bordered.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -947,7 +945,6 @@ exports[`renders ./components/table/demo/colspan-rowspan.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -1141,7 +1138,7 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
</div>
</th>
<th
aria-label="Address sortable"
aria-label="this column's title is Address,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -1326,7 +1323,6 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] =
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -1526,7 +1522,6 @@ exports[`renders ./components/table/demo/drag-sorting.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -2784,7 +2779,7 @@ Array [
Name
</th>
<th
aria-label="Age sortable"
aria-label="this column's title is Age,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -2883,7 +2878,7 @@ Array [
</div>
</th>
<th
aria-label="Action sortable"
aria-label="this column's title is Action,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -4000,7 +3995,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -4221,7 +4215,6 @@ exports[`renders ./components/table/demo/edit-cell.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -4664,7 +4657,6 @@ exports[`renders ./components/table/demo/edit-row.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -5109,7 +5101,6 @@ exports[`renders ./components/table/demo/ellipsis.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -5407,7 +5398,6 @@ exports[`renders ./components/table/demo/ellipsis-custom-tooltip.md correctly 1`
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -5704,7 +5694,6 @@ exports[`renders ./components/table/demo/expand.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -5861,7 +5850,7 @@ exports[`renders ./components/table/demo/filter-in-tree.md correctly 1`] = `
</div>
</th>
<th
aria-label="Age sortable"
aria-label="this column's title is Age,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -6051,7 +6040,6 @@ exports[`renders ./components/table/demo/filter-in-tree.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -6208,7 +6196,7 @@ exports[`renders ./components/table/demo/filter-search.md correctly 1`] = `
</div>
</th>
<th
aria-label="Age sortable"
aria-label="this column's title is Age,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -6398,7 +6386,6 @@ exports[`renders ./components/table/demo/filter-search.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -6821,7 +6808,6 @@ exports[`renders ./components/table/demo/fixed-columns.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -7788,7 +7774,6 @@ exports[`renders ./components/table/demo/fixed-columns-header.md correctly 1`] =
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -9132,7 +9117,6 @@ exports[`renders ./components/table/demo/fixed-header.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -9382,7 +9366,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
</tr>
<tr>
<th
aria-label="Age sortable"
aria-label="this column's title is Age,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
rowspan="3"
tabindex="0"
@ -10072,7 +10056,6 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -10342,7 +10325,7 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -10607,7 +10590,6 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -10958,7 +10940,6 @@ exports[`renders ./components/table/demo/jsx.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -11074,7 +11055,7 @@ exports[`renders ./components/table/demo/multiple-sorter.md correctly 1`] = `
Name
</th>
<th
aria-label="Chinese Score sortable"
aria-label="this column's title is Chinese Score,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -11135,7 +11116,7 @@ exports[`renders ./components/table/demo/multiple-sorter.md correctly 1`] = `
</div>
</th>
<th
aria-label="Math Score sortable"
aria-label="this column's title is Math Score,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -11196,7 +11177,7 @@ exports[`renders ./components/table/demo/multiple-sorter.md correctly 1`] = `
</div>
</th>
<th
aria-label="English Score sortable"
aria-label="this column's title is English Score,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters"
tabindex="0"
>
@ -11368,7 +11349,6 @@ exports[`renders ./components/table/demo/multiple-sorter.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -11708,7 +11688,6 @@ exports[`renders ./components/table/demo/narrow.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="false"
@ -12339,7 +12318,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -12992,7 +12970,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -13640,7 +13617,6 @@ Array [
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -14288,7 +14264,6 @@ Array [
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -14658,7 +14633,6 @@ exports[`renders ./components/table/demo/order-column.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -14920,7 +14894,6 @@ exports[`renders ./components/table/demo/pagination.md correctly 1`] = `
>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-left"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -15236,7 +15209,6 @@ exports[`renders ./components/table/demo/pagination.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -15392,7 +15364,7 @@ Array [
>
<tr>
<th
aria-label="Name sortable"
aria-label="this column's title is Name,this column is sortable"
class="ant-table-cell ant-table-cell-ellipsis ant-table-column-has-sorters"
tabindex="0"
title="Name"
@ -15487,7 +15459,7 @@ Array [
</div>
</th>
<th
aria-label="Age sortable"
aria-label="this column's title is Age,this column is sortable"
class="ant-table-cell ant-table-cell-ellipsis ant-table-column-has-sorters"
tabindex="0"
title="Age"
@ -15549,7 +15521,7 @@ Array [
</div>
</th>
<th
aria-label="Address sortable"
aria-label="this column's title is Address,this column is sortable"
class="ant-table-cell ant-table-cell-ellipsis ant-table-column-has-sorters"
tabindex="0"
title="Address"
@ -15747,7 +15719,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -15880,7 +15851,7 @@ exports[`renders ./components/table/demo/resizable-column.md correctly 1`] = `
/>
</th>
<th
aria-label="Amount sortable"
aria-label="this column's title is Amount,this column is sortable"
class="ant-table-cell ant-table-column-has-sorters react-resizable"
tabindex="0"
>
@ -16072,7 +16043,6 @@ exports[`renders ./components/table/demo/resizable-column.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -16211,7 +16181,6 @@ exports[`renders ./components/table/demo/responsive.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -16593,7 +16562,6 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -17166,7 +17134,6 @@ exports[`renders ./components/table/demo/row-selection-and-operation.md correctl
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -17793,7 +17760,6 @@ exports[`renders ./components/table/demo/row-selection-custom.md correctly 1`] =
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -18207,7 +18173,6 @@ exports[`renders ./components/table/demo/row-selection-custom-debug.md correctly
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -18452,7 +18417,6 @@ exports[`renders ./components/table/demo/size.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -18649,7 +18613,6 @@ exports[`renders ./components/table/demo/size.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -19666,7 +19629,6 @@ exports[`renders ./components/table/demo/sticky.md correctly 1`] = `
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -20744,7 +20706,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -21457,7 +21418,6 @@ Array [
</div>
<ul
class="ant-pagination ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -17,7 +17,7 @@ import type {
TableLocale,
TransformColumns,
} from '../interface';
import { getColumnKey, getColumnPos, renderColumnTitle } from '../util';
import { getColumnKey, getColumnPos, renderColumnTitle, safeColumnTitle } from '../util';
const ASCEND = 'ascend';
const DESCEND = 'descend';
@ -205,16 +205,21 @@ function injectSorter<RecordType>(
}
};
const renderTitle = safeColumnTitle(column.title, {});
const displayTitle = renderTitle?.toString();
// Inform the screen-reader so it can tell the visually impaired user which column is sorted
if (sorterOrder) {
cell['aria-sort'] = sorterOrder === 'ascend' ? 'ascending' : 'descending';
} else {
cell['aria-label'] = `${renderColumnTitle(column.title, {})} sortable`;
cell['aria-label'] = `${
displayTitle ? `this column's title is ${displayTitle},` : ''
}this column is sortable`;
}
cell.className = classNames(cell.className, `${prefixCls}-column-has-sorters`);
cell.tabIndex = 0;
if (column.ellipsis) {
cell.title = (renderColumnTitle(column.title, {}) ?? '').toString();
cell.title = (renderTitle ?? '').toString();
}
return cell;
},

View File

@ -26,3 +26,20 @@ export function renderColumnTitle<RecordType>(
return title;
}
/**
* Safe get column title
*
* Should filter [object Object]
*
* @param title
* @returns
*/
export function safeColumnTitle<RecordType>(
title: ColumnTitle<RecordType>,
props: ColumnTitleProps<RecordType>,
) {
const res = renderColumnTitle(title, props);
if (Object.prototype.toString.call(res) === '[object Object]') return '';
return res;
}

View File

@ -45,7 +45,7 @@ const Timeline: TimelineType = props => {
) : null;
const timeLineItems = React.Children.toArray(children);
timeLineItems.push(pendingItem as any);
timeLineItems.push(pendingItem!);
if (reverse) {
timeLineItems.reverse();
}

View File

@ -7021,7 +7021,6 @@ Array [
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -7603,7 +7602,6 @@ Array [
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -4515,7 +4515,6 @@ Array [
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"
@ -4968,7 +4967,6 @@ Array [
</div>
<ul
class="ant-pagination ant-pagination-mini ant-table-pagination ant-table-pagination-right"
unselectable="unselectable"
>
<li
aria-disabled="true"

View File

@ -1,6 +1,8 @@
import React from 'react';
import type { KeyWiseTransferItem } from '..';
import { render } from '../../../tests/utils';
import type { TransferListProps } from '../list';
import type TransferList from '../list';
import List from '../list';
const listCommonProps: TransferListProps<any> = {
@ -34,18 +36,22 @@ describe('Transfer.List', () => {
});
it('when component has been unmounted, componentWillUnmount should be called', () => {
const instance = React.createRef<any>();
const instance = React.createRef<TransferList<KeyWiseTransferItem>>();
const { unmount } = render(<List ref={instance} {...listCommonProps} />);
const willUnmount = jest.spyOn(instance.current, 'componentWillUnmount');
const willUnmount = jest.spyOn(instance.current!, 'componentWillUnmount');
unmount();
expect(willUnmount).toHaveBeenCalled();
});
it('when value is not exists, handleFilter should return', () => {
const handleFilter = jest.fn();
const instance = React.createRef<any>();
const instance = React.createRef<TransferList<KeyWiseTransferItem>>();
render(<List ref={instance} {...listCommonProps} handleFilter={handleFilter} />);
expect(instance.current?.handleFilter({ target: 'test' })).toBe(undefined);
expect(
instance.current?.handleFilter({
target: 'test',
} as unknown as React.ChangeEvent<HTMLInputElement>),
).toBe(undefined);
expect(handleFilter).toHaveBeenCalled();
});
it('should render correctly when dataSource is not exists', () => {

View File

@ -1,12 +1,11 @@
import HolderOutlined from '@ant-design/icons/HolderOutlined';
import classNames from 'classnames';
import type { BasicDataNode, TreeProps as RcTreeProps } from 'rc-tree';
import RcTree, { TreeNode } from 'rc-tree';
import RcTree from 'rc-tree';
import type { DataNode, Key } from 'rc-tree/lib/interface';
import * as React from 'react';
import { ConfigContext } from '../config-provider';
import collapseMotion from '../_util/motion';
import DirectoryTree from './DirectoryTree';
import dropIndicatorRender from './utils/dropIndicator';
import renderSwitcherIcon from './utils/iconUtil';
@ -154,13 +153,6 @@ export interface TreeProps<T extends BasicDataNode = DataNode>
blockNode?: boolean;
}
type CompoundedComponent = (<T extends BasicDataNode | DataNode = DataNode>(
props: React.PropsWithChildren<TreeProps<T>> & { ref?: React.Ref<RcTree> },
) => React.ReactElement) & {
TreeNode: typeof TreeNode;
DirectoryTree: typeof DirectoryTree;
};
const Tree = React.forwardRef<RcTree, TreeProps>((props, ref) => {
const { getPrefixCls, direction, virtual } = React.useContext(ConfigContext);
const {
@ -242,10 +234,6 @@ const Tree = React.forwardRef<RcTree, TreeProps>((props, ref) => {
{children}
</RcTree>
);
}) as unknown as CompoundedComponent;
Tree.TreeNode = TreeNode;
Tree.DirectoryTree = DirectoryTree;
});
export default Tree;

View File

@ -81,7 +81,7 @@ const App: React.FC = () => {
const [searchValue, setSearchValue] = useState('');
const [autoExpandParent, setAutoExpandParent] = useState(true);
const onExpand = (newExpandedKeys: string[]) => {
const onExpand = (newExpandedKeys: React.Key[]) => {
setExpandedKeys(newExpandedKeys);
setAutoExpandParent(false);
};

View File

@ -1,6 +1,14 @@
import Tree from './Tree';
import type RcTree from 'rc-tree';
import { TreeNode } from 'rc-tree';
import type { BasicDataNode } from 'rc-tree';
import type { DataNode } from 'rc-tree/lib/interface';
export { DataNode, EventDataNode } from 'rc-tree/lib/interface';
import type { TreeProps } from './Tree';
import TreePure from './Tree';
import DirectoryTree from './DirectoryTree'
export { DataNode }
export { EventDataNode } from 'rc-tree/lib/interface';
export { DirectoryTreeProps, ExpandAction as DirectoryTreeExpandAction } from './DirectoryTree';
export {
AntdTreeNodeAttribute,
@ -13,4 +21,16 @@ export {
TreeProps,
} from './Tree';
type CompoundedComponent = (<T extends BasicDataNode | DataNode = DataNode>(
props: React.PropsWithChildren<TreeProps<T>> & { ref?: React.Ref<RcTree> },
) => React.ReactElement) & {
TreeNode: typeof TreeNode;
DirectoryTree: typeof DirectoryTree;
};
const Tree = TreePure as unknown as CompoundedComponent
Tree.DirectoryTree = DirectoryTree
Tree.TreeNode = TreeNode
export default Tree;

View File

@ -44,7 +44,7 @@ describe('Typography.Editable', () => {
it('should use editConfig.text over children in editing mode ', async () => {
const suffix = '--The information is very important';
const ref = React.createRef<any>();
const ref = React.createRef<HTMLElement>();
const { container: wrapper, unmount } = render(
<Base
ellipsis={{ rows: 1, suffix }}
@ -65,7 +65,7 @@ describe('Typography.Editable', () => {
it('should use children as the fallback of editConfig.text in editing mode', async () => {
const suffix = '--The information is very important';
const ref = React.createRef<any>();
const ref = React.createRef<HTMLElement>();
const { container: wrapper, unmount } = render(
<Base ellipsis={{ rows: 1, suffix }} component="p" ref={ref} editable>
{fullStr}

View File

@ -65,7 +65,7 @@ describe('Typography.Ellipsis', () => {
'Bamboo is Little Light Bamboo is Little Light Bamboo is Little Light Bamboo is Little Light Bamboo is Little Light';
it('should trigger update', async () => {
const ref = React.createRef<any>();
const ref = React.createRef<HTMLElement>();
const onEllipsis = jest.fn();
const { container, rerender, unmount } = render(
<Base ellipsis={{ onEllipsis }} component="p" editable ref={ref}>
@ -73,7 +73,7 @@ describe('Typography.Ellipsis', () => {
</Base>,
);
triggerResize(ref.current);
triggerResize(ref.current!);
await waitFakeTimer();
expect(container.firstChild?.textContent).toEqual('Bamboo is Little ...');
@ -128,7 +128,7 @@ describe('Typography.Ellipsis', () => {
design language for background applications, is refined by Ant UED Team.
Ant Design, a design language for background applications, is refined by
Ant UED Team.`;
const ref = React.createRef<any>();
const ref = React.createRef<HTMLElement>();
const onEllipsis = jest.fn();
const { container: wrapper, unmount } = render(
<Base ellipsis={{ onEllipsis }} component="p" editable ref={ref}>
@ -136,7 +136,7 @@ describe('Typography.Ellipsis', () => {
</Base>,
);
triggerResize(ref.current);
triggerResize(ref.current!);
await waitFakeTimer();
expect(wrapper.firstChild?.textContent).toEqual('Ant Design, a des...');
@ -149,14 +149,14 @@ describe('Typography.Ellipsis', () => {
it('should middle ellipsis', async () => {
const suffix = '--suffix';
const ref = React.createRef<any>();
const ref = React.createRef<HTMLElement>();
const { container: wrapper, unmount } = render(
<Base ellipsis={{ rows: 1, suffix }} component="p" ref={ref}>
{fullStr}
</Base>,
);
triggerResize(ref.current);
triggerResize(ref.current!);
await waitFakeTimer();
expect(wrapper.querySelector('p')?.textContent).toEqual('Bamboo is...--suffix');
@ -165,7 +165,7 @@ describe('Typography.Ellipsis', () => {
it('should front or middle ellipsis', async () => {
const suffix = '--The information is very important';
const ref = React.createRef<any>();
const ref = React.createRef<HTMLElement>();
const {
container: wrapper,
rerender,
@ -176,7 +176,7 @@ describe('Typography.Ellipsis', () => {
</Base>,
);
triggerResize(ref.current);
triggerResize(ref.current!);
await waitFakeTimer();
expect(wrapper.querySelector('p')?.textContent).toEqual(
@ -206,7 +206,7 @@ describe('Typography.Ellipsis', () => {
const bamboo = 'Bamboo';
const is = ' is ';
const ref = React.createRef<any>();
const ref = React.createRef<HTMLElement>();
const { container: wrapper } = render(
<Base ellipsis component="p" editable ref={ref}>
{bamboo}
@ -216,7 +216,7 @@ describe('Typography.Ellipsis', () => {
</Base>,
);
triggerResize(ref.current);
triggerResize(ref.current!);
await waitFakeTimer();
expect(wrapper.textContent).toEqual('Bamboo is Little...');
@ -322,13 +322,13 @@ describe('Typography.Ellipsis', () => {
});
async function getWrapper(tooltip?: EllipsisConfig['tooltip']) {
const ref = React.createRef<any>();
const ref = React.createRef<HTMLElement>();
const wrapper = render(
<Base ellipsis={{ tooltip }} component="p" ref={ref}>
{fullStr}
</Base>,
);
triggerResize(ref.current);
triggerResize(ref.current!);
await waitFakeTimer();
return wrapper;
}
@ -419,13 +419,13 @@ describe('Typography.Ellipsis', () => {
},
});
const ref = React.createRef<any>();
const ref = React.createRef<HTMLElement>();
const { container, baseElement } = render(
<Base component={undefined} ellipsis={{ tooltip: 'This is tooltip', rows: 2 }} ref={ref}>
Ant Design, a design language for background applications, is refined by Ant UED Team.
</Base>,
);
triggerResize(ref.current);
triggerResize(ref.current!);
await waitFakeTimer();
fireEvent.mouseEnter(container.firstChild!);

View File

@ -3,8 +3,8 @@ import * as React from 'react';
export default function useMergedConfig<Target>(
propConfig: any,
templateConfig?: Target,
): [boolean, Target] {
return React.useMemo(() => {
): readonly [boolean, Target] {
return React.useMemo<readonly [boolean, Target]>(() => {
const support = !!propConfig;
return [
@ -13,6 +13,6 @@ export default function useMergedConfig<Target>(
...templateConfig,
...(support && typeof propConfig === 'object' ? propConfig : null),
},
];
] as const;
}, [propConfig]);
}

View File

@ -1,7 +1,7 @@
import * as React from 'react';
/** Similar with `useEffect` but only trigger after mounted */
export default (callback: () => void, conditions: any[]) => {
const useUpdatedEffect = (callback: () => void, conditions?: React.DependencyList) => {
const mountRef = React.useRef(false);
React.useEffect(() => {
@ -12,3 +12,5 @@ export default (callback: () => void, conditions: any[]) => {
}
}, conditions);
};
export default useUpdatedEffect;

View File

@ -6,7 +6,7 @@
// =============== Basic ===============
.@{typography-prefix-cls} {
color: @text-color;
overflow-wrap: break-word;
word-break: break-word;
&&-secondary {
color: @text-color-secondary;

View File

@ -956,7 +956,7 @@ describe('Upload List', () => {
originFileObj: renderInstance(),
};
delete file.thumbUrl;
const ref = React.createRef();
const ref = React.createRef<any>();
const { container: wrapper, unmount } = render(
<Upload
ref={ref}

View File

@ -16,7 +16,7 @@ title: Third-Party Libraries
| Code Editor | [react-codemirror2](https://github.com/scniro/react-codemirror2) [react-monaco-editor](https://github.com/superRaytin/react-monaco-editor) |
| Rich Text Editor | [react-quill](https://github.com/zenoamaro/react-quill) [braft-editor](https://github.com/margox/braft-editor) |
| JSON Viewer | [react-json-view](https://github.com/mac-s-g/react-json-view) |
| Color Picker | [react-color](http://casesandberg.github.io/react-color/) |
| Color Picker | [react-colorful](https://github.com/omgovich/react-colorful) [react-color](http://casesandberg.github.io/react-color/) |
| Media Query | [react-responsive](https://github.com/contra/react-responsive) [react-media](https://github.com/ReactTraining/react-media) |
| Copy to clipboard | [react-copy-to-clipboard](https://github.com/nkbt/react-copy-to-clipboard) |
| Document head manager | [react-helmet](https://github.com/nfl/react-helmet) [react-helmet-async](https://github.com/staylor/react-helmet-async) |

View File

@ -16,7 +16,7 @@ title: 社区精选组件
| 代码编辑器 | [react-codemirror2](https://github.com/scniro/react-codemirror2) [react-monaco-editor](https://github.com/superRaytin/react-monaco-editor) |
| 富文本编辑器 | [react-quill](https://github.com/zenoamaro/react-quill) [braft-editor](https://github.com/margox/braft-editor) |
| JSON 显示器 | [react-json-view](https://github.com/mac-s-g/react-json-view) |
| 拾色器 | [react-color](http://casesandberg.github.io/react-color/) |
| 拾色器 | [react-colorful](https://github.com/omgovich/react-colorful) [react-color](http://casesandberg.github.io/react-color/) |
| 响应式 | [react-responsive](https://github.com/contra/react-responsive) [react-media](https://github.com/ReactTraining/react-media) |
| 复制到剪贴板 | [react-copy-to-clipboard](https://github.com/nkbt/react-copy-to-clipboard) |
| 页面 meta 属性 | [react-helmet](https://github.com/nfl/react-helmet) [react-helmet-async](https://github.com/staylor/react-helmet-async) |

View File

@ -81,7 +81,7 @@
"lint:style": "stylelint '{site,components}/**/*.less'",
"pre-publish": "npm run test-all -- --skip-build",
"prettier": "prettier -c --write **/*",
"pretty-quick": "pretty-quick",
"rome:format": "rome format --write .",
"pub": "npm run version && antd-tools run pub",
"prepublishOnly": "antd-tools run guard",
"postpublish": "node ./scripts/post-script.js",
@ -103,7 +103,8 @@
"version": "node ./scripts/generate-version",
"install-react-16": "npm i --no-save --legacy-peer-deps react@16 react-dom@16",
"install-react-17": "npm i --no-save --legacy-peer-deps react@17 react-dom@17",
"install-react-18": "npm i --no-save --legacy-peer-deps react@18 react-dom@18 @testing-library/react@13"
"install-react-18": "npm i --no-save --legacy-peer-deps react@18 react-dom@18 @testing-library/react@13",
"fix-memory-limit": "cross-env LIMIT=10240 increase-memory-limit"
},
"browserslist": [
"> 0.5%",
@ -130,14 +131,14 @@
"rc-drawer": "~6.0.0",
"rc-dropdown": "~4.0.0",
"rc-field-form": "~1.27.0",
"rc-image": "~5.9.0",
"rc-image": "~5.11.0",
"rc-input": "~0.1.4",
"rc-input-number": "~7.3.9",
"rc-mentions": "~1.10.0",
"rc-menu": "~9.6.3",
"rc-motion": "^2.6.1",
"rc-notification": "~4.6.0",
"rc-pagination": "~3.1.17",
"rc-pagination": "~3.2.0",
"rc-picker": "~2.6.11",
"rc-progress": "~3.4.1",
"rc-rate": "~2.9.0",
@ -230,6 +231,7 @@
"identity-obj-proxy": "^3.0.0",
"immer": "^9.0.1",
"immutability-helper": "^3.0.0",
"increase-memory-limit": "^1.0.7",
"inquirer": "^9.1.2",
"intersection-observer": "^0.12.0",
"isomorphic-fetch": "^3.0.0",
@ -243,6 +245,7 @@
"jsdom": "^20.0.0",
"jsonml.js": "^0.1.0",
"less-vars-to-js": "^1.3.0",
"lint-staged": "^13.0.3",
"lz-string": "^1.4.4",
"mini-css-extract-plugin": "^1.6.2",
"mockdate": "^3.0.0",
@ -250,7 +253,6 @@
"prettier": "^2.3.2",
"prettier-plugin-jsdoc": "^0.4.2",
"pretty-format": "^29.0.0",
"pretty-quick": "^3.0.0",
"qs": "^6.10.1",
"rc-footer": "^0.6.6",
"rc-tween-one": "^3.0.3",
@ -279,6 +281,7 @@
"remark-preset-lint-recommended": "^6.0.0",
"remove-files-webpack-plugin": "1.5.0",
"rimraf": "^3.0.0",
"rome": "^10.0.1",
"scrollama": "^3.0.0",
"semver": "^7.3.5",
"simple-git": "^3.0.0",
@ -286,7 +289,7 @@
"stylelint": "^14.9.0",
"stylelint-config-prettier": "^9.0.2",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-standard": "^28.0.0",
"stylelint-config-standard": "^29.0.0",
"stylelint-declaration-block-no-ignored-properties": "^2.1.0",
"stylelint-order": "^5.0.0",
"theme-switcher": "^1.0.2",
@ -348,5 +351,8 @@
],
"tnpm": {
"mode": "npm"
},
"lint-staged": {
"*.{ts,tsx,js,json,less,md}": "rome format --write"
}
}

14
rome.json Normal file
View File

@ -0,0 +1,14 @@
{
"formatter": {
"enabled": true,
"ignore": ["./dist/*", "./es/**/*", "./lib/**/*", "_site/**/*"],
"indentStyle": "space",
"lineWidth": 100,
"indentSize": 2
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
}

View File

@ -57,7 +57,6 @@ if (changeLog) {
console.log(chalk.blue('[check-version-md]: Check Passed'));
console.log('\n');
process.exit(0);
return;
}
}
console.log('\n');

View File

@ -50,7 +50,7 @@ const ComponentOverview = ({
const [search, setSearch] = useState('');
// keydown.enter goto first component
const sectionRef = React.createRef();
const sectionRef = React.useRef(null);
const onKeyDown = event => {
if (event.keyCode === 13 && search.trim().length) {
sectionRef.current?.querySelector('.components-overview-card')?.click();