Skip to content

Commit

Permalink
chore: Merge master branch and fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dengfuping committed Nov 11, 2019
2 parents e42caa5 + 9dcaad0 commit 8f52b80
Show file tree
Hide file tree
Showing 42 changed files with 239 additions and 108 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ timeline: true

---

## 3.25.1

`2019-11-10`

- 🐞 Fix less variables of `@menu-icon-size` and `@menu-icon-size-lg` not working. [#19553](https://github.com/ant-design/ant-design/pull/19553) [@yoyo837](https://github.com/yoyo837)
- 🐞 Fix DirectoryTree `defaultExpandedAll` not working with `treeData`. [#19646](https://github.com/ant-design/ant-design/pull/19646)
- 🐞 Fix Drawer content overflow when `placement` prop is top or bottom. [#19506](https://github.com/ant-design/ant-design/pull/19506) [@shaodahong](https://github.com/shaodahong)
- 🐞 Fix broken Menu.ItemGroup style inside Dropdown again. [#19578](https://github.com/ant-design/ant-design/pull/19578)
- 🐞 Fix Dropdown that menu icon `margin-right` style is missing. [#19635](https://github.com/ant-design/ant-design/pull/19635)
- 🐞 Fix Form.Item custom props not working. [#19599](https://github.com/ant-design/ant-design/pull/19599) [@yoyo837](https://github.com/yoyo837)
- 🐞 Fix Icon `extraCommonProps` not working properly. [#19572](https://github.com/ant-design/ant-design/pull/19572) [@yoyo837](https://github.com/yoyo837)
- 🐞 Fix Modal.method() scrollbar not disabled. [#19233](https://github.com/ant-design/ant-design/pull/19233) [@emersonlaurentino](https://github.com/emersonlaurentino)
- Table
- 🐞 Fix border missing in fixed columns. [#19559](https://github.com/ant-design/ant-design/pull/19559)
- 🐞 Fix Column with `sortOrder` throw error of inifinite loop. [#19558](https://github.com/ant-design/ant-design/pull/19558)
- 🐞 Fix Column `defaultSortOrder` not working. [#19558](https://github.com/ant-design/ant-design/pull/19558)
- TypeScript
- 🐞 Fix type definition of `ListStyle` for Transfer. [#19568](https://github.com/ant-design/ant-design/pull/19568) [@lxnxbnq](https://github.com/lxnxbnq)
- 🐞 Fix type definition of multiple props for RangePicker. [#19421](https://github.com/ant-design/ant-design/pull/19421) [@JennieJi](https://github.com/JennieJi)

## 3.25.0

`2019-11-04`
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ timeline: true

---

## 3.25.1

`2019-11-10`

- 🐞 修复定制 `@menu-icon-size``@menu-icon-size-lg` less 变量不生效的问题。[#19553](https://github.com/ant-design/ant-design/pull/19553) [@yoyo837](https://github.com/yoyo837)
- 🐞 修复 DirectoryTree 中 `defaultExpandedAll` 在使用 `treeData` 时不生效的问题。[#19646](https://github.com/ant-design/ant-design/pull/19646)
- 🐞 修复 Drawer 中 `placement` 属性为 top 或 bottom 时内容溢出的问题。[#19506](https://github.com/ant-design/ant-design/pull/19506) [@shaodahong](https://github.com/shaodahong)
- 🐞 修复 Dropdown 下 Menu.ItemGroup 样式错乱的问题。 [#19578](https://github.com/ant-design/ant-design/pull/19578)
- 🐞 修复 Dropdown 中菜单图标丢失右边距的问题。[#19635](https://github.com/ant-design/ant-design/pull/19635)
- 🐞 修复 Form.Item 中自定义属性无法生效的问题。[#19599](https://github.com/ant-design/ant-design/pull/19599) [@yoyo837](https://github.com/yoyo837)
- 🐞 修复 Icon 中 `extraCommonProps` 属性不生效的问题。 [#19572](https://github.com/ant-design/ant-design/pull/19572) [@yoyo837](https://github.com/yoyo837)
- 🐞 修复 Modal.method() 中浏览器滚动条没有禁用的问题。[#19233](https://github.com/ant-design/ant-design/pull/19233) [@emersonlaurentino](https://github.com/emersonlaurentino)
- Table
- 🐞 修复合并单元格和固定列同时使用时边框丢失的问题。[#19559](https://github.com/ant-design/ant-design/pull/19559)
- 🐞 修复 Column 设置了 `sortOrder` 属性导致死循环的问题。[#19558](https://github.com/ant-design/ant-design/pull/19558)
- 🐞 修复 Column 的 `defaultSortOrder` 属性不生效的问题。[#19558](https://github.com/ant-design/ant-design/pull/19558)
- TypeScript
- 🐞 修复 Transfer 中 `ListStyle` 的类型定义。[#19568](https://github.com/ant-design/ant-design/pull/19568) [@lxnxbnq](https://github.com/lxnxbnq)
- 🐞 修复 RangePicker 中多个属性的类型定义缺失的问题。[#19421](https://github.com/ant-design/ant-design/pull/19421) [@JennieJi](https://github.com/JennieJi)

## 3.25.0

`2019-11-04`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6791,7 +6791,6 @@ exports[`ConfigProvider components Drawer configProvider 1`] = `
>
<div
class="config-drawer-wrapper-body"
style="overflow:auto;height:100%"
>
<div
class="config-drawer-header-no-title"
Expand Down Expand Up @@ -6851,7 +6850,6 @@ exports[`ConfigProvider components Drawer normal 1`] = `
>
<div
class="ant-drawer-wrapper-body"
style="overflow:auto;height:100%"
>
<div
class="ant-drawer-header-no-title"
Expand Down Expand Up @@ -6911,7 +6909,6 @@ exports[`ConfigProvider components Drawer prefixCls 1`] = `
>
<div
class="prefix-Drawer-wrapper-body"
style="overflow:auto;height:100%"
>
<div
class="prefix-Drawer-header-no-title"
Expand Down
6 changes: 6 additions & 0 deletions components/config-provider/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ Some component use dynamic style to support wave effect. You can config `csp` pr
| locale | language package setting, you can find the packages in [antd/es/locale](http://unpkg.com/antd/es/locale/) | object | 3.21.0 |
| prefixCls | set prefix class | string | ant | 3.12.0 |
| pageHeader | Unify the ghost of pageHeader ,Ref [pageHeader](<(/components/page-header)> | { ghost:boolean } | 'true' | 3.24.0 |

## FAQ

#### Locale problem is still existed in DatePicker even ConfigProvider `locale` is used?

Please make sure you set moment locale by `moment.locale('zh-cn')`, or you don't have two moment of different version.
6 changes: 6 additions & 0 deletions components/config-provider/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@ return (
| locale | 语言包配置,语言包可到 [antd/es/locale](http://unpkg.com/antd/es/locale/) 目录下寻找 | object | - | 3.21.0 |
| prefixCls | 设置统一样式前缀 | string | ant | 3.12.0 |
| pageHeader | 统一设置 pageHeader 的 ghost,参考 [pageHeader](<(/components/page-header)>) | { ghost: boolean } | 'true' | 3.24.0 |

## FAQ

#### 为什么我使用了 ConfigProvider `locale`,时间类组件的国际化还有问题?

请检查是否设置了 `moment.locale('zh-cn')`,或者是否有两个版本的 moment 共存。
58 changes: 33 additions & 25 deletions components/date-picker/RangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Tag from '../tag';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import warning from '../_util/warning';
import interopDefault from '../_util/interopDefault';
import { RangePickerValue, RangePickerPresetRange } from './interface';
import { RangePickerValue, RangePickerPresetRange, RangePickerProps } from './interface';
import { formatDate } from './utils';
import InputIcon from './InputIcon';

Expand Down Expand Up @@ -54,7 +54,7 @@ function isEmptyArray(arr: any) {
return false;
}

function fixLocale(value: RangePickerValue | undefined, localeCode: string) {
function fixLocale(value: RangePickerValue | undefined, localeCode: string | undefined) {
if (!localeCode) {
return;
}
Expand All @@ -70,14 +70,14 @@ function fixLocale(value: RangePickerValue | undefined, localeCode: string) {
}
}

class RangePicker extends React.Component<any, RangePickerState> {
class RangePicker extends React.Component<RangePickerProps, RangePickerState> {
static defaultProps = {
allowClear: true,
showToday: false,
separator: '~',
};

static getDerivedStateFromProps(nextProps: any, prevState: any) {
static getDerivedStateFromProps(nextProps: RangePickerProps, prevState: RangePickerState) {
let state = null;
if ('value' in nextProps) {
const value = nextProps.value || [];
Expand Down Expand Up @@ -166,7 +166,9 @@ class RangePicker extends React.Component<any, RangePickerState> {
value[1] = undefined;
}
const [start, end] = value;
props.onChange(value, [formatDate(start, props.format), formatDate(end, props.format)]);
if (typeof props.onChange === 'function') {
props.onChange(value, [formatDate(start, props.format), formatDate(end, props.format)]);
}
};

handleOpenChange = (open: boolean) => {
Expand Down Expand Up @@ -241,21 +243,24 @@ class RangePicker extends React.Component<any, RangePickerState> {
{renderExtraFooter()}
</div>
) : null;
const operations = Object.keys(ranges || {}).map(range => {
const value = ranges[range];
return (
<Tag
key={range}
prefixCls={tagPrefixCls}
color="blue"
onClick={() => this.handleRangeClick(value)}
onMouseEnter={() => this.setState({ hoverValue: value })}
onMouseLeave={this.handleRangeMouseLeave}
>
{range}
</Tag>
);
});
const operations =
ranges &&
Object.keys(ranges).map(range => {
const value = ranges[range];
const hoverValue = typeof value === 'function' ? value.call(this) : value;
return (
<Tag
key={range}
prefixCls={tagPrefixCls}
color="blue"
onClick={() => this.handleRangeClick(value)}
onMouseEnter={() => this.setState({ hoverValue })}
onMouseLeave={this.handleRangeMouseLeave}
>
{range}
</Tag>
);
});
const rangeNode =
operations && operations.length > 0 ? (
<div className={`${prefixCls}-footer-extra ${prefixCls}-range-quick-selector`} key="range">
Expand All @@ -280,6 +285,7 @@ class RangePicker extends React.Component<any, RangePickerState> {
ranges,
onOk,
locale,
// @ts-ignore
localeCode,
format,
dateRender,
Expand Down Expand Up @@ -326,10 +332,12 @@ class RangePicker extends React.Component<any, RangePickerState> {
calendarProps.mode = props.mode;
}

const startPlaceholder =
'placeholder' in props ? props.placeholder[0] : locale.lang.rangePlaceholder[0];
const endPlaceholder =
'placeholder' in props ? props.placeholder[1] : locale.lang.rangePlaceholder[1];
const startPlaceholder = Array.isArray(props.placeholder)
? props.placeholder[0]
: locale.lang.rangePlaceholder[0];
const endPlaceholder = Array.isArray(props.placeholder)
? props.placeholder[1]
: locale.lang.rangePlaceholder[1];

const calendar = (
<RangeCalendar
Expand Down Expand Up @@ -405,7 +413,7 @@ class RangePicker extends React.Component<any, RangePickerState> {
return (
<span
ref={this.savePicker}
id={props.id}
id={typeof props.id === 'number' ? props.id.toString() : props.id}
className={classNames(props.className, props.pickerClass)}
style={{ ...style, ...pickerStyle }}
tabIndex={props.disabled ? -1 : 0}
Expand Down
12 changes: 10 additions & 2 deletions components/date-picker/interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export interface PickerProps {
disabled?: boolean;
allowClear?: boolean;
className?: string;
pickerClass?: string;
pickerInputClass?: string;
suffixIcon?: React.ReactNode;
style?: React.CSSProperties;
popupStyle?: React.CSSProperties;
Expand All @@ -24,6 +26,8 @@ export interface PickerProps {
disabledDate?: (current: moment.Moment | undefined) => boolean;
dateRender?: (current: moment.Moment, today: moment.Moment) => React.ReactNode;
autoFocus?: boolean;
onFocus?: React.FocusEventHandler;
onBlur?: (e: React.SyntheticEvent) => void;
}

export interface SinglePickerProps {
Expand All @@ -36,7 +40,7 @@ export interface SinglePickerProps {
}

const DatePickerModes = tuple('time', 'date', 'month', 'year', 'decade');
export type DatePickerMode = (typeof DatePickerModes)[number];
export type DatePickerMode = typeof DatePickerModes[number];

export interface DatePickerProps extends PickerProps, SinglePickerProps {
showTime?: TimePickerProps | boolean;
Expand All @@ -56,7 +60,7 @@ export interface DatePickerProps extends PickerProps, SinglePickerProps {
}

export interface MonthPickerProps extends PickerProps, SinglePickerProps {
monthCellContentRender?: (date: moment.Moment, locale: any) => React.ReactNode
monthCellContentRender?: (date: moment.Moment, locale: any) => React.ReactNode;
}

export type RangePickerValue =
Expand All @@ -69,9 +73,11 @@ export type RangePickerPresetRange = RangePickerValue | (() => RangePickerValue)

export interface RangePickerProps extends PickerProps {
className?: string;
tagPrefixCls?: string;
value?: RangePickerValue;
defaultValue?: RangePickerValue;
defaultPickerValue?: RangePickerValue;
timePicker?: React.ReactNode;
onChange?: (dates: RangePickerValue, dateStrings: [string, string]) => void;
onCalendarChange?: (dates: RangePickerValue, dateStrings: [string, string]) => void;
onOk?: (selectedTime: RangePickerPresetRange) => void;
Expand All @@ -93,6 +99,8 @@ export interface RangePickerProps extends PickerProps {
};
onPanelChange?: (value?: RangePickerValue, mode?: string | string[]) => void;
renderExtraFooter?: () => React.ReactNode;
onMouseEnter?: (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
onMouseLeave?: (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
}

export interface WeekPickerProps extends PickerProps, SinglePickerProps {
Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as moment from 'moment';
// eslint-disable-next-line import/prefer-default-export
export function formatDate(
value: moment.Moment | undefined | null,
format: string | string[],
format: string | string[] | undefined,
): string {
if (!value) {
return '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ exports[`renders ./components/descriptions/demo/border.md correctly 1`] = `
<br />
Storage space: 10 GB
<br />
Replication_factor:3
Replication factor: 3
<br />
Region: East China 1
<br />
Expand Down Expand Up @@ -384,7 +384,7 @@ exports[`renders ./components/descriptions/demo/responsive.md correctly 1`] = `
<br />
Storage space: 10 GB
<br />
Replication_factor:3
Replication factor: 3
<br />
Region: East China 1
</td>
Expand Down Expand Up @@ -569,7 +569,7 @@ exports[`renders ./components/descriptions/demo/size.md correctly 1`] = `
<br />
Storage space: 10 GB
<br />
Replication_factor:3
Replication factor: 3
<br />
Region: East China 1
<br />
Expand Down Expand Up @@ -1025,7 +1025,7 @@ exports[`renders ./components/descriptions/demo/vertical-border.md correctly 1`]
<br />
Storage space: 10 GB
<br />
Replication_factor:3
Replication factor: 3
<br />
Region: East China 1
<br />
Expand Down
2 changes: 1 addition & 1 deletion components/descriptions/demo/border.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ReactDOM.render(
<br />
Storage space: 10 GB
<br />
Replication_factor:3
Replication factor: 3
<br />
Region: East China 1<br />
</Descriptions.Item>
Expand Down
2 changes: 1 addition & 1 deletion components/descriptions/demo/responsive.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const Demo = () => {
<br />
Storage space: 10 GB
<br />
Replication_factor:3
Replication factor: 3
<br />
Region: East China 1
</Descriptions.Item>
Expand Down
2 changes: 1 addition & 1 deletion components/descriptions/demo/size.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Demo extends React.Component {
<br />
Storage space: 10 GB
<br />
Replication_factor:3
Replication factor: 3
<br />
Region: East China 1<br />
</Descriptions.Item>
Expand Down
2 changes: 1 addition & 1 deletion components/descriptions/demo/vertical-border.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ReactDOM.render(
<br />
Storage space: 10 GB
<br />
Replication_factor:3
Replication factor: 3
<br />
Region: East China 1<br />
</Descriptions.Item>
Expand Down
Loading

0 comments on commit 8f52b80

Please sign in to comment.