mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
Merge pull request #28585 from ant-design/master
This commit is contained in:
commit
98b90c3685
@ -118,7 +118,7 @@ module.exports = {
|
||||
'jest/no-conditional-expect': 0,
|
||||
|
||||
'unicorn/better-regex': 2,
|
||||
'unicorn/prefer-trim-start-end': 2,
|
||||
'unicorn/prefer-string-trim-start-end': 2,
|
||||
'unicorn/expiring-todo-comments': 2,
|
||||
'unicorn/no-abusive-eslint-disable': 2,
|
||||
|
||||
|
14
.github/workflows/issue-close-require.yml
vendored
14
.github/workflows/issue-close-require.yml
vendored
@ -8,10 +8,22 @@ jobs:
|
||||
close-issues:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: close-issues
|
||||
- name: need reproduce
|
||||
uses: actions-cool/issues-helper@v1.2
|
||||
with:
|
||||
actions: 'close-issues'
|
||||
token: ${{ secrets.ANT_BOT_TOKEN }}
|
||||
labels: '🤔 Need Reproduce'
|
||||
inactive-day: 3
|
||||
|
||||
- name: needs more info
|
||||
uses: actions-cool/issues-helper@v1.2
|
||||
with:
|
||||
actions: 'close-issues'
|
||||
token: ${{ secrets.ANT_BOT_TOKEN }}
|
||||
labels: 'needs-more-info'
|
||||
inactive-day: 3
|
||||
body: |
|
||||
Since the issue was labeled with `needs-more-info`, but no response in 3 days. This issue will be closed. If you have any questions, you can comment and reply.
|
||||
|
||||
由于该 issue 被标记为需要更多信息,却 3 天未收到回应。现关闭 issue,若有任何问题,可评论回复。
|
||||
|
2
.github/workflows/issue-remove-inactive.yml
vendored
2
.github/workflows/issue-remove-inactive.yml
vendored
@ -16,4 +16,4 @@ jobs:
|
||||
actions: 'remove-labels'
|
||||
token: ${{ secrets.ANT_BOT_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
labels: 'Inactive'
|
||||
labels: 'Inactive,needs-more-info'
|
||||
|
@ -25,6 +25,7 @@ export interface AbstractCheckboxProps<T> {
|
||||
id?: string;
|
||||
autoFocus?: boolean;
|
||||
type?: string;
|
||||
skipGroup?: boolean;
|
||||
}
|
||||
|
||||
export interface CheckboxChangeEventTarget extends CheckboxProps {
|
||||
@ -51,6 +52,7 @@ const InternalCheckbox: React.ForwardRefRenderFunction<HTMLInputElement, Checkbo
|
||||
style,
|
||||
onMouseEnter,
|
||||
onMouseLeave,
|
||||
skipGroup = false,
|
||||
...restProps
|
||||
},
|
||||
ref,
|
||||
@ -70,6 +72,9 @@ const InternalCheckbox: React.ForwardRefRenderFunction<HTMLInputElement, Checkbo
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (skipGroup) {
|
||||
return;
|
||||
}
|
||||
if (restProps.value !== prevValue.current) {
|
||||
checkboxGroup?.cancelValue(prevValue.current);
|
||||
checkboxGroup?.registerValue(restProps.value);
|
||||
@ -79,7 +84,7 @@ const InternalCheckbox: React.ForwardRefRenderFunction<HTMLInputElement, Checkbo
|
||||
|
||||
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
||||
const checkboxProps: CheckboxProps = { ...restProps };
|
||||
if (checkboxGroup) {
|
||||
if (checkboxGroup && !skipGroup) {
|
||||
checkboxProps.onChange = (...args) => {
|
||||
if (restProps.onChange) {
|
||||
restProps.onChange(...args);
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { mount, render } from 'enzyme';
|
||||
import Collapse from '../../collapse';
|
||||
import Table from '../../table';
|
||||
import Checkbox from '../index';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import rtlTest from '../../../tests/shared/rtlTest';
|
||||
@ -174,4 +175,31 @@ describe('CheckboxGroup', () => {
|
||||
wrapper.find('.ant-checkbox-input').at(0).simulate('change');
|
||||
expect(wrapper.find('.ant-checkbox-checked').length).toBe(0);
|
||||
});
|
||||
|
||||
it('skipGroup', () => {
|
||||
const onChange = jest.fn();
|
||||
const wrapper = mount(
|
||||
<Checkbox.Group onChange={onChange}>
|
||||
<Checkbox value={1} />
|
||||
<Checkbox value={2} skipGroup />
|
||||
</Checkbox.Group>,
|
||||
);
|
||||
wrapper.find('.ant-checkbox-input').at(1).simulate('change');
|
||||
expect(onChange).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('Table rowSelection', () => {
|
||||
const onChange = jest.fn();
|
||||
const wrapper = mount(
|
||||
<Checkbox.Group onChange={onChange}>
|
||||
<Table
|
||||
dataSource={[{ key: 1, value: '1' }]}
|
||||
columns={[{ title: 'title', dataIndex: 'value' }]}
|
||||
rowSelection={{}}
|
||||
/>
|
||||
</Checkbox.Group>,
|
||||
);
|
||||
wrapper.find('.ant-checkbox-input').at(1).simulate('change');
|
||||
expect(onChange).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@ -1,3 +1,4 @@
|
||||
import * as React from 'react';
|
||||
import InternalCheckbox, { CheckboxProps } from './Checkbox';
|
||||
import Group from './Group';
|
||||
|
||||
|
@ -225,6 +225,22 @@
|
||||
background-color: @dropdown-menu-submenu-disabled-bg;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
> a {
|
||||
position: relative;
|
||||
color: @disabled-color;
|
||||
pointer-events: none;
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: not-allowed;
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-divider {
|
||||
|
@ -20,7 +20,7 @@ const Steps: React.FC<StepsProps> = props => {
|
||||
prefixCls,
|
||||
children,
|
||||
} = props;
|
||||
const current = Math.floor(steps * (percent / 100));
|
||||
const current = Math.round(steps * (percent / 100));
|
||||
const stepWidth = size === 'small' ? 2 : 14;
|
||||
const styledSteps = [];
|
||||
for (let i = 0; i < steps; i += 1) {
|
||||
|
@ -1415,7 +1415,7 @@ Array [
|
||||
style="width:14px;height:8px"
|
||||
/>
|
||||
<div
|
||||
class="ant-progress-steps-item"
|
||||
class="ant-progress-steps-item ant-progress-steps-item-active"
|
||||
style="width:14px;height:8px"
|
||||
/>
|
||||
<div
|
||||
@ -1442,7 +1442,7 @@ Array [
|
||||
style="width:14px;height:8px"
|
||||
/>
|
||||
<div
|
||||
class="ant-progress-steps-item"
|
||||
class="ant-progress-steps-item ant-progress-steps-item-active"
|
||||
style="width:14px;height:8px"
|
||||
/>
|
||||
<div
|
||||
|
@ -175,6 +175,15 @@ describe('Progress', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should display correct step', () => {
|
||||
const wrapper = mount(<Progress steps={9} percent={22.22} />);
|
||||
expect(wrapper.find('.ant-progress-steps-item-active').length).toBe(2);
|
||||
wrapper.setProps({ percent: 33.33 });
|
||||
expect(wrapper.find('.ant-progress-steps-item-active').length).toBe(3);
|
||||
wrapper.setProps({ percent: 44.44 });
|
||||
expect(wrapper.find('.ant-progress-steps-item-active').length).toBe(4);
|
||||
});
|
||||
|
||||
it('steps should have default percent 0', () => {
|
||||
const wrapper = mount(<ProgressSteps />);
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
|
@ -98,6 +98,7 @@
|
||||
color: @input-placeholder-color;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
pointer-events: none;
|
||||
|
||||
// IE11 css hack. `*::-ms-backdrop,` is a must have
|
||||
@media all and (-ms-high-contrast: none) {
|
||||
|
@ -410,6 +410,7 @@ export default function useSelection<RecordType>(
|
||||
indeterminate={!checkedCurrentAll && checkedCurrentSome}
|
||||
onChange={onSelectAllChange}
|
||||
disabled={flattedData.length === 0 || allDisabled}
|
||||
skipGroup
|
||||
/>
|
||||
{customizeSelections}
|
||||
</div>
|
||||
@ -467,6 +468,7 @@ export default function useSelection<RecordType>(
|
||||
{...checkboxProps}
|
||||
indeterminate={mergedIndeterminate}
|
||||
checked={checked}
|
||||
skipGroup
|
||||
onClick={e => e.stopPropagation()}
|
||||
onChange={({ nativeEvent }) => {
|
||||
const { shiftKey } = nativeEvent;
|
||||
|
@ -96,9 +96,9 @@ Before `3.4.0`: The number of treeNodes can be very large, but when `checkable=t
|
||||
|
||||
### Tree Methods
|
||||
|
||||
| Name | Description |
|
||||
| ----------------- | ------------------------------------ |
|
||||
| scrollTo({ key }) | Scroll to key item in virtual scroll |
|
||||
| Name | Description |
|
||||
| --- | --- |
|
||||
| scrollTo({ key: string \| number; align?: 'top' \| 'bottom' \| 'auto'; offset?: number }) | Scroll to key item in virtual scroll |
|
||||
|
||||
## FAQ
|
||||
|
||||
|
@ -66,7 +66,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/Xh-oWqg9k/Tree.svg
|
||||
| disableCheckbox | 禁掉 checkbox | boolean | false | |
|
||||
| disabled | 禁掉响应 | boolean | false | |
|
||||
| icon | 自定义图标。可接收组件,props 为当前节点 props | ReactNode \| (props) => ReactNode | - | |
|
||||
| isLeaf | 设置为叶子节点(设置了`loadData`时有效)。为 `false` 时会强制将其作为父节点 | boolean | - | |
|
||||
| isLeaf | 设置为叶子节点 (设置了 `loadData` 时有效)。为 `false` 时会强制将其作为父节点 | boolean | - | |
|
||||
| key | 被树的 (default)ExpandedKeys / (default)CheckedKeys / (default)SelectedKeys 属性所用。注意:整个树范围内的所有节点的 key 值不能重复! | string | (内部计算出的节点位置) | |
|
||||
| selectable | 设置节点是否可被选中 | boolean | true | |
|
||||
| title | 标题 | ReactNode | `---` | |
|
||||
@ -97,9 +97,9 @@ cover: https://gw.alipayobjects.com/zos/alicdn/Xh-oWqg9k/Tree.svg
|
||||
|
||||
### Tree 方法
|
||||
|
||||
| 名称 | 说明 |
|
||||
| ----------------- | ------------------------------- |
|
||||
| scrollTo({ key }) | 虚拟滚动下,滚动到指定 key 条目 |
|
||||
| 名称 | 说明 |
|
||||
| --- | --- |
|
||||
| scrollTo({ key: string \| number; align?: 'top' \| 'bottom' \| 'auto'; offset?: number }) | 虚拟滚动下,滚动到指定 key 条目 |
|
||||
|
||||
## FAQ
|
||||
|
||||
|
@ -153,7 +153,7 @@
|
||||
"devDependencies": {
|
||||
"@ant-design/bisheng-plugin": "^2.3.0",
|
||||
"@ant-design/hitu": "^0.0.0-alpha.13",
|
||||
"@ant-design/tools": "^13.0.0",
|
||||
"@ant-design/tools": "^13.0.1",
|
||||
"@qixian.cs/github-contributors-list": "^1.0.3",
|
||||
"@stackblitz/sdk": "^1.3.0",
|
||||
"@types/classnames": "^2.2.8",
|
||||
@ -207,7 +207,7 @@
|
||||
"eslint-plugin-markdown": "^1.0.0",
|
||||
"eslint-plugin-react": "^7.20.6",
|
||||
"eslint-plugin-react-hooks": "^4.1.2",
|
||||
"eslint-plugin-unicorn": "^24.0.0",
|
||||
"eslint-plugin-unicorn": "^25.0.0",
|
||||
"eslint-tinker": "^0.5.0",
|
||||
"fetch-jsonp": "^1.1.3",
|
||||
"fs-extra": "^9.0.0",
|
||||
|
Loading…
Reference in New Issue
Block a user