mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
merge master
This commit is contained in:
parent
cbed63cb3e
commit
daca08b6f1
@ -15,6 +15,41 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 3.11.2
|
||||
|
||||
`2018-12-10`
|
||||
|
||||
- 🐞 Fixed Table `Cannot read property 'children' of undefined` error when customize `column.title` as ReactNode. [#13542](https://github.com/ant-design/ant-design/issues/13542) [@geraldchen890806](https://github.com/geraldchen890806)
|
||||
- 🐞 Fixed another border problem of Button when customized less variable `@border-width-base`. [#13534](https://github.com/ant-design/ant-design/issues/13534) [@morenyang](https://github.com/morenyang)
|
||||
- 🐞 Fixed Upload don't support resolve `Blob` object when `beforeUpload` returns a Promise. [#13528](https://github.com/ant-design/ant-design/pull/13528/) [@huanz](https://github.com/huanz)
|
||||
- https://github.com/ant-design/ant-design/pull/13536
|
||||
- 🐞 Fixed two props of Dropdown TypeScript definitions. [#13536](https://github.com/ant-design/ant-design/pull/13536) [@wangxingkang](https://github.com/wangxingkang)
|
||||
|
||||
## 3.11.1
|
||||
|
||||
`2018-12-08`
|
||||
|
||||
- 🐞 Fixed the issue where the Avatar icon could not be centered vertically. [#13408](https://github.com/ant-design/ant-design/issues/13408)
|
||||
- 🐞 Fixed the border problem of Button when customized less variable `@border-width-base`. [#13413](https://github.com/ant-design/ant-design/issues/13413) [@morenyang](https://github.com/morenyang)
|
||||
- 🐞 Fixed Commnet does not correctly display line breaks. [#13429](https://github.com/ant-design/ant-design/issues/13429)
|
||||
- 🐞 Fixed the issue that when the Alert is in `closable`, the icon will be covered by the text. [#13440](https://github.com/ant-design/ant-design/issues/13440)
|
||||
- Button
|
||||
- 🐞 Fixed the issue that when the `href` property is `undefined`, the Button will also be rendered as a anchor. [#13337](https://github.com/ant-design/ant-design/issues/13337)
|
||||
- 🐞 Fixed the issue that Edge throws an error when setting the `loading` property. [#13216](https://github.com/ant-design/ant-design/issues/13216)
|
||||
- Dropdown
|
||||
- 🐞 Fixed the issue that causes the icon in the Button to display smaller. [#13442](https://github.com/ant-design/ant-design/issues/13442)
|
||||
- 🐞 Fixed the gap between the drop-down menu and the trigger element causes the drop-down menu to close. [#10481](https://github.com/ant-design/ant-design/issues/10481)
|
||||
- Table
|
||||
- 🐞 Fixed the use of filter causes an inconsistency between `selectedRowKeys` and `selectedRows` in `onChange`. [#11384](https://github.com/ant-design/ant-design/issues/11384)
|
||||
- 💄 Optimize the display of the title when the mouse hovers over the sortable header. [#13312](https://github.com/ant-design/ant-design/issues/13312)
|
||||
- DatePicker
|
||||
- 🐞 Fixed the issue where the component lost focus after selecting the date. [#12475](https://github.com/ant-design/ant-design/issues/12475)
|
||||
- 🐞 Fixed the issue that cause Safari to unresponsive. [#13424](https://github.com/ant-design/ant-design/issues/13424)
|
||||
- 🐞 Fixed the issue where WeekPicker's date selection box was not aligned with the input box.
|
||||
- 🐞 Fixed the blur method of the Slider. [#13439](https://github.com/ant-design/ant-design/issues/13439)
|
||||
- 🐞 Fixed Cascader's i18n issues. [#13486](https://github.com/ant-design/ant-design/issues/13486)
|
||||
- 🐞 Fix some TypeScript definitions. [#13390](https://github.com/ant-design/ant-design/pull/13390) [#13488](https://github.com/ant-design/ant-design/pull/13488) [#13420](https://github.com/ant-design/ant-design/issues/13420)
|
||||
|
||||
## 3.11.0
|
||||
|
||||
`2018-12-02`
|
||||
@ -1076,12 +1111,15 @@ Learn more in the [Ant Design 3.0 announcement post](https://medium.com/ant-desi
|
||||
- New [Divider](https://ant.design/components/divider/) component.
|
||||
- 30 New [icons](https://ant.design/components/icon/).
|
||||
|
||||
### ⚠️ Read it before migration
|
||||
|
||||
- We suggest you upgrade to latest 3.x version directly.
|
||||
- Some APIs may be deprecated in other 3.x versions which don't described below, please pay attention to warning in browser console and upgrade them.
|
||||
- We strongly suggest upgrade react to 16 or newest for better support and performance, which could be conduct via [React 16 upgrading](https://reactjs.org/blog/2017/09/26/react-v16.0.html#upgrading).
|
||||
- Then you can migrate to antd@3 by following `Breaking Changes` section.
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
> We suggest you upgrade to latest 3.x version directly.
|
||||
|
||||
> Some APIs may be deprecated in other 3.x versions which don't described below, please pay attention to warning in browser console and upgrade them.
|
||||
|
||||
We provide a [migration tool](https://github.com/ant-design/antd-migration-helper) to help you find deprecated usages in your codebase.
|
||||
|
||||
- Card's `noHovering` has been renamed to `hoverable`, and its default value now is `true`.
|
||||
|
@ -15,6 +15,41 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 3.11.2
|
||||
|
||||
`2018-12-10`
|
||||
|
||||
- 🐞 修复 Table 使用自定义列头时报 `Cannot read property 'children' of undefined` 的问题。[#13542](https://github.com/ant-design/ant-design/issues/13542) [@geraldchen890806](https://github.com/geraldchen890806)
|
||||
- 🐞 修复另一个 Input 在自定义了 less 变量 `@border-width-base` 时的边框问题。[#13534](https://github.com/ant-design/ant-design/pull/13534) [@morenyang](https://github.com/morenyang)
|
||||
- 🐞 修复 Upload 的 `beforeUpload` 方法返回 Promise 时不支持 resolve `Blob` 对象的问题。[#13528](https://github.com/ant-design/ant-design/pull/13528/) [@huanz](https://github.com/huanz)
|
||||
- https://github.com/ant-design/ant-design/pull/13536
|
||||
- 🐞 修复 Dropdown 两个属性的 TypeScript 定义。[#13536](https://github.com/ant-design/ant-design/pull/13536) [@wangxingkang](https://github.com/wangxingkang)
|
||||
|
||||
## 3.11.1
|
||||
|
||||
`2018-12-08`
|
||||
|
||||
- 🐞 修复 Avatar 图标不能垂直居中的问题。[#13408](https://github.com/ant-design/ant-design/issues/13408)
|
||||
- 🐞 修复 Input 在自定义了 less 变量 `@border-width-base` 时的边框问题。[#13413](https://github.com/ant-design/ant-design/issues/13413) [@morenyang](https://github.com/morenyang)
|
||||
- 🐞 修复 Commnet 组件不能正确显示换行的问题。[#13429](https://github.com/ant-design/ant-design/issues/13429)
|
||||
- 🐞 修复 Alert 在 `closable` 时,关闭图标会被文字遮挡的问题。[#13440](https://github.com/ant-design/ant-design/issues/13440)
|
||||
- Button
|
||||
- 🐞 修复 `href` 属性为 `undefined` 时,Button 也会被渲染为 a 标签的问题。[#13337](https://github.com/ant-design/ant-design/issues/13337)
|
||||
- 🐞 修复设置 `loading` 属性时在 Edge 下会报错的问题。[#13216](https://github.com/ant-design/ant-design/issues/13216)
|
||||
- Dropdown
|
||||
- 🐞 修复会导致 Button 中的图标显示变小的问题。[#13442](https://github.com/ant-design/ant-design/issues/13442)
|
||||
- 🐞 修复下拉菜单跟触发元素之间的孔隙会导致下拉菜单关闭的问题。[#10481](https://github.com/ant-design/ant-design/issues/10481)
|
||||
- Table
|
||||
- 🐞 修复使用 filter 会导致 `onChange` 中 `selectedRowKeys` 和 `selectedRows` 不一致的问题。[#11384](https://github.com/ant-design/ant-design/issues/11384)
|
||||
- 💄 优化鼠标悬停在可排序的表头上时 title 的显示。[#13312](https://github.com/ant-design/ant-design/issues/13312)
|
||||
- DatePicker
|
||||
- 🐞 修复选择日期后,组件会失去焦点的问题。[#12475](https://github.com/ant-design/ant-design/issues/12475)
|
||||
- 🐞 修复会导致 Safari 假死的问题。[#13424](https://github.com/ant-design/ant-design/issues/13424)
|
||||
- 🐞 修复 WeekPicker 的日期选择框跟输入框不对齐的问题。
|
||||
- 🐞 修复 Slider 的 blur 方法。[#13439](https://github.com/ant-design/ant-design/issues/13439)
|
||||
- 🐞 修复 Cascader 的国际化问题。[#13486](https://github.com/ant-design/ant-design/issues/13486)
|
||||
- 🐞 修复一些组件 TypeScript 定义。[#13390](https://github.com/ant-design/ant-design/pull/13390) [#13488](https://github.com/ant-design/ant-design/pull/13488) [#13420](https://github.com/ant-design/ant-design/issues/13420)
|
||||
|
||||
## 3.11.0
|
||||
|
||||
`2018-12-02`
|
||||
@ -1079,12 +1114,15 @@ timeline: true
|
||||
- 新的 [Divider](https://ant.design/components/divider-cn/) 组件。
|
||||
- 新增 30 个[图标](https://ant.design/components/icon-cn/)。
|
||||
|
||||
### ⚠️ 升级必读
|
||||
|
||||
- 如果你从 2.x 升级到 3.x,建议直接升级到 3.x 的最新版本。
|
||||
- 3.x 后续的版本可能已经废弃了一些下面没有提到的改动,请参考控制台的警告提示相应升级。
|
||||
- 建议同时升级 React 到 16 或更新版本,以获得更好的性能和更完善的支持,升级方式见 [官方发布文档](https://reactjs.org/blog/2017/09/26/react-v16.0.html#upgrading)。
|
||||
- 最后请参照下面的不兼容改动进行升级。
|
||||
|
||||
### 不兼容改动
|
||||
|
||||
> 如果你从 2.x 升级到 3.x,建议直接升级到 3.x 的最新版本。
|
||||
|
||||
> 3.x 后续的版本可能已经废弃了一些下面没有提到的改动,请参考控制台的警告提示相应升级。
|
||||
|
||||
此版本有部分不兼容的改动,升级时确保修改相应的使用代码。另外由于人肉查找代码中的废弃用法过于低效,所以我们提供了 [antd-migration-helper](https://github.com/ant-design/antd-migration-helper) 用于扫描代码中的废弃用法。
|
||||
|
||||
- Card 的 `noHovering` 属性重命名为 `hoverable`,且默认值改为 `true`。
|
||||
|
@ -109,6 +109,8 @@ $ npm start
|
||||
|
||||
> 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)、[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545) 和 [《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html)、[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。
|
||||
|
||||
[![Let's fund issues in this repository](https://issuehunt.io/static/embed/issuehunt-button-v1.svg)](https://issuehunt.io/repos/34526884)
|
||||
|
||||
## 社区互助
|
||||
|
||||
如果您在使用的过程中碰到问题,可以通过下面几个途径寻求帮助,同时我们也鼓励资深用户通过下面的途径给新人提供帮助。
|
||||
|
@ -107,3 +107,5 @@ Open your browser and visit http://127.0.0.1:8001 , see more at [Development](ht
|
||||
Read our [contributing guide](https://ant.design/docs/react/contributing) and let's build a better antd together.
|
||||
|
||||
We welcome all contributions. Please read our [CONTRIBUTING.md](https://github.com/ant-design/ant-design/blob/master/.github/CONTRIBUTING.md) first. You can submit any ideas as [pull requests](https://github.com/ant-design/ant-design/pulls) or as [GitHub issues](https://github.com/ant-design/ant-design/issues). If you'd like to improve code, check out the [Development Instructions](https://github.com/ant-design/ant-design/wiki/Development) and have a good time! :)
|
||||
|
||||
[![Let's fund issues in this repository](https://issuehunt.io/static/embed/issuehunt-button-v1.svg)](https://issuehunt.io/repos/34526884)
|
||||
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import { Option, OptGroup } from 'rc-select';
|
||||
import classNames from 'classnames';
|
||||
import InputElement from './InputElement';
|
||||
import Input from '../input';
|
||||
import Input, { InputProps } from '../input';
|
||||
import Select, { AbstractSelectProps, SelectValue, OptionProps, OptGroupProps } from '../select';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
|
||||
@ -39,6 +39,7 @@ export interface AutoCompleteProps extends AbstractSelectProps {
|
||||
onFocus?: () => void;
|
||||
children?:
|
||||
| ValidInputElement
|
||||
| React.ReactElement<InputProps>
|
||||
| React.ReactElement<OptionProps>
|
||||
| Array<React.ReactElement<OptionProps>>;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import KeyCode from 'rc-util/lib/KeyCode';
|
||||
import Input from '../input';
|
||||
import Icon from '../icon';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
||||
import warning from '../_util/warning';
|
||||
|
||||
export interface CascaderOptionType {
|
||||
@ -14,7 +15,6 @@ export interface CascaderOptionType {
|
||||
label?: React.ReactNode;
|
||||
disabled?: boolean;
|
||||
children?: Array<CascaderOptionType>;
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
@ -105,6 +105,10 @@ export interface CascaderState {
|
||||
flattenOptions: CascaderOptionType[][] | undefined;
|
||||
}
|
||||
|
||||
interface CascaderLocale {
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
// We limit the filtered item count by default
|
||||
const defaultLimit = 50;
|
||||
|
||||
@ -391,16 +395,16 @@ export default class Cascader extends React.Component<CascaderProps, CascaderSta
|
||||
this.input = node;
|
||||
};
|
||||
|
||||
renderCascader = ({
|
||||
getPopupContainer: getContextPopupContainer,
|
||||
getPrefixCls,
|
||||
}: ConfigConsumerProps) => {
|
||||
renderCascader = (
|
||||
{ getPopupContainer: getContextPopupContainer, getPrefixCls }: ConfigConsumerProps,
|
||||
locale: CascaderLocale,
|
||||
) => {
|
||||
const { props, state } = this;
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
inputPrefixCls: customizeInputPrefixCls,
|
||||
children,
|
||||
placeholder,
|
||||
placeholder = locale.placeholder,
|
||||
size,
|
||||
disabled,
|
||||
className,
|
||||
@ -410,6 +414,7 @@ export default class Cascader extends React.Component<CascaderProps, CascaderSta
|
||||
suffixIcon,
|
||||
...otherProps
|
||||
} = props;
|
||||
|
||||
const { value, inputFocused } = state;
|
||||
|
||||
const prefixCls = getPrefixCls('cascader', customizePrefixCls);
|
||||
@ -553,6 +558,12 @@ export default class Cascader extends React.Component<CascaderProps, CascaderSta
|
||||
};
|
||||
|
||||
render() {
|
||||
return <ConfigConsumer>{this.renderCascader}</ConfigConsumer>;
|
||||
return (
|
||||
<ConfigConsumer>
|
||||
{(configArgument: ConfigConsumerProps) => (
|
||||
<LocaleReceiver>{locale => this.renderCascader(configArgument, locale)}</LocaleReceiver>
|
||||
)}
|
||||
</ConfigConsumer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
261
components/drawer/__tests__/__snapshots__/demo.test.js.snap
Normal file
261
components/drawer/__tests__/__snapshots__/demo.test.js.snap
Normal file
@ -0,0 +1,261 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders ./components/drawer/demo/basic-right.md correctly 1`] = `
|
||||
<div>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Open
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/drawer/demo/form-in-drawer.md correctly 1`] = `
|
||||
<div>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary"
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
class="anticon anticon-plus"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class=""
|
||||
data-icon="plus"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M848 474H550V152h-76v322H176c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h298v322h76V550h298c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"
|
||||
/>
|
||||
</svg>
|
||||
</i>
|
||||
<span>
|
||||
New account
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/drawer/demo/multi-level-drawer.md correctly 1`] = `
|
||||
<div>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Open drawer
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/drawer/demo/placement.md correctly 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="ant-radio-group ant-radio-group-outline"
|
||||
style="margin-right:8px"
|
||||
>
|
||||
<label
|
||||
class="ant-radio-wrapper"
|
||||
>
|
||||
<span
|
||||
class="ant-radio"
|
||||
>
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="top"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
top
|
||||
</span>
|
||||
</label>
|
||||
<label
|
||||
class="ant-radio-wrapper"
|
||||
>
|
||||
<span
|
||||
class="ant-radio"
|
||||
>
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="right"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
right
|
||||
</span>
|
||||
</label>
|
||||
<label
|
||||
class="ant-radio-wrapper"
|
||||
>
|
||||
<span
|
||||
class="ant-radio"
|
||||
>
|
||||
<input
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="bottom"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
bottom
|
||||
</span>
|
||||
</label>
|
||||
<label
|
||||
class="ant-radio-wrapper ant-radio-wrapper-checked"
|
||||
>
|
||||
<span
|
||||
class="ant-radio ant-radio-checked"
|
||||
>
|
||||
<input
|
||||
checked=""
|
||||
class="ant-radio-input"
|
||||
type="radio"
|
||||
value="left"
|
||||
/>
|
||||
<span
|
||||
class="ant-radio-inner"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
left
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Open
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/drawer/demo/user-profile.md correctly 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="ant-list ant-list-split ant-list-bordered"
|
||||
>
|
||||
<div
|
||||
class="ant-spin-nested-loading"
|
||||
>
|
||||
<div
|
||||
class="ant-spin-container"
|
||||
>
|
||||
<div
|
||||
class="ant-list-item"
|
||||
>
|
||||
<div
|
||||
class="ant-list-item-meta"
|
||||
>
|
||||
<div
|
||||
class="ant-list-item-meta-avatar"
|
||||
>
|
||||
<span
|
||||
class="ant-avatar ant-avatar-circle ant-avatar-image"
|
||||
>
|
||||
<img
|
||||
src="https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ant-list-item-meta-content"
|
||||
>
|
||||
<h4
|
||||
class="ant-list-item-meta-title"
|
||||
>
|
||||
<a
|
||||
href="https://ant.design/index-cn"
|
||||
>
|
||||
Lily
|
||||
</a>
|
||||
</h4>
|
||||
<div
|
||||
class="ant-list-item-meta-description"
|
||||
>
|
||||
Progresser AFX
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul
|
||||
class="ant-list-item-action"
|
||||
>
|
||||
<li>
|
||||
<a>
|
||||
View Profile
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div
|
||||
class="ant-list-item"
|
||||
>
|
||||
<div
|
||||
class="ant-list-item-meta"
|
||||
>
|
||||
<div
|
||||
class="ant-list-item-meta-avatar"
|
||||
>
|
||||
<span
|
||||
class="ant-avatar ant-avatar-circle ant-avatar-image"
|
||||
>
|
||||
<img
|
||||
src="https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ant-list-item-meta-content"
|
||||
>
|
||||
<h4
|
||||
class="ant-list-item-meta-title"
|
||||
>
|
||||
<a
|
||||
href="https://ant.design/index-cn"
|
||||
>
|
||||
Lily
|
||||
</a>
|
||||
</h4>
|
||||
<div
|
||||
class="ant-list-item-meta-description"
|
||||
>
|
||||
Progresser AFX
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul
|
||||
class="ant-list-item-action"
|
||||
>
|
||||
<li>
|
||||
<a>
|
||||
View Profile
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
3
components/drawer/__tests__/demo.test.js
Normal file
3
components/drawer/__tests__/demo.test.js
Normal file
@ -0,0 +1,3 @@
|
||||
import demoTest from '../../../tests/shared/demoTest';
|
||||
|
||||
demoTest('drawer');
|
@ -1,21 +1,21 @@
|
||||
---
|
||||
order: 3
|
||||
title:
|
||||
zh-CN: 对象编辑
|
||||
en-US: Edit item in drawer
|
||||
zh-CN: 抽屉表单
|
||||
en-US: Submit form in drawer
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
用于承载编辑相关操作,需要点击关闭按钮关闭。
|
||||
在抽屉中使用表单。
|
||||
|
||||
## en-US
|
||||
|
||||
A drawer containing an editable form which needs to be collapsed by clicking the close button.
|
||||
Use form in drawer with submit button.
|
||||
|
||||
```jsx
|
||||
import {
|
||||
Drawer, Form, Button, Col, Row, Input, Select, DatePicker,
|
||||
Drawer, Form, Button, Col, Row, Input, Select, DatePicker, Icon,
|
||||
} from 'antd';
|
||||
|
||||
const { Option } = Select;
|
||||
@ -40,19 +40,17 @@ class DrawerForm extends React.Component {
|
||||
return (
|
||||
<div>
|
||||
<Button type="primary" onClick={this.showDrawer}>
|
||||
Create
|
||||
<Icon type="plus" /> New account
|
||||
</Button>
|
||||
<Drawer
|
||||
title="Create"
|
||||
title="Create a new account"
|
||||
width={720}
|
||||
placement="right"
|
||||
onClose={this.onClose}
|
||||
maskClosable={false}
|
||||
visible={this.state.visible}
|
||||
style={{
|
||||
height: 'calc(100% - 55px)',
|
||||
overflow: 'auto',
|
||||
paddingBottom: 53,
|
||||
height: 'calc(100% - 108px)',
|
||||
paddingBottom: '108px',
|
||||
}}
|
||||
>
|
||||
<Form layout="vertical" hideRequiredMark>
|
||||
@ -60,20 +58,20 @@ class DrawerForm extends React.Component {
|
||||
<Col span={12}>
|
||||
<Form.Item label="Name">
|
||||
{getFieldDecorator('name', {
|
||||
rules: [{ required: true, message: 'please enter user name' }],
|
||||
})(<Input placeholder="please enter user name" />)}
|
||||
rules: [{ required: true, message: 'Please enter user name' }],
|
||||
})(<Input placeholder="Please enter user name" />)}
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item label="Url">
|
||||
{getFieldDecorator('url', {
|
||||
rules: [{ required: true, message: 'please enter url' }],
|
||||
rules: [{ required: true, message: 'Please enter url' }],
|
||||
})(
|
||||
<Input
|
||||
style={{ width: '100%' }}
|
||||
addonBefore="http://"
|
||||
addonAfter=".com"
|
||||
placeholder="please enter url"
|
||||
placeholder="Please enter url"
|
||||
/>
|
||||
)}
|
||||
</Form.Item>
|
||||
@ -149,25 +147,21 @@ class DrawerForm extends React.Component {
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
width: '100%',
|
||||
borderTop: '1px solid #e8e8e8',
|
||||
borderTop: '1px solid #e9e9e9',
|
||||
padding: '10px 16px',
|
||||
textAlign: 'right',
|
||||
left: 0,
|
||||
background: '#fff',
|
||||
borderRadius: '0 0 4px 4px',
|
||||
textAlign: 'right',
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
style={{
|
||||
marginRight: 8,
|
||||
}}
|
||||
onClick={this.onClose}
|
||||
>
|
||||
<Button onClick={this.onClose} style={{ marginRight: 8 }}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button onClick={this.onClose} type="primary">Submit</Button>
|
||||
<Button onClick={this.onClose} type="primary">
|
||||
Submit
|
||||
</Button>
|
||||
</div>
|
||||
</Drawer>
|
||||
</div>
|
@ -21,7 +21,7 @@ A Drawer is a panel that is typically overlaid on top of a page and slides in fr
|
||||
| --- | --- | --- | --- |
|
||||
| closable | Whether a close (x) button is visible on top right of the Drawer dialog or not. | boolean | true |
|
||||
| destroyOnClose | Whether to unmount child components on closing drawer or not. | boolean | false |
|
||||
| getContainer | Return the mounted node for Drawer. | HTMLElement \| `() => HTMLElement` \| selectors | 'body' |
|
||||
| getContainer | Return the mounted node for Drawer. | HTMLElement \| `() => HTMLElement` \| Selectors | 'body' |
|
||||
| mask | Whether to show mask or not. | Boolean | true |
|
||||
| maskClosable | Clicking on the mask (area outside the Drawer) to close the Drawer or not. | boolean | true |
|
||||
| maskStyle | Style for Drawer's mask element. | object | {} |
|
||||
|
@ -20,7 +20,7 @@ title: Drawer
|
||||
| --- | --- | --- | --- |
|
||||
| closable | 是否显示右上角的关闭按钮 | boolean | true |
|
||||
| destroyOnClose | 关闭时销毁 Drawer 里的子元素 | boolean | false |
|
||||
| getContainer | 指定 Drawer 挂载的 HTML 节点 | HTMLElement \| `() => HTMLElement` \| selectors | 'body' |
|
||||
| getContainer | 指定 Drawer 挂载的 HTML 节点 | HTMLElement \| `() => HTMLElement` \| Selectors | 'body' |
|
||||
| maskClosable | 点击蒙层是否允许关闭 | boolean | true |
|
||||
| mask | 是否展示遮罩 | Boolean | true |
|
||||
| maskStyle | 遮罩样式 | object | {} |
|
||||
|
@ -18,6 +18,8 @@ export interface DropDownProps {
|
||||
className?: string;
|
||||
transitionName?: string;
|
||||
placement?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
|
||||
overlayClassName?: string;
|
||||
overlayStyle?: React.CSSProperties;
|
||||
forceRender?: boolean;
|
||||
mouseEnterDelay?: number;
|
||||
mouseLeaveDelay?: number;
|
||||
|
@ -304,7 +304,7 @@
|
||||
& > .@{ant-prefix}-mention-wrapper .@{ant-prefix}-mention-editor,
|
||||
& > .@{ant-prefix}-time-picker .@{ant-prefix}-time-picker-input {
|
||||
border-radius: 0;
|
||||
border-right-width: 1px;
|
||||
border-right-width: @border-width-base;
|
||||
border-right-color: transparent;
|
||||
&:hover {
|
||||
.hover();
|
||||
@ -335,7 +335,7 @@
|
||||
& > .@{ant-prefix}-time-picker:last-child .@{ant-prefix}-time-picker-input {
|
||||
border-top-right-radius: @border-radius-base;
|
||||
border-bottom-right-radius: @border-radius-base;
|
||||
border-right-width: 1px;
|
||||
border-right-width: @border-width-base;
|
||||
border-right-color: @input-border-color;
|
||||
&:hover {
|
||||
.hover();
|
||||
|
@ -1,17 +1,26 @@
|
||||
import * as React from 'react';
|
||||
import * as PropTypes from 'prop-types';
|
||||
import defaultLocaleData from './default';
|
||||
|
||||
export interface LocaleReceiverProps {
|
||||
componentName: string;
|
||||
defaultLocale: object | Function;
|
||||
componentName?: string;
|
||||
defaultLocale?: object | Function;
|
||||
children: (locale: object, localeCode?: string) => React.ReactElement<any>;
|
||||
}
|
||||
|
||||
interface LocaleInterface {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface LocaleReceiverContext {
|
||||
antLocale?: { [key: string]: any };
|
||||
antLocale?: LocaleInterface;
|
||||
}
|
||||
|
||||
export default class LocaleReceiver extends React.Component<LocaleReceiverProps> {
|
||||
static defaultProps = {
|
||||
componentName: 'global',
|
||||
};
|
||||
|
||||
static contextTypes = {
|
||||
antLocale: PropTypes.object,
|
||||
};
|
||||
@ -20,10 +29,12 @@ export default class LocaleReceiver extends React.Component<LocaleReceiverProps>
|
||||
|
||||
getLocale() {
|
||||
const { componentName, defaultLocale } = this.props;
|
||||
const locale: object | Function =
|
||||
defaultLocale || (defaultLocaleData as LocaleInterface)[componentName || 'global'];
|
||||
const { antLocale } = this.context;
|
||||
const localeFromContext = antLocale && antLocale[componentName];
|
||||
const localeFromContext = componentName && antLocale ? antLocale[componentName] : {};
|
||||
return {
|
||||
...(typeof defaultLocale === 'function' ? defaultLocale() : defaultLocale),
|
||||
...(typeof locale === 'function' ? locale() : locale),
|
||||
...(localeFromContext || {}),
|
||||
};
|
||||
}
|
||||
@ -33,7 +44,7 @@ export default class LocaleReceiver extends React.Component<LocaleReceiverProps>
|
||||
const localeCode = antLocale && antLocale.locale;
|
||||
// Had use LocaleProvide but didn't set locale
|
||||
if (antLocale && antLocale.exist && !localeCode) {
|
||||
return 'en-us';
|
||||
return defaultLocaleData.locale;
|
||||
}
|
||||
return localeCode;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,10 @@ export default {
|
||||
DatePicker,
|
||||
TimePicker,
|
||||
Calendar,
|
||||
// locales for all comoponents
|
||||
global: {
|
||||
placeholder: 'Please select',
|
||||
},
|
||||
Table: {
|
||||
filterTitle: 'Filter menu',
|
||||
filterConfirm: 'OK',
|
||||
|
@ -20,7 +20,7 @@ export interface Locale {
|
||||
|
||||
export interface LocaleProviderProps {
|
||||
locale: Locale;
|
||||
children?: React.ReactElement<any>;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
function setMomentLocale(locale: Locale) {
|
||||
|
@ -9,6 +9,10 @@ export default {
|
||||
DatePicker,
|
||||
TimePicker,
|
||||
Calendar,
|
||||
// locales for all comoponents
|
||||
global: {
|
||||
placeholder: '请选择',
|
||||
},
|
||||
Table: {
|
||||
filterTitle: '筛选',
|
||||
filterConfirm: '确定',
|
||||
|
@ -21,6 +21,7 @@ class MenuItem extends React.Component<MenuItemProps, any> {
|
||||
static isMenuItem = 1;
|
||||
context: any;
|
||||
private menuItem: any;
|
||||
|
||||
onKeyDown = (e: React.MouseEvent<HTMLElement>) => {
|
||||
this.menuItem.onKeyDown(e);
|
||||
};
|
||||
|
@ -11,6 +11,7 @@ class SubMenu extends React.Component<any, any> {
|
||||
static isSubMenu = 1;
|
||||
context: any;
|
||||
private subMenu: any;
|
||||
|
||||
onKeyDown = (e: React.MouseEvent<HTMLElement>) => {
|
||||
this.subMenu.onKeyDown(e);
|
||||
};
|
||||
|
@ -355,6 +355,55 @@ exports[`renders ./components/select/demo/custom-dropdown-menu.md correctly 1`]
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/select/demo/hide-selected.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-select ant-select-enabled"
|
||||
style="width:100%"
|
||||
>
|
||||
<div
|
||||
aria-autocomplete="list"
|
||||
aria-controls="test-uuid"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
class="ant-select-selection
|
||||
ant-select-selection--multiple"
|
||||
role="combobox"
|
||||
>
|
||||
<div
|
||||
class="ant-select-selection__rendered"
|
||||
>
|
||||
<div
|
||||
class="ant-select-selection__placeholder"
|
||||
style="display:block;user-select:none;-webkit-user-select:none"
|
||||
unselectable="on"
|
||||
>
|
||||
Inserted are removed
|
||||
</div>
|
||||
<ul>
|
||||
<li
|
||||
class="ant-select-search ant-select-search--inline"
|
||||
>
|
||||
<div
|
||||
class="ant-select-search__field__wrap"
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
class="ant-select-search__field"
|
||||
value=""
|
||||
/>
|
||||
<span
|
||||
class="ant-select-search__field__mirror"
|
||||
>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/select/demo/label-in-value.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-select ant-select-enabled"
|
||||
|
52
components/select/demo/hide-selected.md
Normal file
52
components/select/demo/hide-selected.md
Normal file
@ -0,0 +1,52 @@
|
||||
---
|
||||
order: 22
|
||||
title:
|
||||
zh-CN: 隐藏已选择选项
|
||||
en-US: Hide Already Selected
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
隐藏下拉列表中已选择的选项。
|
||||
|
||||
## en-US
|
||||
|
||||
Hide already selected options in the dropdown.
|
||||
|
||||
````jsx
|
||||
import { Select } from 'antd';
|
||||
|
||||
const OPTIONS = ['Apples', 'Nails', 'Bananas', 'Helicopters'];
|
||||
|
||||
class SelectWithHiddenSelectedOptions extends React.Component {
|
||||
state = {
|
||||
selectedItems: [],
|
||||
};
|
||||
|
||||
handleChange = selectedItems => {
|
||||
this.setState({ selectedItems });
|
||||
};
|
||||
|
||||
render() {
|
||||
const { selectedItems } = this.state;
|
||||
const filteredOptions = OPTIONS.filter(o => !selectedItems.includes(o));
|
||||
return (
|
||||
<Select
|
||||
mode="multiple"
|
||||
placeholder="Inserted are removed"
|
||||
value={selectedItems}
|
||||
onChange={this.handleChange}
|
||||
style={{ width: '100%' }}
|
||||
>
|
||||
{filteredOptions.map(item => (
|
||||
<Select.Option key={item} value={item}>
|
||||
{item}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(<SelectWithHiddenSelectedOptions />, mountNode);
|
||||
````
|
@ -27,6 +27,7 @@ The whole of the step bar.
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| className | additional class to Steps | string | - |
|
||||
| current | to set the current step, counting from 0. You can overwrite this state by using `status` of `Step` | number | 0 |
|
||||
| direction | to specify the direction of the step bar, `horizontal` or `vertical` | string | `horizontal` |
|
||||
| labelPlacement | place title and description with `horizontal` or `vertical` direction | string | `horizontal` |
|
||||
|
@ -7,6 +7,7 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
export interface StepsProps {
|
||||
prefixCls?: string;
|
||||
iconPrefix?: string;
|
||||
className?: string;
|
||||
current?: number;
|
||||
initial?: number;
|
||||
labelPlacement?: 'horizontal' | 'vertical';
|
||||
|
@ -28,6 +28,7 @@ title: Steps
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| className | 步骤条类名 | string | - |
|
||||
| current | 指定当前步骤,从 0 开始记数。在子 Step 元素中,可以通过 `status` 属性覆盖状态 | number | 0 |
|
||||
| direction | 指定步骤条方向。目前支持水平(`horizontal`)和竖直(`vertical`)两种方向 | string | horizontal |
|
||||
| labelPlacement | 指定标签放置位置,默认水平放图标右侧,可选 `vertical` 放图标下方 | string | `horizontal` |
|
||||
|
@ -49,6 +49,7 @@
|
||||
@heading-color-dark : fade(@white, 100%);
|
||||
@text-color-dark : fade(@white, 85%);
|
||||
@text-color-secondary-dark: fade(@white, 65%);
|
||||
|
||||
@font-variant-base : tabular-nums;
|
||||
@font-size-base : 14px;
|
||||
@font-size-lg : @font-size-base + 2px;
|
||||
@ -119,9 +120,7 @@
|
||||
@disabled-color-dark : fade(#fff, 35%);
|
||||
|
||||
// Shadow
|
||||
@shadow-color : fade(@black, 15%);
|
||||
@shadow-color-inverse : @component-background;
|
||||
@box-shadow-base : @shadow-1-down;
|
||||
@shadow-1-up : 0 -2px 8px @shadow-color;
|
||||
@shadow-1-down : 0 2px 8px @shadow-color;
|
||||
@shadow-1-left : -2px 0 8px @shadow-color;
|
||||
@ -289,8 +288,6 @@
|
||||
//** Tooltip text color
|
||||
@tooltip-color: #fff;
|
||||
//** Tooltip background color
|
||||
@tooltip-bg: fade(@black, 75%);
|
||||
//** Tooltip arrow width
|
||||
@tooltip-arrow-width: 5px;
|
||||
//** Tooltip distance with trigger
|
||||
@tooltip-distance: @tooltip-arrow-width - 1px + 4px;
|
||||
@ -405,11 +402,7 @@
|
||||
@card-padding-base: 24px;
|
||||
@card-padding-wider: 32px;
|
||||
@card-actions-background: @background-color-light;
|
||||
@card-shadow: 0 2px 8px fade(@black, 9%);
|
||||
@card-background: #cfd8dc;
|
||||
|
||||
// Comment
|
||||
// ---
|
||||
@comment-padding-base: 16px 0;
|
||||
@comment-nest-indent: 44px;
|
||||
@comment-author-name-color: @text-color-secondary;
|
||||
@ -495,7 +488,7 @@
|
||||
@slider-handle-color-tooltip-open: @primary-color;
|
||||
@slider-dot-border-color: @border-color-split;
|
||||
@slider-dot-border-color-active: tint(@primary-color, 50%);
|
||||
@slider-disabled-color: @disabled-color;
|
||||
|
||||
@slider-disabled-background-color: @component-background;
|
||||
|
||||
// Tree
|
||||
|
@ -891,8 +891,8 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
}
|
||||
if (!(title instanceof Function) && typeof title !== 'string' && typeof title !== 'number') {
|
||||
const props = title.props;
|
||||
const { children } = props;
|
||||
if (props && props.children) {
|
||||
const { children } = props;
|
||||
return this.getColumnTitle(children, props);
|
||||
}
|
||||
} else {
|
||||
|
@ -410,6 +410,7 @@
|
||||
background: @component-background;
|
||||
border-radius: @border-radius-base;
|
||||
box-shadow: @box-shadow-base;
|
||||
position: relative;
|
||||
|
||||
.@{ant-prefix}-dropdown-menu {
|
||||
border: 0;
|
||||
|
@ -28,7 +28,7 @@ One or more elements can be selected from either column, one click on the proper
|
||||
| lazy | property of [react-lazy-load](https://github.com/loktar00/react-lazy-load) for lazy rendering items. Turn off it by set to `false`. | object\|boolean | `{ height: 32, offset: 32 }` |
|
||||
| listStyle | A custom CSS style used for rendering the transfer columns. | object | |
|
||||
| locale | i18n text including filter, empty text, item unit, etc | object | `{ itemUnit: 'item', itemsUnit: 'items', notFoundContent: 'The list is empty', searchPlaceholder: 'Search here' }` |
|
||||
| operations | A set of operations that are sorted from bottom to top. | string\[] | ['>', '<'] |
|
||||
| operations | A set of operations that are sorted from top to bottom. | string\[] | ['>', '<'] |
|
||||
| operationStyle | A custom CSS style used for rendering the operations column. | object | |
|
||||
| render | The function to generate the item shown on a column. Based on an record (element of the dataSource array), this function should return a React element which is generated from that record. Also, it can return a plain object with `value` and `label`, `label` is a React element and `value` is for title | Function(record) | |
|
||||
| selectedKeys | A set of keys of selected items. | string\[] | \[] |
|
||||
|
@ -30,7 +30,7 @@ title: Transfer
|
||||
| lazy | Transfer 使用了 [react-lazy-load](https://github.com/loktar00/react-lazy-load) 优化性能,这里可以设置相关参数。设为 `false` 可以关闭懒加载。 | object\|boolean | `{ height: 32, offset: 32 }` |
|
||||
| listStyle | 两个穿梭框的自定义样式 | object | |
|
||||
| locale | 各种语言 | object | `{ itemUnit: '项', itemsUnit: '项', notFoundContent: '列表为空', searchPlaceholder: '请输入搜索内容' }` |
|
||||
| operations | 操作文案集合,顺序从下至上 | string\[] | ['>', '<'] |
|
||||
| operations | 操作文案集合,顺序从上至下 | string\[] | ['>', '<'] |
|
||||
| render | 每行数据渲染函数,该函数的入参为 `dataSource` 中的项,返回值为 ReactElement。或者返回一个普通对象,其中 `label` 字段为 ReactElement,`value` 字段为 title | Function(record) | |
|
||||
| selectedKeys | 设置哪些项应该被选中 | string\[] | \[] |
|
||||
| showSearch | 是否显示搜索框 | boolean | false |
|
||||
|
@ -9,7 +9,7 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
|
||||
const imageTypes: string[] = ['image', 'webp', 'png', 'svg', 'gif', 'jpg', 'jpeg', 'bmp'];
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL
|
||||
const previewFile = (file: File, callback: Function) => {
|
||||
const previewFile = (file: File | Blob, callback: Function) => {
|
||||
if (file.type && !imageTypes.includes(file.type)) {
|
||||
callback('');
|
||||
}
|
||||
|
@ -56,6 +56,41 @@ describe('Upload', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('upload promise return file in beforeUpload', done => {
|
||||
const data = jest.fn();
|
||||
const props = {
|
||||
action: 'http://upload.com',
|
||||
beforeUpload: file =>
|
||||
new Promise(resolve =>
|
||||
setTimeout(() => {
|
||||
const result = file;
|
||||
result.name = 'test.png';
|
||||
resolve(result);
|
||||
}, 100),
|
||||
),
|
||||
data,
|
||||
onChange: ({ file }) => {
|
||||
if (file.status !== 'uploading') {
|
||||
expect(data).toBeCalled();
|
||||
expect(file.name).toEqual('test.png');
|
||||
done();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const wrapper = mount(
|
||||
<Upload {...props}>
|
||||
<button type="button">upload</button>
|
||||
</Upload>,
|
||||
);
|
||||
|
||||
wrapper.find('input').simulate('change', {
|
||||
target: {
|
||||
files: [{ file: 'foo.png' }],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should not stop upload when return value of beforeUpload is false', done => {
|
||||
const fileList = [
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ Uploading is the process of publishing information (web pages, text, pictures, v
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| accept | File types that can be accepted. See [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept) | string | - |
|
||||
| accept | File types that can be accepted. See [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) | string | - |
|
||||
| action | Uploading URL | string\|(file) => `Promise` | - |
|
||||
| directory | support upload whole directory ([caniuse](https://caniuse.com/#feat=input-file-directory)) | boolean | false |
|
||||
| beforeUpload | Hook function which will be executed before uploading. Uploading will be stopped with `false` or a rejected Promise returned. **Warning:this function is not supported in IE9**。 | (file, fileList) => `boolean | Promise` | - |
|
||||
|
@ -21,10 +21,10 @@ title: Upload
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| accept | 接受上传的文件类型, 详见 [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept) | string | 无 |
|
||||
| accept | 接受上传的文件类型, 详见 [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) | string | 无 |
|
||||
| action | 上传的地址 | string\|(file) => `Promise` | 无 |
|
||||
| directory | 支持上传文件夹([caniuse](https://caniuse.com/#feat=input-file-directory))| boolean | false |
|
||||
| beforeUpload | 上传文件之前的钩子,参数为上传的文件,若返回 `false` 则停止上传。支持返回一个 Promise 对象,Promise 对象 reject 时则停止上传,resolve 时开始上传。**注意:IE9 不支持该方法**。 | (file, fileList) => `boolean | Promise` | 无 |
|
||||
| beforeUpload | 上传文件之前的钩子,参数为上传的文件,若返回 `false` 则停止上传。支持返回一个 Promise 对象,Promise 对象 reject 时则停止上传,resolve 时开始上传( resolve 传入 `File` 或 `Blob` 对象则上传 resolve 传入对象)。**注意:IE9 不支持该方法**。 | (file, fileList) => `boolean | Promise` | 无 |
|
||||
| customRequest | 通过覆盖默认的上传行为,可以自定义自己的上传实现 | Function | 无 |
|
||||
| data | 上传所需参数或返回上传参数的方法 | object\|(file) => object | 无 |
|
||||
| defaultFileList | 默认已经上传的文件列表 | object\[] | 无 |
|
||||
|
@ -49,7 +49,7 @@ Try [babel-plugin-import](https://github.com/ant-design/babel-plugin-import), or
|
||||
|
||||
```jsx
|
||||
import Menu from 'antd/lib/menu';
|
||||
import 'antd/lib/button/style/css';
|
||||
import 'antd/lib/menu/style/css';
|
||||
```
|
||||
|
||||
or (ES6 way with tree shaking):
|
||||
|
@ -49,7 +49,7 @@ https://ant.design/components/select/#Select-props
|
||||
|
||||
```jsx
|
||||
import Menu from 'antd/lib/menu';
|
||||
import 'antd/lib/button/style/css';
|
||||
import 'antd/lib/menu/style/css';
|
||||
```
|
||||
|
||||
或者(ES6 支持的 tree shaking 方式):
|
||||
|
@ -24,7 +24,7 @@ Top Progress Bar | [nprogress](https://github.com/rstacruz/nprogress)
|
||||
i18n | [react-intl](https://github.com/yahoo/react-intl)
|
||||
Code highlight | [react-syntax-highlighter](https://github.com/conorhastings/react-syntax-highlighter)
|
||||
Markdown renderer | [react-markdown](http://rexxars.github.io/react-markdown/)
|
||||
Infinite Scroll | [react-virtualized](https://github.com/bvaughn/react-virtualized)
|
||||
Infinite Scroll | [react-virtualized](https://github.com/bvaughn/react-virtualized) [antd-table-infinity](https://github.com/Leonard-Li777/antd-table-infinity)
|
||||
Map | [react-google-maps](https://github.com/tomchentw/react-google-maps) [google-map-react](https://github.com/istarkov/google-map-react) [react-amap](https://github.com/ElemeFE/react-amap)
|
||||
Context Menu | [react-contextmenu](https://github.com/vkbansal/react-contextmenu/) [react-contexify](https://github.com/fkhadra/react-contexify)
|
||||
Emoji | [emoji-mart](https://github.com/missive/emoji-mart)
|
||||
|
@ -24,7 +24,7 @@ title: 社区精选组件
|
||||
应用国际化 | [react-intl](https://github.com/yahoo/react-intl)
|
||||
代码高亮 | [react-syntax-highlighter](https://github.com/conorhastings/react-syntax-highlighter)
|
||||
Markdown 渲染 | [react-markdown](http://rexxars.github.io/react-markdown/)
|
||||
无限滚动 | [react-virtualized](https://github.com/bvaughn/react-virtualized)
|
||||
无限滚动 | [react-virtualized](https://github.com/bvaughn/react-virtualized) [antd-table-infinity](https://github.com/Leonard-Li777/antd-table-infinity)
|
||||
地图 | [react-google-maps](https://github.com/tomchentw/react-google-maps) [google-map-react](https://github.com/istarkov/google-map-react) [react-amap 高德](https://github.com/ElemeFE/react-amap)
|
||||
右键菜单 | [react-contextmenu](https://github.com/vkbansal/react-contextmenu/) [react-contexify](https://github.com/fkhadra/react-contexify)
|
||||
Emoji | [emoji-mart](https://github.com/missive/emoji-mart)
|
||||
|
35
package.json
35
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "antd",
|
||||
"version": "3.11.0",
|
||||
"version": "3.11.2",
|
||||
"title": "Ant Design",
|
||||
"description": "An enterprise-class UI design language and React-based implementation",
|
||||
"homepage": "http://ant.design/",
|
||||
@ -94,21 +94,21 @@
|
||||
"devDependencies": {
|
||||
"@types/classnames": "^2.2.6",
|
||||
"@types/prop-types": "^15.5.6",
|
||||
"@types/react": "~16.7.11",
|
||||
"@types/react-dom": "^16.0.8",
|
||||
"@types/react-intl": "^2.3.11",
|
||||
"@types/react": "~16.7.13",
|
||||
"@types/react-dom": "^16.0.11",
|
||||
"@types/react-intl": "^2.3.14",
|
||||
"@types/react-slick": "^0.23.2",
|
||||
"@yesmeck/offline-plugin": "^5.0.5",
|
||||
"ansi-styles": "^3.2.1",
|
||||
"ant-design-palettes": "^1.1.3",
|
||||
"antd-theme-generator": "^1.1.4",
|
||||
"antd-tools": "^5.2.2",
|
||||
"antd-tools": "^6.3.0",
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"bisheng": "^0.28.4",
|
||||
"bisheng": "^1.0.0",
|
||||
"bisheng-plugin-antd": "^0.17.0",
|
||||
"bisheng-plugin-description": "^0.1.4",
|
||||
"bisheng-plugin-react": "^0.6.3",
|
||||
"bisheng-plugin-react": "^1.0.0",
|
||||
"bisheng-plugin-toc": "^0.4.4",
|
||||
"commander": "^2.18.0",
|
||||
"core-js": "^2.5.7",
|
||||
@ -151,8 +151,8 @@
|
||||
"react": "^16.5.2",
|
||||
"react-color": "^2.14.1",
|
||||
"react-copy-to-clipboard": "^5.0.1",
|
||||
"react-dnd": "^6.0.0",
|
||||
"react-dnd-html5-backend": "^6.0.0",
|
||||
"react-dnd": "^7.0.2",
|
||||
"react-dnd-html5-backend": "^7.0.2",
|
||||
"react-document-title": "^2.0.3",
|
||||
"react-dom": "^16.5.2",
|
||||
"react-github-button": "^0.1.11",
|
||||
@ -173,7 +173,7 @@
|
||||
"stylelint": "~9.6.0",
|
||||
"stylelint-config-prettier": "^4.0.0",
|
||||
"stylelint-config-standard": "^18.2.0",
|
||||
"typescript": "~3.1.1",
|
||||
"typescript": "~3.2.2",
|
||||
"unified": "^7.0.0",
|
||||
"xhr-mock": "^2.4.1",
|
||||
"xhr2": "^0.1.4"
|
||||
@ -217,24 +217,27 @@
|
||||
"lint-staged": {
|
||||
"components/**/*.tsx": [
|
||||
"npm run lint-staged:ts",
|
||||
"node ./scripts/lint-prettier.js"
|
||||
"node ./scripts/pre-prettier.js",
|
||||
"git add"
|
||||
],
|
||||
"{tests,site,scripts,components}/**/*.{js,jsx}": [
|
||||
"npm run lint-staged:es",
|
||||
"node ./scripts/lint-prettier.js"
|
||||
"node ./scripts/pre-prettier.js",
|
||||
"git add"
|
||||
],
|
||||
"{site,components}/**/*.less": [
|
||||
"stylelint --syntax less",
|
||||
"node ./scripts/lint-prettier.js"
|
||||
"node ./scripts/pre-prettier.js",
|
||||
"git add"
|
||||
],
|
||||
"components/*/demo/*.md": [
|
||||
"npm run lint-staged:demo",
|
||||
"node ./scripts/lint-prettier.js"
|
||||
"npm run lint-staged:demo"
|
||||
]
|
||||
},
|
||||
"sideEffects": [
|
||||
"dist/*",
|
||||
"es/**/style/*",
|
||||
"lib/**/style/*"
|
||||
"lib/**/style/*",
|
||||
"*.less"
|
||||
]
|
||||
}
|
||||
|
47
scripts/pre-prettier.js
Normal file
47
scripts/pre-prettier.js
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* copy to https://github.com/facebook/react/blob/master/scripts/prettier/index.js
|
||||
* prettier api doc https://prettier.io/docs/en/api.html
|
||||
*----------*****--------------
|
||||
* pre commit prettier file
|
||||
*----------*****--------------
|
||||
*/
|
||||
|
||||
const prettier = require('prettier');
|
||||
const fs = require('fs');
|
||||
|
||||
const prettierConfigPath = require.resolve('../.prettierrc');
|
||||
|
||||
const files = process.argv.slice(2);
|
||||
|
||||
let didError = false;
|
||||
|
||||
files.forEach(file => {
|
||||
const options = prettier.resolveConfig.sync(file, {
|
||||
config: prettierConfigPath,
|
||||
});
|
||||
try {
|
||||
const fileInfo = prettier.getFileInfo.sync(file);
|
||||
if (fileInfo.ignored) {
|
||||
return;
|
||||
}
|
||||
const input = fs.readFileSync(file, 'utf8');
|
||||
const withParserOptions = {
|
||||
...options,
|
||||
parser: fileInfo.inferredParser,
|
||||
};
|
||||
const output = prettier.format(input, withParserOptions);
|
||||
if (output !== input) {
|
||||
fs.writeFileSync(file, output, 'utf8');
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`\x1b[34m ${file} is prettier`);
|
||||
}
|
||||
} catch (e) {
|
||||
didError = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (didError) {
|
||||
process.exit(1);
|
||||
}
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('\x1b[32m prettier success!');
|
@ -83,6 +83,9 @@ module.exports = {
|
||||
doraConfig: {
|
||||
verbose: true,
|
||||
},
|
||||
lessConfig: {
|
||||
javascriptEnabled: true,
|
||||
},
|
||||
webpackConfig(config) {
|
||||
// eslint-disable-next-line
|
||||
config.resolve.alias = {
|
||||
|
@ -1,8 +1,9 @@
|
||||
/* eslint no-param-reassign: 0 */
|
||||
// This config is for building dist files
|
||||
const webpack = require('webpack'); // eslint-disable-line
|
||||
const getWebpackConfig = require('antd-tools/lib/getWebpackConfig');
|
||||
|
||||
const { webpack } = getWebpackConfig;
|
||||
|
||||
// noParse still leave `require('./locale' + name)` in dist files
|
||||
// ignore is better: http://stackoverflow.com/q/25384360
|
||||
function ignoreMomentLocale(webpackConfig) {
|
||||
|
Loading…
Reference in New Issue
Block a user