mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
Merge remote-tracking branch 'origin/master' into feature-merge-master
This commit is contained in:
commit
e6b1b1a4e7
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -4,17 +4,20 @@ First of all, thank you for your contribution! 😄
|
||||
New feature please send pull request to feature branch, and rest to master branch.
|
||||
Pull request will be merged after one of collaborators approve.
|
||||
Please makes sure that these form are filled before submitting your pull request, thank you!
|
||||
-->
|
||||
|
||||
[[中文版模板 / Chinese template](https://github.com/ant-design/ant-design/blob/master/.github/PULL_REQUEST_TEMPLATE/pr_cn.md)]
|
||||
-->
|
||||
|
||||
### 🤔 This is a ...
|
||||
|
||||
- [ ] New feature
|
||||
- [ ] Bug fix
|
||||
- [ ] Site / document update
|
||||
- [ ] Site / documentation update
|
||||
- [ ] Demo update
|
||||
- [ ] Component style update
|
||||
- [ ] TypeScript definition update
|
||||
- [ ] Bundle size optimization
|
||||
- [ ] Perfermance optimization
|
||||
- [ ] Refactoring
|
||||
- [ ] Code style optimization
|
||||
- [ ] Test Case
|
||||
|
3
.github/PULL_REQUEST_TEMPLATE/pr_cn.md
vendored
3
.github/PULL_REQUEST_TEMPLATE/pr_cn.md
vendored
@ -13,8 +13,11 @@
|
||||
- [ ] 新特性提交
|
||||
- [ ] 日常 bug 修复
|
||||
- [ ] 站点、文档改进
|
||||
- [ ] 演示代码改进
|
||||
- [ ] 组件样式改进
|
||||
- [ ] TypeScript 定义更新
|
||||
- [ ] 包体积优化
|
||||
- [ ] 性能优化
|
||||
- [ ] 重构
|
||||
- [ ] 代码风格优化
|
||||
- [ ] 测试用例
|
||||
|
7
components/_util/devWarning.ts
Normal file
7
components/_util/devWarning.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import devWarning, { resetWarned } from 'rc-util/lib/warning';
|
||||
|
||||
export { resetWarned };
|
||||
|
||||
export default (valid: boolean, component: string, message: string): void => {
|
||||
devWarning(valid, `[antd: ${component}] ${message}`);
|
||||
};
|
@ -1,7 +0,0 @@
|
||||
import warning, { resetWarned } from 'rc-util/lib/warning';
|
||||
|
||||
export { resetWarned };
|
||||
|
||||
export default (valid: boolean, component: string, message: string): void => {
|
||||
warning(valid, `[antd: ${component}] ${message}`);
|
||||
};
|
@ -12,7 +12,7 @@ import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import Select, { InternalSelectProps, OptionType } from '../select';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
const { Option } = Select;
|
||||
|
||||
@ -25,7 +25,10 @@ export interface DataSourceItemObject {
|
||||
export type DataSourceItemType = string | DataSourceItemObject;
|
||||
|
||||
export interface AutoCompleteProps
|
||||
extends Omit<InternalSelectProps<string>, 'inputIcon' | 'loading' | 'mode' | 'optionLabelProp' | 'labelInValue'> {
|
||||
extends Omit<
|
||||
InternalSelectProps<string>,
|
||||
'inputIcon' | 'loading' | 'mode' | 'optionLabelProp' | 'labelInValue'
|
||||
> {
|
||||
dataSource?: DataSourceItemType[];
|
||||
}
|
||||
|
||||
@ -90,13 +93,13 @@ const AutoComplete: React.RefForwardingComponent<Select, AutoCompleteProps> = (p
|
||||
|
||||
// ============================ Warning ============================
|
||||
React.useEffect(() => {
|
||||
warning(
|
||||
devWarning(
|
||||
!('dataSource' in props),
|
||||
'AutoComplete',
|
||||
'`dataSource` is deprecated, please use `options` instead.',
|
||||
);
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
!customizeInput || !('size' in props),
|
||||
'AutoComplete',
|
||||
'You need to control style self instead of setting `size` when using customize input.',
|
||||
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
export interface AvatarProps {
|
||||
/** Shape of avatar, options:`circle`, `square` */
|
||||
@ -109,7 +109,7 @@ export default class Avatar extends React.Component<AvatarProps, AvatarState> {
|
||||
...others
|
||||
} = this.props;
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
!(typeof icon === 'string' && icon.length > 2),
|
||||
'Avatar',
|
||||
`\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`,
|
||||
|
@ -6,7 +6,7 @@ import BreadcrumbItem from './BreadcrumbItem';
|
||||
import BreadcrumbSeparator from './BreadcrumbSeparator';
|
||||
import Menu from '../menu';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import { Omit } from '../_util/type';
|
||||
|
||||
export interface Route {
|
||||
@ -130,7 +130,7 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
|
||||
return element;
|
||||
}
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
element.type &&
|
||||
(element.type.__ANT_BREADCRUMB_ITEM === true ||
|
||||
element.type.__ANT_BREADCRUMB_SEPARATOR === true),
|
||||
|
@ -7,7 +7,7 @@ import Group from './button-group';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import Wave from '../_util/wave';
|
||||
import { Omit, tuple } from '../_util/type';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import SizeContext, { SizeType } from '../config-provider/SizeContext';
|
||||
import LoadingIcon from './LoadingIcon';
|
||||
|
||||
@ -186,7 +186,7 @@ const InternalButton: React.ForwardRefRenderFunction<unknown, ButtonProps> = (pr
|
||||
...rest
|
||||
} = props;
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
!(typeof icon === 'string' && icon.length > 2),
|
||||
'Button',
|
||||
`\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`,
|
||||
|
@ -14,7 +14,7 @@ import LeftOutlined from '@ant-design/icons/LeftOutlined';
|
||||
import Input from '../input';
|
||||
import { ConfigConsumer, ConfigConsumerProps, RenderEmptyHandler } from '../config-provider';
|
||||
import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import SizeContext, { SizeType } from '../config-provider/SizeContext';
|
||||
|
||||
export interface CascaderOptionType {
|
||||
@ -211,7 +211,7 @@ const defaultDisplayRender = (label: string[]) => label.join(' / ');
|
||||
function warningValueNotExist(list: CascaderOptionType[], fieldNames: FieldNamesType = {}) {
|
||||
(list || []).forEach(item => {
|
||||
const valueFieldName = fieldNames.value || 'value';
|
||||
warning(valueFieldName in item, 'Cascader', 'Not found `value` in `options`.');
|
||||
devWarning(valueFieldName in item, 'Cascader', 'Not found `value` in `options`.');
|
||||
warningValueNotExist(item[fieldNames.children || 'children'], fieldNames);
|
||||
});
|
||||
}
|
||||
@ -384,7 +384,7 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
|
||||
return matchCount >= limit;
|
||||
});
|
||||
} else {
|
||||
warning(
|
||||
devWarning(
|
||||
typeof limit !== 'number',
|
||||
'Cascader',
|
||||
"'limit' of showSearch should be positive number or false.",
|
||||
|
@ -3,7 +3,7 @@ import classNames from 'classnames';
|
||||
import RcCheckbox from 'rc-checkbox';
|
||||
import CheckboxGroup, { GroupContext } from './Group';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
export interface AbstractCheckboxProps<T> {
|
||||
prefixCls?: string;
|
||||
@ -60,7 +60,7 @@ class Checkbox extends React.PureComponent<CheckboxProps, {}> {
|
||||
const { value } = this.props;
|
||||
this.context?.registerValue(value);
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
'checked' in this.props || this.context || !('value' in this.props),
|
||||
'Checkbox',
|
||||
'`value` is not a valid prop, do you mean `checked`?',
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Checkbox from '..';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
import { resetWarned } from '../../_util/devWarning';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import rtlTest from '../../../tests/shared/rtlTest';
|
||||
|
||||
|
@ -1,80 +0,0 @@
|
||||
.@{calendar-prefix-cls}-decade-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: @zindex-picker-panel;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: @calendar-bg;
|
||||
border-radius: @border-radius-base;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-decade-panel-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-decade-panel-header {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-decade-panel-body {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-decade-panel-footer {
|
||||
border-top: @border-width-base @border-style-base @border-color-split;
|
||||
.@{calendar-prefix-cls}-footer-extra {
|
||||
padding: 0 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-decade-panel-table {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
table-layout: fixed;
|
||||
border-collapse: separate;
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-decade-panel-cell {
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-decade-panel-decade {
|
||||
display: inline-block;
|
||||
height: 24px;
|
||||
margin: 0 auto;
|
||||
padding: 0 6px;
|
||||
color: @text-color;
|
||||
line-height: 24px;
|
||||
text-align: center;
|
||||
background: transparent;
|
||||
border-radius: @border-radius-base;
|
||||
transition: background 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
background: @item-hover-bg;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-decade-panel-selected-cell .@{calendar-prefix-cls}-decade-panel-decade {
|
||||
color: @text-color-inverse;
|
||||
background: @primary-color;
|
||||
|
||||
&:hover {
|
||||
color: @text-color-inverse;
|
||||
background: @primary-color;
|
||||
}
|
||||
}
|
||||
|
||||
.@{calendar-prefix-cls}-decade-panel-last-century-cell,
|
||||
.@{calendar-prefix-cls}-decade-panel-next-century-cell {
|
||||
.@{calendar-prefix-cls}-decade-panel-decade {
|
||||
color: @disabled-color;
|
||||
user-select: none;
|
||||
}
|
||||
}
|
@ -10,7 +10,8 @@
|
||||
@picker-panel-width: @picker-panel-cell-width * 7 + @padding-sm * 2 + 4;
|
||||
|
||||
&-panel {
|
||||
display: inline-block;
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
background: @calendar-bg;
|
||||
border: @border-width-base @border-style-base @picker-border-color;
|
||||
@ -400,6 +401,8 @@
|
||||
|
||||
// ======================== Footer ========================
|
||||
&-footer {
|
||||
width: min-content;
|
||||
min-width: 100%;
|
||||
line-height: @picker-text-height - 2 * @border-width-base;
|
||||
text-align: center;
|
||||
border-bottom: @border-width-base @border-style-base transparent;
|
||||
|
@ -3,7 +3,7 @@ import MockDate from 'mockdate';
|
||||
import { mount } from 'enzyme';
|
||||
import Descriptions from '..';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
import { resetWarned } from '../../_util/devWarning';
|
||||
|
||||
describe('Descriptions', () => {
|
||||
mountTest(Descriptions);
|
||||
|
@ -7,7 +7,7 @@ import ResponsiveObserve, {
|
||||
ScreenMap,
|
||||
responsiveArray,
|
||||
} from '../_util/responsiveObserve';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import Row from './Row';
|
||||
import DescriptionsItem from './Item';
|
||||
@ -49,7 +49,7 @@ function getFilledItem(
|
||||
clone = React.cloneElement(node, {
|
||||
span: rowRestCol,
|
||||
});
|
||||
warning(
|
||||
devWarning(
|
||||
span === undefined,
|
||||
'Descriptions',
|
||||
'Sum of column `span` in a line not match `column` of Descriptions.',
|
||||
|
@ -46,7 +46,7 @@ ReactDOM.render(
|
||||
<Dropdown.Button onClick={handleButtonClick} overlay={menu}>
|
||||
Dropdown
|
||||
</Dropdown.Button>
|
||||
<Dropdown.Button overlay={menu} icon={<UserOutlined />}>
|
||||
<Dropdown.Button overlay={menu} placement="bottomCenter" icon={<UserOutlined />}>
|
||||
Dropdown
|
||||
</Dropdown.Button>
|
||||
<Dropdown.Button onClick={handleButtonClick} overlay={menu} disabled>
|
||||
|
@ -28,7 +28,6 @@ export default class DropdownButton extends React.Component<DropdownButtonProps,
|
||||
static __ANT_BUTTON = true;
|
||||
|
||||
static defaultProps = {
|
||||
placement: 'bottomRight' as DropDownProps['placement'],
|
||||
type: 'default' as DropdownButtonType,
|
||||
buttonsRender: (buttons: React.ReactNode[]) => buttons,
|
||||
};
|
||||
@ -36,6 +35,7 @@ export default class DropdownButton extends React.Component<DropdownButtonProps,
|
||||
renderButton = ({
|
||||
getPopupContainer: getContextPopupContainer,
|
||||
getPrefixCls,
|
||||
direction,
|
||||
}: ConfigConsumerProps) => {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
@ -66,7 +66,6 @@ export default class DropdownButton extends React.Component<DropdownButtonProps,
|
||||
disabled,
|
||||
trigger: disabled ? [] : trigger,
|
||||
onVisibleChange,
|
||||
placement,
|
||||
getPopupContainer: getPopupContainer || getContextPopupContainer,
|
||||
} as DropDownProps;
|
||||
|
||||
@ -74,6 +73,12 @@ export default class DropdownButton extends React.Component<DropdownButtonProps,
|
||||
dropdownProps.visible = visible;
|
||||
}
|
||||
|
||||
if ('placement' in this.props) {
|
||||
dropdownProps.placement = placement;
|
||||
} else {
|
||||
dropdownProps.placement = direction === 'rtl' ? 'bottomLeft' : 'bottomRight';
|
||||
}
|
||||
|
||||
const leftButton = (
|
||||
<Button
|
||||
type={type}
|
||||
|
@ -5,7 +5,7 @@ import RightOutlined from '@ant-design/icons/RightOutlined';
|
||||
|
||||
import DropdownButton from './dropdown-button';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import { tuple } from '../_util/type';
|
||||
|
||||
const Placements = tuple(
|
||||
@ -88,7 +88,7 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
|
||||
const overlayProps = overlayNode.props;
|
||||
|
||||
// Warning if use other mode
|
||||
warning(
|
||||
devWarning(
|
||||
!overlayProps.mode || overlayProps.mode === 'vertical',
|
||||
'Dropdown',
|
||||
`mode="${overlayProps.mode}" is not supported for Dropdown's Menu.`,
|
||||
|
@ -8,7 +8,7 @@ import omit from 'omit.js';
|
||||
import Row from '../grid/row';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import { tuple } from '../_util/type';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import FormItemLabel, { FormItemLabelProps } from './FormItemLabel';
|
||||
import FormItemInput, { FormItemInputProps } from './FormItemInput';
|
||||
import { FormContext, FormItemContext } from './context';
|
||||
@ -51,7 +51,7 @@ export interface FormItemProps extends FormItemLabelProps, FormItemInputProps, R
|
||||
|
||||
function hasValidName(name?: NamePath): Boolean {
|
||||
if (name === null) {
|
||||
warning(false, 'Form.Item', '`null` is passed as `name` property');
|
||||
devWarning(false, 'Form.Item', '`null` is passed as `name` property');
|
||||
}
|
||||
return !(name === undefined || name === null);
|
||||
}
|
||||
@ -287,27 +287,27 @@ function FormItem(props: FormItemProps): React.ReactElement {
|
||||
|
||||
let childNode: React.ReactNode = null;
|
||||
if (Array.isArray(children) && hasName) {
|
||||
warning(false, 'Form.Item', '`children` is array of render props cannot have `name`.');
|
||||
devWarning(false, 'Form.Item', '`children` is array of render props cannot have `name`.');
|
||||
childNode = children;
|
||||
} else if (isRenderProps && (!shouldUpdate || hasName)) {
|
||||
warning(
|
||||
devWarning(
|
||||
!!shouldUpdate,
|
||||
'Form.Item',
|
||||
'`children` of render props only work with `shouldUpdate`.',
|
||||
);
|
||||
warning(
|
||||
devWarning(
|
||||
!hasName,
|
||||
'Form.Item',
|
||||
"Do not use `name` with `children` of render props since it's not a field.",
|
||||
);
|
||||
} else if (dependencies && !isRenderProps && !hasName) {
|
||||
warning(
|
||||
devWarning(
|
||||
false,
|
||||
'Form.Item',
|
||||
'Must set `name` or use render props when `dependencies` is set.',
|
||||
);
|
||||
} else if (React.isValidElement(children)) {
|
||||
warning(
|
||||
devWarning(
|
||||
children.props.defaultValue === undefined,
|
||||
'Form.Item',
|
||||
'`defaultValue` will not work on controlled Field. You should use `initialValues` of Form instead.',
|
||||
@ -336,7 +336,7 @@ function FormItem(props: FormItemProps): React.ReactElement {
|
||||
} else if (isRenderProps && shouldUpdate && !hasName) {
|
||||
childNode = (children as RenderChildren)(context);
|
||||
} else {
|
||||
warning(
|
||||
devWarning(
|
||||
!mergedName.length,
|
||||
'Form.Item',
|
||||
'`name` is only used for validate React element. If you are using Form.Item as layout display, please remove `name` instead.',
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { List } from 'rc-field-form';
|
||||
import { StoreValue } from 'rc-field-form/lib/interface';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
interface FieldData {
|
||||
name: number;
|
||||
@ -21,12 +21,15 @@ interface FormListProps {
|
||||
}
|
||||
|
||||
const FormList: React.FC<FormListProps> = ({ children, ...props }) => {
|
||||
warning(!!props.name, 'Form.List', 'Miss `name` prop.');
|
||||
devWarning(!!props.name, 'Form.List', 'Miss `name` prop.');
|
||||
|
||||
return (
|
||||
<List {...props}>
|
||||
{(fields, operation) => {
|
||||
return children(fields.map(field => ({ ...field, fieldKey: field.key })), operation);
|
||||
return children(
|
||||
fields.map(field => ({ ...field, fieldKey: field.key })),
|
||||
operation,
|
||||
);
|
||||
}}
|
||||
</List>
|
||||
);
|
||||
|
@ -3,7 +3,7 @@ import InternalForm, { useForm, FormInstance, FormProps } from './Form';
|
||||
import Item, { FormItemProps } from './FormItem';
|
||||
import List from './FormList';
|
||||
import { FormProvider } from './context';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
type InternalForm = typeof InternalForm;
|
||||
interface Form extends InternalForm {
|
||||
@ -23,7 +23,7 @@ Form.List = List;
|
||||
Form.useForm = useForm;
|
||||
Form.Provider = FormProvider;
|
||||
Form.create = () => {
|
||||
warning(
|
||||
devWarning(
|
||||
false,
|
||||
'Form',
|
||||
'antd v4 removed `Form.create`. Please remove or use `@ant-design/compatible` instead.',
|
||||
|
@ -1,7 +1,7 @@
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
const Icon = () => {
|
||||
warning(false, 'Icon', 'Empty Icon');
|
||||
devWarning(false, 'Icon', 'Empty Icon');
|
||||
return null;
|
||||
};
|
||||
|
||||
|
@ -9,7 +9,7 @@ import { Omit, LiteralUnion } from '../_util/type';
|
||||
import ClearableLabeledInput, { hasPrefixSuffix } from './ClearableLabeledInput';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import SizeContext, { SizeType } from '../config-provider/SizeContext';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
export interface InputProps
|
||||
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
|
||||
@ -153,7 +153,7 @@ class Input extends React.Component<InputProps, InputState> {
|
||||
|
||||
getSnapshotBeforeUpdate(prevProps: InputProps) {
|
||||
if (hasPrefixSuffix(prevProps) !== hasPrefixSuffix(this.props)) {
|
||||
warning(
|
||||
devWarning(
|
||||
this.input !== document.activeElement,
|
||||
'Input',
|
||||
`When Input is focused, dynamic add or remove prefix / suffix will make it lose focus caused by dom structure change. Read more: https://ant.design/components/input/#FAQ`,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { ValidateMessages } from 'rc-field-form/lib/interface';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
import { ModalLocale, changeConfirmLocale } from '../modal/locale';
|
||||
import { TransferLocale as TransferLocaleForEmpty } from '../empty';
|
||||
@ -51,7 +51,7 @@ export default class LocaleProvider extends React.Component<LocaleProviderProps,
|
||||
super(props);
|
||||
changeConfirmLocale(props.locale && props.locale.Modal);
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
props._ANT_MARK__ === ANT_MARK,
|
||||
'LocaleProvider',
|
||||
'`LocaleProvider` is deprecated. Please use `locale` with `ConfigProvider` instead: http://u.ant.design/locale',
|
||||
|
@ -12,7 +12,7 @@ import Layout from '../../layout';
|
||||
import Tooltip from '../../tooltip';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import rtlTest from '../../../tests/shared/rtlTest';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
import { resetWarned } from '../../_util/devWarning';
|
||||
|
||||
const { SubMenu } = Menu;
|
||||
|
||||
|
@ -5,7 +5,7 @@ import omit from 'omit.js';
|
||||
import SubMenu from './SubMenu';
|
||||
import Item from './MenuItem';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import { SiderContext, SiderContextProps } from '../layout/Sider';
|
||||
import raf from '../_util/raf';
|
||||
import collapseMotion from '../_util/motion';
|
||||
@ -120,13 +120,13 @@ class InternalMenu extends React.Component<InternalMenuProps, MenuState> {
|
||||
constructor(props: InternalMenuProps) {
|
||||
super(props);
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
!('inlineCollapsed' in props && props.mode !== 'inline'),
|
||||
'Menu',
|
||||
'`inlineCollapsed` should only be used when `mode` is inline.',
|
||||
);
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
!(props.siderCollapsed !== undefined && 'inlineCollapsed' in props),
|
||||
'Menu',
|
||||
'`inlineCollapsed` not control Menu under Sider. Should set `collapsed` on Sider instead.',
|
||||
@ -197,7 +197,7 @@ class InternalMenu extends React.Component<InternalMenuProps, MenuState> {
|
||||
}
|
||||
|
||||
if (openAnimation) {
|
||||
warning(
|
||||
devWarning(
|
||||
typeof openAnimation === 'string',
|
||||
'Menu',
|
||||
'`openAnimation` do not support object. Please use `motion` instead.',
|
||||
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import Dialog, { ModalFuncProps } from './Modal';
|
||||
import ActionButton from './ActionButton';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
interface ConfirmDialogProps extends ModalFuncProps {
|
||||
afterClose?: () => void;
|
||||
@ -29,7 +29,7 @@ const ConfirmDialog = (props: ConfirmDialogProps) => {
|
||||
cancelButtonProps,
|
||||
} = props;
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
!(typeof icon === 'string' && icon.length > 2),
|
||||
'Modal',
|
||||
`\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`,
|
||||
|
@ -252,6 +252,7 @@
|
||||
vertical-align: top;
|
||||
.@{pagination-prefix-cls}-item-link {
|
||||
height: @pagination-item-size-sm;
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
&::after {
|
||||
height: @pagination-item-size-sm;
|
||||
|
@ -32,6 +32,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
&-slash {
|
||||
.@{pagination-prefix-cls}-rtl & {
|
||||
margin: 0 5px 0 10px;
|
||||
}
|
||||
}
|
||||
|
||||
&-options {
|
||||
.@{pagination-prefix-cls}-rtl & {
|
||||
margin-right: 16px;
|
||||
|
@ -10,7 +10,7 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -52,7 +52,7 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -112,7 +112,7 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -177,7 +177,7 @@ exports[`renders ./components/progress/demo/circle-dynamic.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -282,7 +282,7 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
|
||||
style="width:80px;height:80px;font-size:18px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -324,7 +324,7 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
|
||||
style="width:80px;height:80px;font-size:18px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -384,7 +384,7 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
|
||||
style="width:80px;height:80px;font-size:18px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -449,7 +449,7 @@ exports[`renders ./components/progress/demo/dashboard.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -491,7 +491,7 @@ exports[`renders ./components/progress/demo/dashboard.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -623,7 +623,7 @@ exports[`renders ./components/progress/demo/format.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -665,7 +665,7 @@ exports[`renders ./components/progress/demo/format.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -756,67 +756,7 @@ exports[`renders ./components/progress/demo/gradient-line.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="ant-progress-gradient-11"
|
||||
x1="100%"
|
||||
x2="0%"
|
||||
y1="0%"
|
||||
y2="0%"
|
||||
>
|
||||
<stop
|
||||
offset="0%"
|
||||
stop-color="#108ee9"
|
||||
/>
|
||||
<stop
|
||||
offset="100%"
|
||||
stop-color="#87d068"
|
||||
/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path
|
||||
class="ant-progress-circle-trail"
|
||||
d="M 50,50 m 0,-47
|
||||
a 47,47 0 1 1 0,94
|
||||
a 47,47 0 1 1 0,-94"
|
||||
fill-opacity="0"
|
||||
stroke-linecap="round"
|
||||
stroke-width="6"
|
||||
style="stroke-dasharray:295.3097094374406px 295.3097094374406px;stroke-dashoffset:-0px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
|
||||
/>
|
||||
<path
|
||||
class="ant-progress-circle-path"
|
||||
d="M 50,50 m 0,-47
|
||||
a 47,47 0 1 1 0,94
|
||||
a 47,47 0 1 1 0,-94"
|
||||
fill-opacity="0"
|
||||
opacity="1"
|
||||
stroke="url(#ant-progress-gradient-11)"
|
||||
stroke-linecap="round"
|
||||
stroke-width="6"
|
||||
style="stroke:[object Object];stroke-dasharray:265.77873849369655px 295.3097094374406px;stroke-dashoffset:-0px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
|
||||
/>
|
||||
</svg>
|
||||
<span
|
||||
class="ant-progress-text"
|
||||
title="90%"
|
||||
>
|
||||
90%
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-progress ant-progress-circle ant-progress-status-success ant-progress-show-info ant-progress-default"
|
||||
>
|
||||
<div
|
||||
class="ant-progress-inner ant-progress-circle-gradient"
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<defs>
|
||||
@ -857,6 +797,66 @@ exports[`renders ./components/progress/demo/gradient-line.md correctly 1`] = `
|
||||
stroke="url(#ant-progress-gradient-12)"
|
||||
stroke-linecap="round"
|
||||
stroke-width="6"
|
||||
style="stroke:[object Object];stroke-dasharray:265.77873849369655px 295.3097094374406px;stroke-dashoffset:-0px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
|
||||
/>
|
||||
</svg>
|
||||
<span
|
||||
class="ant-progress-text"
|
||||
title="90%"
|
||||
>
|
||||
90%
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-progress ant-progress-circle ant-progress-status-success ant-progress-show-info ant-progress-default"
|
||||
>
|
||||
<div
|
||||
class="ant-progress-inner ant-progress-circle-gradient"
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="ant-progress-gradient-13"
|
||||
x1="100%"
|
||||
x2="0%"
|
||||
y1="0%"
|
||||
y2="0%"
|
||||
>
|
||||
<stop
|
||||
offset="0%"
|
||||
stop-color="#108ee9"
|
||||
/>
|
||||
<stop
|
||||
offset="100%"
|
||||
stop-color="#87d068"
|
||||
/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path
|
||||
class="ant-progress-circle-trail"
|
||||
d="M 50,50 m 0,-47
|
||||
a 47,47 0 1 1 0,94
|
||||
a 47,47 0 1 1 0,-94"
|
||||
fill-opacity="0"
|
||||
stroke-linecap="round"
|
||||
stroke-width="6"
|
||||
style="stroke-dasharray:295.3097094374406px 295.3097094374406px;stroke-dashoffset:-0px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
|
||||
/>
|
||||
<path
|
||||
class="ant-progress-circle-path"
|
||||
d="M 50,50 m 0,-47
|
||||
a 47,47 0 1 1 0,94
|
||||
a 47,47 0 1 1 0,-94"
|
||||
fill-opacity="0"
|
||||
opacity="1"
|
||||
stroke="url(#ant-progress-gradient-13)"
|
||||
stroke-linecap="round"
|
||||
stroke-width="6"
|
||||
style="stroke:[object Object];stroke-dasharray:295.3097094374406px 295.3097094374406px;stroke-dashoffset:-0px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
|
||||
/>
|
||||
</svg>
|
||||
@ -1197,7 +1197,7 @@ exports[`renders ./components/progress/demo/linecap.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -1239,7 +1239,7 @@ exports[`renders ./components/progress/demo/linecap.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -1312,7 +1312,7 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -1366,7 +1366,7 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
|
||||
style="width:120px;height:120px;font-size:24px"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
|
@ -9,7 +9,7 @@ exports[`Progress render dashboard 295 gapDegree 1`] = `
|
||||
style="width: 120px; height: 120px; font-size: 24px;"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -32,7 +32,7 @@ exports[`Progress render dashboard 295 gapDegree 1`] = `
|
||||
stroke=""
|
||||
stroke-linecap="round"
|
||||
stroke-width="6"
|
||||
style="stroke-dasharray: 0px 295.3097094374406px; stroke-dashoffset: -147.5px; transition: stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s;"
|
||||
style="stroke-dasharray: 0px 295.3097094374406px; stroke-dashoffset: -147.5px; transition: stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s; transition-duration: .3s, .3s, .3s, .06s;"
|
||||
/>
|
||||
</svg>
|
||||
<span
|
||||
@ -54,7 +54,7 @@ exports[`Progress render dashboard 296 gapDegree 1`] = `
|
||||
style="width: 120px; height: 120px; font-size: 24px;"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -77,7 +77,7 @@ exports[`Progress render dashboard 296 gapDegree 1`] = `
|
||||
stroke=""
|
||||
stroke-linecap="round"
|
||||
stroke-width="6"
|
||||
style="stroke-dasharray: 0px 295.3097094374406px; stroke-dashoffset: -148px; transition: stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s;"
|
||||
style="stroke-dasharray: 0px 295.3097094374406px; stroke-dashoffset: -148px; transition: stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s; transition-duration: .3s, .3s, .3s, .06s;"
|
||||
/>
|
||||
</svg>
|
||||
<span
|
||||
@ -99,7 +99,7 @@ exports[`Progress render dashboard zero gapDegree 1`] = `
|
||||
style="width: 120px; height: 120px; font-size: 24px;"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -122,7 +122,7 @@ exports[`Progress render dashboard zero gapDegree 1`] = `
|
||||
stroke=""
|
||||
stroke-linecap="round"
|
||||
stroke-width="6"
|
||||
style="stroke-dasharray: 0px 295.3097094374406px; stroke-dashoffset: -0px; transition: stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s;"
|
||||
style="stroke-dasharray: 0px 295.3097094374406px; stroke-dashoffset: -0px; transition: stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s; transition-duration: .3s, .3s, .3s, .06s;"
|
||||
/>
|
||||
</svg>
|
||||
<span
|
||||
@ -338,7 +338,7 @@ exports[`Progress render strokeColor 1`] = `
|
||||
style="width: 120px; height: 120px; font-size: 24px;"
|
||||
>
|
||||
<svg
|
||||
class="ant-progress-circle "
|
||||
class="ant-progress-circle"
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
<path
|
||||
@ -361,7 +361,7 @@ exports[`Progress render strokeColor 1`] = `
|
||||
stroke=""
|
||||
stroke-linecap="round"
|
||||
stroke-width="6"
|
||||
style="stroke: red; stroke-dasharray: 147.6548547187203px 295.3097094374406px; stroke-dashoffset: -0px; transition: stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s;"
|
||||
style="stroke: red; stroke-dasharray: 147.6548547187203px 295.3097094374406px; stroke-dashoffset: -0px; transition: stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s; transition-duration: .3s, .3s, .3s, .06s;"
|
||||
/>
|
||||
</svg>
|
||||
<span
|
||||
|
@ -6,7 +6,7 @@ import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled';
|
||||
import WarningFilled from '@ant-design/icons/WarningFilled';
|
||||
|
||||
import { ConfigConsumerProps, ConfigConsumer } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
import noFound from './noFound';
|
||||
import serverError from './serverError';
|
||||
@ -52,7 +52,7 @@ const ExceptionStatus = Object.keys(ExceptionMap);
|
||||
const renderIcon = (prefixCls: string, { status, icon }: ResultProps) => {
|
||||
const className = classnames(`${prefixCls}-icon`);
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
!(typeof icon === 'string' && icon.length > 2),
|
||||
'Result',
|
||||
`\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`,
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Switch from '..';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
import { resetWarned } from '../../_util/devWarning';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import rtlTest from '../../../tests/shared/rtlTest';
|
||||
|
||||
|
@ -7,7 +7,7 @@ import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
|
||||
import Wave from '../_util/wave';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import SizeContext from '../config-provider/SizeContext';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
export type SwitchSize = 'small' | 'default';
|
||||
export type SwitchChangeEventHandler = (checked: boolean, event: MouseEvent) => void;
|
||||
@ -36,7 +36,7 @@ interface CompoundedComponent
|
||||
}
|
||||
|
||||
const Switch = React.forwardRef<unknown, SwitchProps>((props, ref) => {
|
||||
warning(
|
||||
devWarning(
|
||||
'checked' in props || !('value' in props),
|
||||
'Switch',
|
||||
'`value` is not a valid prop, do you mean `checked`?',
|
||||
|
@ -103,8 +103,8 @@
|
||||
height: @switch-sm-height - 4px;
|
||||
}
|
||||
|
||||
&:active::before,
|
||||
&:active::after {
|
||||
&:not(.@{switch-prefix-cls}-loading):active::before,
|
||||
&:not(.@{switch-prefix-cls}-loading):active::after {
|
||||
width: 16px;
|
||||
}
|
||||
}
|
||||
@ -119,6 +119,12 @@
|
||||
margin-right: 18px;
|
||||
margin-left: 3px;
|
||||
}
|
||||
&::after {
|
||||
left: @switch-sm-min-width - (@switch-sm-height - 2px);
|
||||
}
|
||||
&:not(.@{switch-prefix-cls}-disabled):active::after {
|
||||
left: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
&-small&-checked &-loading-icon {
|
||||
@ -141,9 +147,11 @@
|
||||
}
|
||||
|
||||
&::after {
|
||||
left: 100%;
|
||||
left: @switch-min-width - (@switch-height - 2px);
|
||||
margin-left: -1px;
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
&:not(.@{switch-prefix-cls}-disabled):active::after {
|
||||
left: @switch-min-width - (@switch-height + 4px);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ import defaultLocale from '../locale/en_US';
|
||||
import SizeContext, { SizeType } from '../config-provider/SizeContext';
|
||||
import Column from './Column';
|
||||
import ColumnGroup from './ColumnGroup';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import useBreakpoint from '../grid/hooks/useBreakpoint';
|
||||
|
||||
export { ColumnsType, TablePaginationConfig };
|
||||
@ -315,7 +315,7 @@ function Table<RecordType extends object = any>(props: TableProps<RecordType>) {
|
||||
// Dynamic table data
|
||||
if (mergedData.length < total!) {
|
||||
if (mergedData.length > pageSize) {
|
||||
warning(
|
||||
devWarning(
|
||||
false,
|
||||
'Table',
|
||||
'`dataSource` length is less than `pagination.total` but large than `pagination.pageSize`. Please make sure your config correct data with async mode.',
|
||||
|
@ -5,7 +5,7 @@ import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Table from '..';
|
||||
import scrollTo from '../../_util/scrollTo';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
import { resetWarned } from '../../_util/devWarning';
|
||||
|
||||
describe('Table.pagination', () => {
|
||||
const columns = [
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { mount, render } from 'enzyme';
|
||||
import Table from '..';
|
||||
import Checkbox from '../../checkbox';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
import { resetWarned } from '../../_util/devWarning';
|
||||
import ConfigProvider from '../../config-provider';
|
||||
|
||||
describe('Table.rowSelection', () => {
|
||||
|
@ -6,7 +6,7 @@ import Checkbox, { CheckboxProps } from '../../checkbox';
|
||||
import Dropdown from '../../dropdown';
|
||||
import Menu from '../../menu';
|
||||
import Radio from '../../radio';
|
||||
import warning from '../../_util/warning';
|
||||
import devWarning from '../../_util/devWarning';
|
||||
import {
|
||||
TableRowSelection,
|
||||
Key,
|
||||
@ -178,7 +178,7 @@ export default function useSelection<RecordType>(
|
||||
const keys = Array.from(keySet);
|
||||
setSelectedKeys(keys);
|
||||
if (onSelectInvert) {
|
||||
warning(
|
||||
devWarning(
|
||||
false,
|
||||
'Table',
|
||||
'`onSelectInvert` will be removed in future. Please use `onChange` instead.',
|
||||
@ -215,7 +215,7 @@ export default function useSelection<RecordType>(
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
('checked' in checkboxProps || 'defaultChecked' in checkboxProps)
|
||||
) {
|
||||
warning(
|
||||
devWarning(
|
||||
false,
|
||||
'Table',
|
||||
'Do not set `checked` or `defaultChecked` in `getCheckboxProps`. Please use `selectedRowKeys` instead.',
|
||||
|
@ -4,7 +4,7 @@ import moment from 'moment';
|
||||
import TimePicker from '..';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
import { resetWarned } from '../../_util/devWarning';
|
||||
import rtlTest from '../../../tests/shared/rtlTest';
|
||||
|
||||
describe('TimePicker', () => {
|
||||
|
@ -2,7 +2,7 @@ import { Moment } from 'moment';
|
||||
import * as React from 'react';
|
||||
import DatePicker from '../date-picker';
|
||||
import { PickerTimeProps, RangePickerTimeProps } from '../date-picker/generatePicker';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import { Omit } from '../_util/type';
|
||||
|
||||
const { TimePicker: InternalTimePicker, RangePicker: InternalRangePicker } = DatePicker;
|
||||
@ -30,7 +30,7 @@ const TimePicker = React.forwardRef<any, TimePickerProps>(
|
||||
return renderExtraFooter;
|
||||
}
|
||||
if (addon) {
|
||||
warning(
|
||||
devWarning(
|
||||
false,
|
||||
'TimePicker',
|
||||
'`addon` is deprecated. Please use `renderExtraFooter` instead.',
|
||||
|
@ -9,7 +9,7 @@ import RcTreeSelect, {
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import { AntTreeNodeProps } from '../tree';
|
||||
import getIcons from '../select/utils/iconUtil';
|
||||
import renderSwitcherIcon from '../tree/utils/iconUtil';
|
||||
@ -55,7 +55,7 @@ class TreeSelect<T> extends React.Component<TreeSelectProps<T>, {}> {
|
||||
constructor(props: TreeSelectProps<T>) {
|
||||
super(props);
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
props.multiple !== false || !props.treeCheckable,
|
||||
'TreeSelect',
|
||||
'`multiple` will alway be `true` when `treeCheckable` is true',
|
||||
|
@ -10,7 +10,7 @@ import CopyOutlined from '@ant-design/icons/CopyOutlined';
|
||||
import ResizeObserver from 'rc-resize-observer';
|
||||
import { ConfigConsumerProps, configConsumerProps, ConfigContext } from '../config-provider';
|
||||
import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import TransButton from '../_util/transButton';
|
||||
import raf from '../_util/raf';
|
||||
import isStyleSupport from '../_util/styleChecker';
|
||||
@ -112,7 +112,7 @@ class Base extends React.Component<InternalBlockProps, BaseState> {
|
||||
static getDerivedStateFromProps(nextProps: BlockProps) {
|
||||
const { children, editable } = nextProps;
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
!editable || typeof children === 'string',
|
||||
'Typography',
|
||||
'When `editable` is enabled, the `children` should use string.',
|
||||
@ -301,7 +301,7 @@ class Base extends React.Component<InternalBlockProps, BaseState> {
|
||||
// Do not measure if css already support ellipsis
|
||||
if (this.canUseCSSEllipsis()) return;
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
toArray(children).every((child: React.ReactNode) => typeof child === 'string'),
|
||||
'Typography',
|
||||
'`ellipsis` should use string as children only.',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import Base, { BlockProps } from './Base';
|
||||
|
||||
export interface TextProps extends BlockProps {
|
||||
@ -7,7 +7,7 @@ export interface TextProps extends BlockProps {
|
||||
}
|
||||
|
||||
const Text: React.FC<TextProps> = ({ ellipsis, ...restProps }) => {
|
||||
warning(
|
||||
devWarning(
|
||||
typeof ellipsis !== 'object',
|
||||
'Typography.Text',
|
||||
'`ellipsis` only supports boolean value.',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import warning from 'warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import Base, { BlockProps } from './Base';
|
||||
import { tupleNum, Omit } from '../_util/type';
|
||||
|
||||
@ -14,7 +14,7 @@ const Title: React.FC<TitleProps> = props => {
|
||||
if (TITLE_ELE_LIST.indexOf(level) !== -1) {
|
||||
component = `h${level}`;
|
||||
} else {
|
||||
warning(false, 'Title only accept `1 | 2 | 3 | 4` as `level` value.');
|
||||
devWarning(false, 'Typography.Title', 'Title only accept `1 | 2 | 3 | 4` as `level` value.');
|
||||
component = 'h1';
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import { composeRef } from '../_util/ref';
|
||||
|
||||
export interface TypographyProps {
|
||||
@ -34,7 +34,7 @@ const Typography: React.RefForwardingComponent<{}, InternalTypographyProps> = (
|
||||
let mergedRef = ref;
|
||||
|
||||
if (setContentRef) {
|
||||
warning(false, 'Typography', '`setContentRef` is deprecated. Please use `ref` instead.');
|
||||
devWarning(false, 'Typography', '`setContentRef` is deprecated. Please use `ref` instead.');
|
||||
mergedRef = composeRef(ref, setContentRef);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ describe('Typography', () => {
|
||||
mount(<Title level={false} />);
|
||||
|
||||
expect(errorSpy).toHaveBeenCalledWith(
|
||||
'Warning: Title only accept `1 | 2 | 3 | 4` as `level` value.',
|
||||
'Warning: [antd: Typography.Title] Title only accept `1 | 2 | 3 | 4` as `level` value.',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ import { T, fileToObject, getFileItem, removeFileItem } from './utils';
|
||||
import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
||||
import defaultLocale from '../locale/default';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
export { UploadProps };
|
||||
|
||||
@ -61,7 +61,7 @@ class Upload extends React.Component<UploadProps, UploadState> {
|
||||
dragState: 'drop',
|
||||
};
|
||||
|
||||
warning(
|
||||
devWarning(
|
||||
'fileList' in props || !('value' in props),
|
||||
'Upload',
|
||||
'`value` is not a valid prop, do you mean `fileList`?',
|
||||
|
@ -5,7 +5,7 @@ import Upload from '..';
|
||||
import Form from '../../form';
|
||||
import { T, fileToObject, getFileItem, removeFileItem } from '../utils';
|
||||
import { setup, teardown } from './mock';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
import { resetWarned } from '../../_util/devWarning';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import rtlTest from '../../../tests/shared/rtlTest';
|
||||
|
||||
|
@ -44,7 +44,7 @@ title: Ant Design of React
|
||||
|
||||
- 稳定版:[![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd)
|
||||
|
||||
你可以订阅:https://github.com/ant-design/ant-design/releases.atom 来获得稳定版发布的通知。
|
||||
你可以订阅:https://github.com/ant-design/ant-design/releases.atom 或 https://app.releasly.co/sites/ant-design/ant-design 来获得版本发布的通知。
|
||||
|
||||
## 安装
|
||||
|
||||
@ -70,7 +70,7 @@ $ yarn add antd
|
||||
|
||||
> **强烈不推荐使用已构建文件**,这样无法按需加载,而且难以获得底层依赖模块的 bug 快速修复支持。
|
||||
|
||||
> 注意:antd.js 依赖 react/react-dom/moment,请确保提前引入这些文件。
|
||||
> 注意:`antd.js` 和 `antd.min.js` 依赖 `react/react-dom/moment`,请确保提前引入这些文件。
|
||||
|
||||
## 示例
|
||||
|
||||
@ -125,7 +125,7 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||
## 链接
|
||||
|
||||
- [首页](/)
|
||||
- [组件库](/components/button-cn/)
|
||||
- [组件库](/components/button)
|
||||
- [Ant Design Pro](https://pro.ant.design/)
|
||||
- [更新日志](/changelog)
|
||||
- [React 底层基础组件](http://react-component.github.io/)
|
||||
|
@ -128,7 +128,7 @@
|
||||
"rc-notification": "~4.3.0",
|
||||
"rc-pagination": "~2.2.0",
|
||||
"rc-picker": "~1.4.0",
|
||||
"rc-progress": "~2.5.0",
|
||||
"rc-progress": "~2.6.0",
|
||||
"rc-rate": "~2.6.0",
|
||||
"rc-resize-observer": "^0.2.0",
|
||||
"rc-select": "~10.3.0",
|
||||
@ -199,7 +199,7 @@
|
||||
"eslint-plugin-markdown": "^1.0.0",
|
||||
"eslint-plugin-react": "^7.14.2",
|
||||
"eslint-plugin-react-hooks": "^4.0.0",
|
||||
"eslint-plugin-unicorn": "^19.0.0",
|
||||
"eslint-plugin-unicorn": "^20.0.0",
|
||||
"eslint-tinker": "^0.5.0",
|
||||
"fetch-jsonp": "^1.1.3",
|
||||
"fs-extra": "^9.0.0",
|
||||
@ -257,6 +257,7 @@
|
||||
"rimraf": "^3.0.0",
|
||||
"scrollama": "^2.0.0",
|
||||
"simple-git": "^2.0.0",
|
||||
"string-replace-loader": "^2.3.0",
|
||||
"stylelint": "^13.0.0",
|
||||
"stylelint-config-prettier": "^8.0.0",
|
||||
"stylelint-config-rational-order": "^0.1.2",
|
||||
@ -264,7 +265,7 @@
|
||||
"stylelint-declaration-block-no-ignored-properties": "^2.1.0",
|
||||
"stylelint-order": "^4.0.0",
|
||||
"theme-switcher": "^1.0.2",
|
||||
"typescript": "~3.8.2",
|
||||
"typescript": "~3.9.2",
|
||||
"webpack-bundle-analyzer": "^3.6.0",
|
||||
"xhr-mock": "^2.4.1",
|
||||
"xhr2": "^0.2.0",
|
||||
|
@ -3,7 +3,7 @@ import React from 'react';
|
||||
import AntdIcon, { createFromIconfontCN } from '@ant-design/icons';
|
||||
|
||||
import { withThemeSuffix, removeTypeTheme, getThemeFromTypeName } from './utils';
|
||||
import warning from '../../../../components/_util/warning';
|
||||
import warning from '../../../../components/_util/devWarning';
|
||||
|
||||
const IconFont = createFromIconfontCN({
|
||||
scriptUrl: '//at.alicdn.com/t/font_1329669_t1u72b9zk8s.js',
|
||||
|
@ -1,4 +1,4 @@
|
||||
import warning from '../../../../components/_util/warning';
|
||||
import warning from '../../../../components/_util/devWarning';
|
||||
|
||||
// These props make sure that the SVG behaviours like general text.
|
||||
// Reference: https://blog.prototypr.io/align-svg-icons-to-text-and-say-goodbye-to-font-icons-d44b3d7b26b4
|
||||
@ -27,10 +27,7 @@ export function getThemeFromTypeName(type) {
|
||||
}
|
||||
|
||||
export function removeTypeTheme(type) {
|
||||
return type
|
||||
.replace(fillTester, '')
|
||||
.replace(outlineTester, '')
|
||||
.replace(twoToneTester, '');
|
||||
return type.replace(fillTester, '').replace(outlineTester, '').replace(twoToneTester, '');
|
||||
}
|
||||
|
||||
export function withThemeSuffix(type, theme) {
|
||||
|
@ -14,9 +14,17 @@ describe('antd dist files', () => {
|
||||
// https://github.com/ant-design/ant-design/issues/1970
|
||||
// https://github.com/ant-design/ant-design/issues/1804
|
||||
if (testDist) {
|
||||
it('should have antd.version', () => {
|
||||
it('antd.js should export version', () => {
|
||||
// eslint-disable-next-line global-require,import/no-unresolved
|
||||
const antd = require('../dist/antd');
|
||||
expect(antd).toBeTruthy();
|
||||
expect(antd.version).toBe(pkg.version);
|
||||
});
|
||||
|
||||
it('antd.min.js should export version', () => {
|
||||
// eslint-disable-next-line global-require,import/no-unresolved
|
||||
const antd = require('../dist/antd.min');
|
||||
expect(antd).toBeTruthy();
|
||||
expect(antd.version).toBe(pkg.version);
|
||||
});
|
||||
|
||||
|
@ -34,10 +34,29 @@ function externalMoment(config) {
|
||||
};
|
||||
}
|
||||
|
||||
function injectWarningCondition(config) {
|
||||
config.module.rules.forEach(rule => {
|
||||
// Remove devWarning if needed
|
||||
if (rule.test.test('test.tsx')) {
|
||||
rule.use = [
|
||||
...rule.use,
|
||||
{
|
||||
loader: 'string-replace-loader',
|
||||
options: {
|
||||
search: 'devWarning(',
|
||||
replace: "if (process.env.NODE_ENV !== 'production') devWarning(",
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function processWebpackThemeConfig(themeConfig, theme, vars) {
|
||||
themeConfig.forEach(config => {
|
||||
ignoreMomentLocale(config);
|
||||
externalMoment(config);
|
||||
injectWarningCondition(config);
|
||||
|
||||
// rename default entry to ${theme} entry
|
||||
Object.keys(config.entry).forEach(entryName => {
|
||||
@ -79,6 +98,7 @@ if (process.env.RUN_ENV === 'PRODUCTION') {
|
||||
if (process.env.ESBUILD) {
|
||||
config.optimization.minimizer[0] = new EsbuildPlugin();
|
||||
}
|
||||
|
||||
// skip codesandbox ci
|
||||
if (!process.env.CSB_REPO) {
|
||||
config.plugins.push(
|
||||
|
Loading…
Reference in New Issue
Block a user