mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
Merge remote-tracking branch 'origin/master' into 4.0-prepare
This commit is contained in:
commit
43b3da9eae
@ -8,7 +8,7 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
export interface AnchorLinkProps {
|
||||
prefixCls?: string;
|
||||
href: string;
|
||||
target: string;
|
||||
target?: string;
|
||||
title: React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
|
@ -39,7 +39,7 @@ exports[`Descriptions Descriptions support colon 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={false}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="horizontal"
|
||||
type="label"
|
||||
>
|
||||
@ -116,7 +116,7 @@ exports[`Descriptions Descriptions support style 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="horizontal"
|
||||
type="label"
|
||||
>
|
||||
@ -183,7 +183,7 @@ exports[`Descriptions Descriptions.Item support className 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="horizontal"
|
||||
type="label"
|
||||
>
|
||||
@ -241,7 +241,7 @@ exports[`Descriptions column is number 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="horizontal"
|
||||
type="label"
|
||||
>
|
||||
@ -274,7 +274,7 @@ exports[`Descriptions column is number 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="1"
|
||||
key="label-1"
|
||||
layout="horizontal"
|
||||
type="label"
|
||||
>
|
||||
@ -307,7 +307,7 @@ exports[`Descriptions column is number 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="2"
|
||||
key="label-2"
|
||||
layout="horizontal"
|
||||
type="label"
|
||||
>
|
||||
@ -346,7 +346,7 @@ exports[`Descriptions column is number 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="horizontal"
|
||||
type="label"
|
||||
>
|
||||
@ -414,7 +414,7 @@ exports[`Descriptions vertical layout 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="vertical"
|
||||
type="label"
|
||||
>
|
||||
@ -446,7 +446,7 @@ exports[`Descriptions vertical layout 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="content-0"
|
||||
layout="vertical"
|
||||
type="content"
|
||||
>
|
||||
@ -478,7 +478,7 @@ exports[`Descriptions vertical layout 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="vertical"
|
||||
type="label"
|
||||
>
|
||||
@ -510,7 +510,7 @@ exports[`Descriptions vertical layout 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="content-0"
|
||||
layout="vertical"
|
||||
type="content"
|
||||
>
|
||||
@ -542,7 +542,7 @@ exports[`Descriptions vertical layout 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="vertical"
|
||||
type="label"
|
||||
>
|
||||
@ -574,7 +574,7 @@ exports[`Descriptions vertical layout 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="content-0"
|
||||
layout="vertical"
|
||||
type="content"
|
||||
>
|
||||
@ -607,7 +607,7 @@ exports[`Descriptions vertical layout 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="vertical"
|
||||
type="label"
|
||||
>
|
||||
@ -640,7 +640,7 @@ exports[`Descriptions vertical layout 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="content-0"
|
||||
layout="vertical"
|
||||
type="content"
|
||||
>
|
||||
@ -701,7 +701,7 @@ exports[`Descriptions when item is rendered conditionally 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="horizontal"
|
||||
type="label"
|
||||
>
|
||||
@ -739,7 +739,7 @@ exports[`Descriptions when item is rendered conditionally 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="horizontal"
|
||||
type="label"
|
||||
>
|
||||
@ -777,7 +777,7 @@ exports[`Descriptions when item is rendered conditionally 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="horizontal"
|
||||
type="label"
|
||||
>
|
||||
@ -816,7 +816,7 @@ exports[`Descriptions when item is rendered conditionally 1`] = `
|
||||
</DescriptionsItem>
|
||||
}
|
||||
colon={true}
|
||||
key="0"
|
||||
key="label-0"
|
||||
layout="horizontal"
|
||||
type="label"
|
||||
>
|
||||
|
@ -183,6 +183,6 @@ describe('Descriptions', () => {
|
||||
</Descriptions>,
|
||||
);
|
||||
|
||||
expect(wrapper.find('Col').key()).toBe('bamboo');
|
||||
expect(wrapper.find('Col').key()).toBe('label-bamboo');
|
||||
});
|
||||
});
|
||||
|
@ -105,7 +105,7 @@ const renderRow = (
|
||||
bordered={bordered}
|
||||
colon={colon}
|
||||
type={type}
|
||||
key={colItem.key || idx}
|
||||
key={`${type}-${colItem.key || idx}`}
|
||||
layout={layout}
|
||||
/>
|
||||
);
|
||||
|
@ -63,6 +63,11 @@
|
||||
.@{drawer-prefix-cls}-content-wrapper {
|
||||
box-shadow: @shadow-1-left;
|
||||
}
|
||||
// https://github.com/ant-design/ant-design/issues/18607, Avoid edge alignment bug.
|
||||
&.no-mask {
|
||||
right: 1px;
|
||||
transform: translateX(1px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,6 +111,10 @@
|
||||
.@{drawer-prefix-cls}-content-wrapper {
|
||||
box-shadow: @shadow-1-up;
|
||||
}
|
||||
&.no-mask {
|
||||
bottom: 1px;
|
||||
transform: translateY(1px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,11 +384,11 @@
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: @input-color;
|
||||
line-height: 0;
|
||||
transform: translateY(-50%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
:not(.anticon) {
|
||||
line-height: @line-height-base;
|
||||
|
@ -4,6 +4,7 @@ import Select from '..';
|
||||
import Icon from '../../icon';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
|
||||
const { Option } = Select;
|
||||
|
||||
@ -132,4 +133,16 @@ describe('Select', () => {
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
it('warning if user use `inputValue`', () => {
|
||||
resetWarned();
|
||||
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
|
||||
mount(<Select inputValue="" />);
|
||||
expect(errorSpy).toHaveBeenLastCalledWith(
|
||||
'Warning: [antd: Select] `inputValue` is deprecated. Please use `searchValue` instead.',
|
||||
);
|
||||
|
||||
errorSpy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
@ -45,6 +45,7 @@ Select component to select value from options.
|
||||
| optionFilterProp | Which prop value of option will be used for filter if filterOption is true | string | value | |
|
||||
| optionLabelProp | Which prop value of option will render as content of select. [Example](https://codesandbox.io/s/antd-reproduction-template-tk678) | string | `value` for `combobox`, `children` for other modes | |
|
||||
| placeholder | Placeholder of select | string\|ReactNode | - | |
|
||||
| searchValue | Search input value | string | - | 3.23.2 |
|
||||
| showArrow | Whether to show the drop-down arrow | boolean | true | 3.2.1 |
|
||||
| showSearch | Whether show search input in single mode. | boolean | false | |
|
||||
| size | Size of Select input. `default` `large` `small` | string | default | |
|
||||
@ -54,7 +55,6 @@ Select component to select value from options.
|
||||
| menuItemSelectedIcon | The custom menuItemSelected icon with multiple options | ReactNode | - | 3.11.0 |
|
||||
| tokenSeparators | Separator used to tokenize on tag/multiple mode | string\[] | | |
|
||||
| value | Current selected option. | string\|string\[]\<br />number\|number\[]\<br />LabeledValue\|LabeledValue[] | - | |
|
||||
| inputValue | Current search text | string | - | |
|
||||
| onBlur | Called when blur | function | - | |
|
||||
| onChange | Called when select an option or input value change, or value of input is changed in combobox mode | function(value, option:Option/Array<Option>) | - | |
|
||||
| onDeselect | Called when a option is deselected, param is the selected option's value. Only called for multiple or tags, effective in multiple or tags mode only. | function(string\|number\|LabeledValue) | - | |
|
||||
|
@ -54,7 +54,9 @@ export type SelectValue = string | string[] | number | number[] | LabeledValue |
|
||||
|
||||
export interface SelectProps<T = SelectValue> extends AbstractSelectProps {
|
||||
value?: T;
|
||||
/** @deprecated Use `searchValue` instead. */
|
||||
inputValue?: string;
|
||||
searchValue?: string;
|
||||
defaultValue?: T;
|
||||
mode?: 'default' | 'multiple' | 'tags' | 'combobox' | string;
|
||||
optionLabelProp?: string;
|
||||
@ -111,9 +113,6 @@ const SelectPropTypes = {
|
||||
id: PropTypes.string,
|
||||
};
|
||||
|
||||
// => It is needless to export the declaration of below two inner components.
|
||||
// export { Option, OptGroup };
|
||||
|
||||
export default class Select<T = SelectValue> extends React.Component<SelectProps<T>, {}> {
|
||||
static Option = Option as React.ClassicComponentClass<OptionProps>;
|
||||
|
||||
@ -141,6 +140,12 @@ export default class Select<T = SelectValue> extends React.Component<SelectProps
|
||||
'it will be removed in next major version, ' +
|
||||
'please use AutoComplete instead',
|
||||
);
|
||||
|
||||
warning(
|
||||
!('inputValue' in props),
|
||||
'Select',
|
||||
'`inputValue` is deprecated. Please use `searchValue` instead.',
|
||||
);
|
||||
}
|
||||
|
||||
getNotFoundContent(renderEmpty: RenderEmptyHandler) {
|
||||
@ -154,14 +159,6 @@ export default class Select<T = SelectValue> extends React.Component<SelectProps
|
||||
}
|
||||
|
||||
return renderEmpty('Select');
|
||||
|
||||
// if (this.isCombobox()) {
|
||||
// // AutoComplete don't have notFoundContent defaultly
|
||||
// return notFoundContent === undefined ? null : notFoundContent;
|
||||
// }
|
||||
|
||||
// return renderEmpty('Select');
|
||||
// // return notFoundContent === undefined ? locale.notFoundContent : notFoundContent;
|
||||
}
|
||||
|
||||
saveSelect = (node: any) => {
|
||||
@ -211,6 +208,8 @@ export default class Select<T = SelectValue> extends React.Component<SelectProps
|
||||
clearIcon,
|
||||
menuItemSelectedIcon,
|
||||
showArrow,
|
||||
inputValue,
|
||||
searchValue,
|
||||
...restProps
|
||||
} = this.props;
|
||||
const rest = omit(restProps, ['inputIcon']);
|
||||
@ -270,6 +269,7 @@ export default class Select<T = SelectValue> extends React.Component<SelectProps
|
||||
showArrow={showArrow}
|
||||
{...rest}
|
||||
{...modeConfig}
|
||||
inputValue={searchValue || inputValue}
|
||||
prefixCls={prefixCls}
|
||||
className={cls}
|
||||
optionLabelProp={optionLabelProp || 'children'}
|
||||
|
@ -46,6 +46,7 @@ title: Select
|
||||
| optionFilterProp | 搜索时过滤对应的 option 属性,如设置为 children 表示对内嵌内容进行搜索。[示例](https://codesandbox.io/s/antd-reproduction-template-tk678) | string | value | |
|
||||
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` (combobox 模式下为 `value`) | |
|
||||
| placeholder | 选择框默认文字 | string | - | |
|
||||
| searchValue | 搜索框文本 | string | - | 3.23.2 |
|
||||
| showArrow | 是否显示下拉小箭头 | boolean | true | 3.2.1 |
|
||||
| showSearch | 使单选模式可搜索 | boolean | false | |
|
||||
| size | 选择框大小,可选 `large` `small` | string | default | |
|
||||
|
@ -399,9 +399,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
// 当数据量少于等于每页数量时,直接设置数据
|
||||
// 否则进行读取分页数据
|
||||
if (data.length > pageSize || pageSize === Number.MAX_VALUE) {
|
||||
data = data.filter((_, i) => {
|
||||
return i >= (current - 1) * pageSize && i < current * pageSize;
|
||||
});
|
||||
data = data.slice((current - 1) * pageSize, current * pageSize);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
@ -229,7 +229,6 @@ class NameColumn extends Table.Column<User> {}
|
||||
<Table<User> dataSource={data}>
|
||||
<Table.Column<User> key="name" title="Name" dataIndex="name" />
|
||||
</Table>
|
||||
|
||||
```
|
||||
|
||||
## 注意
|
||||
|
@ -246,8 +246,8 @@
|
||||
// https://github.com/ant-design/ant-design/issues/18103
|
||||
&-content::before {
|
||||
display: block;
|
||||
content: '';
|
||||
overflow: hidden;
|
||||
content: '';
|
||||
}
|
||||
|
||||
// Horizontal Content
|
||||
|
@ -54,7 +54,7 @@ Almost anything can be represented in a tree structure. Examples include directo
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| checkable | When Tree is checkable, set TreeNode display Checkbox or not | boolean | - | 3.17.0 | 3.17.0 |
|
||||
| checkable | When Tree is checkable, set TreeNode display Checkbox or not | boolean | - | 3.17.0 |
|
||||
| disableCheckbox | Disables the checkbox of the treeNode | boolean | false | | |
|
||||
| disabled | Disables the treeNode | boolean | false | | |
|
||||
| icon | customize icon. When you pass component, whose render will receive full TreeNode props as component props | ReactNode/Function(props):ReactNode | - | | 3.4.0 |
|
||||
|
Loading…
Reference in New Issue
Block a user