From 88100a29a3a53cbd0452ef68bb5f5976cc747bf2 Mon Sep 17 00:00:00 2001 From: feng zhi hao Date: Fri, 24 Feb 2017 16:06:57 +0800 Subject: [PATCH 1/4] chore: fix ts definition of Upload (#5041) --- components/upload/interface.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/upload/interface.tsx b/components/upload/interface.tsx index c9cc6a729..0160acc45 100755 --- a/components/upload/interface.tsx +++ b/components/upload/interface.tsx @@ -42,7 +42,7 @@ export interface UploadProps { showUploadList?: boolean | ShowUploadListInterface; multiple?: boolean; accept?: string; - beforeUpload?: (file: File) => boolean | PromiseLike; + beforeUpload?: (file: File, FileList: File[]) => boolean | PromiseLike; onChange?: (info: UploadChangeParam) => void; listType?: 'text' | 'picture' | 'picture-card'; className?: string; @@ -52,6 +52,8 @@ export interface UploadProps { style?: React.CSSProperties; disabled?: boolean; prefixCls?: string; + customRequest?: (option: any) => void; + withCredentials?: boolean; } export interface UploadListProps { From e07cdf5387a5a8f71253372e0319ecd008ee15d0 Mon Sep 17 00:00:00 2001 From: ddcat1115 Date: Fri, 24 Feb 2017 16:07:39 +0800 Subject: [PATCH 2/4] add left out event parameters for Modal[onOk] Popconfirm[onConfirm] Popconfirm[onCancel] (#5042) --- components/modal/Modal.tsx | 6 +++--- components/modal/demo/basic.md | 4 ++-- components/modal/index.en-US.md | 2 +- components/modal/index.zh-CN.md | 2 +- components/popconfirm/demo/basic.md | 6 ++++-- components/popconfirm/index.en-US.md | 4 ++-- components/popconfirm/index.tsx | 12 ++++++------ components/popconfirm/index.zh-CN.md | 4 ++-- 8 files changed, 21 insertions(+), 19 deletions(-) diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx index 966376532..6cc323680 100644 --- a/components/modal/Modal.tsx +++ b/components/modal/Modal.tsx @@ -17,7 +17,7 @@ export interface ModalProps { /** 是否显示右上角的关闭按钮*/ closable?: boolean; /** 点击确定回调*/ - onOk?: () => void; + onOk?: (e: React.MouseEvent) => void; /** 点击模态框右上角叉、取消按钮、Props.maskClosable 值为 true 时的遮罩层或键盘按下 Esc 时的回调*/ onCancel?: (e: React.MouseEvent) => void; afterClose?: () => void; @@ -89,10 +89,10 @@ export default class Modal extends React.Component { } } - handleOk = () => { + handleOk = (e) => { const onOk = this.props.onOk; if (onOk) { - onOk(); + onOk(e); } } diff --git a/components/modal/demo/basic.md b/components/modal/demo/basic.md index 6ad8f5414..526e2afd9 100644 --- a/components/modal/demo/basic.md +++ b/components/modal/demo/basic.md @@ -23,8 +23,8 @@ class App extends React.Component { visible: true, }); } - handleOk = () => { - console.log('Clicked OK'); + handleOk = (e) => { + console.log(e); this.setState({ visible: false, }); diff --git a/components/modal/index.en-US.md b/components/modal/index.en-US.md index 59750ddc5..cfef06f3c 100644 --- a/components/modal/index.en-US.md +++ b/components/modal/index.en-US.md @@ -22,7 +22,7 @@ and so on. | confirmLoading | Determine whether to apply loading visual effect for OK button or not | boolean | no | | title | The modal dialog's title | string\|ReactNode | no | | closable | Determine whether a close (x) button is visible on top right of the modal dialog or not | boolean | true | -| onOk | Specify a function that will be called when a user clicked OK button | function | no | +| onOk | Specify a function that will be called when a user clicked OK button | function(e) | no | | onCancel | Specify a function that will be called when a user clicked mask, close button on top right or cancel button | function(e) | no | | width | Width of a modal dialog | string\|number | 520 | | footer | Footer content, set as `footer={null}` when you don't need default buttons | string\|ReactNode | OK and cancel button | diff --git a/components/modal/index.zh-CN.md b/components/modal/index.zh-CN.md index 36ab711a4..e8eb83afd 100644 --- a/components/modal/index.zh-CN.md +++ b/components/modal/index.zh-CN.md @@ -21,7 +21,7 @@ title: Modal | confirmLoading | 确定按钮 loading | boolean | 无 | | title | 标题 | string\|ReactNode | 无 | | closable | 是否显示右上角的关闭按钮 | boolean | true | -| onOk | 点击确定回调 | function | 无 | +| onOk | 点击确定回调 | function(e) | 无 | | onCancel | 点击遮罩层或右上角叉或取消按钮的回调 | function(e) | 无 | | width | 宽度 | string\|number | 520 | | footer | 底部内容,当不需要默认底部按钮时,可以设为 `footer={null}` | string\|ReactNode | 确定取消按钮 | diff --git a/components/popconfirm/demo/basic.md b/components/popconfirm/demo/basic.md index c4f90d1cd..f95cd2eca 100755 --- a/components/popconfirm/demo/basic.md +++ b/components/popconfirm/demo/basic.md @@ -16,11 +16,13 @@ The basic example. ````jsx import { Popconfirm, message } from 'antd'; -function confirm() { +function confirm(e) { + console.log(e); message.success('Click on Yes'); } -function cancel() { +function cancel(e) { + console.log(e); message.error('Click on No'); } diff --git a/components/popconfirm/index.en-US.md b/components/popconfirm/index.en-US.md index f75570cd2..ffe09127c 100644 --- a/components/popconfirm/index.en-US.md +++ b/components/popconfirm/index.en-US.md @@ -17,8 +17,8 @@ The difference with `confirm` is more lightweight than the static popped full-sc | Param | Description | Type | Default value | |-----------|------------------------------------------|---------------|--------| | title | title of the confirmation box | string\|ReactNode | none | -| onConfirm | callback of confirmation | function | none | -| onCancel | callback of cancel | function | none | +| onConfirm | callback of confirmation | function(e) | none | +| onCancel | callback of cancel | function(e) | none | | okText | text of the confirmation button | string | Confirm | | cancelText| text of the cancel button | string | Cancel | diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx index ce9888247..be982260a 100644 --- a/components/popconfirm/index.tsx +++ b/components/popconfirm/index.tsx @@ -6,8 +6,8 @@ import Button from '../button'; export interface PopconfirmProps extends AbstractTooltipProps { title: React.ReactNode; - onConfirm?: () => void; - onCancel?: () => void; + onConfirm?: (e: React.MouseEvent) => void; + onCancel?: (e: React.MouseEvent) => void; okText?: React.ReactNode; cancelText?: React.ReactNode; } @@ -46,21 +46,21 @@ export default class Popconfirm extends React.Component { } } - confirm = () => { + confirm = (e) => { this.setVisible(false); const onConfirm = this.props.onConfirm; if (onConfirm) { - onConfirm.call(this); + onConfirm.call(this, e); } } - cancel = () => { + cancel = (e) => { this.setVisible(false); const onCancel = this.props.onCancel; if (onCancel) { - onCancel.call(this); + onCancel.call(this, e); } } diff --git a/components/popconfirm/index.zh-CN.md b/components/popconfirm/index.zh-CN.md index 42468effc..2bded6d4f 100644 --- a/components/popconfirm/index.zh-CN.md +++ b/components/popconfirm/index.zh-CN.md @@ -18,8 +18,8 @@ title: Popconfirm | 参数 | 说明 | 类型 | 默认值 | |-----------|------------------------------------------|---------------|--------| | title | 确认框的描述 | string\|ReactNode | 无 | -| onConfirm | 点击确认的回调 | function | 无 | -| onCancel | 点击取消的回调 | function | 无 | +| onConfirm | 点击确认的回调 | function(e) | 无 | +| onCancel | 点击取消的回调 | function(e) | 无 | | okText | 确认按钮文字 | string | 确定 | | cancelText| 取消按钮文字 | string | 取消 | From 3aac9adc406ee1924b913eeb205370e9c2488e19 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Fri, 24 Feb 2017 16:17:52 +0800 Subject: [PATCH 3/4] docs: remove some demo --- .../__tests__/__snapshots__/demo.test.js.snap | 784 ------------------ components/calendar/demo/locale.md | 35 - .../__tests__/__snapshots__/demo.test.js.snap | 18 - components/date-picker/__tests__/demo.test.js | 11 - components/date-picker/demo/locale.md | 46 - 5 files changed, 894 deletions(-) delete mode 100644 components/calendar/demo/locale.md delete mode 100644 components/date-picker/demo/locale.md diff --git a/components/calendar/__tests__/__snapshots__/demo.test.js.snap b/components/calendar/__tests__/__snapshots__/demo.test.js.snap index 559343426..5187e3d71 100644 --- a/components/calendar/__tests__/__snapshots__/demo.test.js.snap +++ b/components/calendar/__tests__/__snapshots__/demo.test.js.snap @@ -1569,790 +1569,6 @@ exports[`test renders ./components/calendar/demo/card.md correctly 1`] = ` `; -exports[`test renders ./components/calendar/demo/locale.md correctly 1`] = ` -
-
-
- -
-
- -
-
- - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Su - - - - Mo - - - - Tu - - - - We - - - - Th - - - - Fr - - - - Sa - -
-
-
- 30 -
-
-
-
-
-
- 31 -
-
-
-
-
-
- 01 -
-
-
-
-
-
- 02 -
-
-
-
-
-
- 03 -
-
-
-
-
-
- 04 -
-
-
-
-
-
- 05 -
-
-
-
-
-
- 06 -
-
-
-
-
-
- 07 -
-
-
-
-
-
- 08 -
-
-
-
-
-
- 09 -
-
-
-
-
-
- 10 -
-
-
-
-
-
- 11 -
-
-
-
-
-
- 12 -
-
-
-
-
-
- 13 -
-
-
-
-
-
- 14 -
-
-
-
-
-
- 15 -
-
-
-
-
-
- 16 -
-
-
-
-
-
- 17 -
-
-
-
-
-
- 18 -
-
-
-
-
-
- 19 -
-
-
-
-
-
- 20 -
-
-
-
-
-
- 21 -
-
-
-
-
-
- 22 -
-
-
-
-
-
- 23 -
-
-
-
-
-
- 24 -
-
-
-
-
-
- 25 -
-
-
-
-
-
- 26 -
-
-
-
-
-
- 27 -
-
-
-
-
-
- 28 -
-
-
-
-
-
- 29 -
-
-
-
-
-
- 30 -
-
-
-
-
-
- 01 -
-
-
-
-
-
- 02 -
-
-
-
-
-
- 03 -
-
-
-
-
-
- 04 -
-
-
-
-
-
- 05 -
-
-
-
-
-
- 06 -
-
-
-
-
-
- 07 -
-
-
-
-
-
- 08 -
-
-
-
-
-
- 09 -
-
-
-
-
-
- 10 -
-
-
-
-
-
-
-`; - exports[`test renders ./components/calendar/demo/notice-calendar.md correctly 1`] = `
diff --git a/components/calendar/demo/locale.md b/components/calendar/demo/locale.md deleted file mode 100644 index 9883046c6..000000000 --- a/components/calendar/demo/locale.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -order: 3 -title: - zh-CN: 国际化 - en-US: Localization ---- - -## zh-CN - -通过 `LocaleProvider` 配置语言。 - -## en-US - -To set the language. - -````jsx -import { Calendar, LocaleProvider } from 'antd'; -import enUS from 'antd/lib/locale-provider/en_US'; -import moment from 'moment'; -// It's recommended to set moment locale globally, otherwise, you need to set it by `value` or `defaultValue` -// moment.locale('en'); - -function onPanelChange(value, mode) { - console.log(value, mode); -} -ReactDOM.render( - - - , - mountNode -); -```` diff --git a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap index ac220eceb..0756b26a2 100644 --- a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap +++ b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap @@ -210,24 +210,6 @@ exports[`test renders ./components/date-picker/demo/format.md correctly 1`] = `
`; -exports[`test renders ./components/date-picker/demo/locale.md correctly 1`] = ` - - - - - - - -`; - exports[`test renders ./components/date-picker/demo/presetted-ranges.md correctly 1`] = `
{ - MockDate.set(new Date('2016-11-22').getTime()); - const LocaleDemo = require('../demo/locale'); // eslint-disable-line global-require - const wrapper = render(LocaleDemo); - expect(renderToJson(wrapper)).toMatchSnapshot(); - MockDate.reset(); -}); diff --git a/components/date-picker/demo/locale.md b/components/date-picker/demo/locale.md deleted file mode 100644 index 35564e88c..000000000 --- a/components/date-picker/demo/locale.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -order: 7 -title: - zh-CN: 国际化 - en-US: Localization ---- - -## zh-CN - -通过 `LocaleProvider` 设置语言。 - -`moment` 会自动使用当前时区,如果需要使用别的时区,则需要自行设置,设置方法请参考示例代码中的注释。 - -## en-US - -Use locale to set the language. - -`moment` will use your time zone automatically. If you want to set other time zone, please set it by yourself. - - -````jsx -import { DatePicker, LocaleProvider } from 'antd'; -import enUS from 'antd/lib/locale-provider/en_US'; -import moment from 'moment-timezone/moment-timezone'; - -// It's recommended to set moment locale and time zone globally in entry file, -// otherwise, you need to set it by `value` or `defaultValue`. -// moment.locale('en'); - -// The following data is copied from https://github.com/moment/moment-timezone/blob/develop/data/packed/latest.json -// moment.tz.add('Europe/London|GMT BST BDST|0 -10 -20|0101010101010101010101010101010101010101010101010121212121210101210101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2axa0 Rc0 1fA0 14M0 1fc0 1g00 1co0 1dc0 1co0 1oo0 1400 1dc0 19A0 1io0 1io0 WM0 1o00 14o0 1o00 17c0 1io0 17c0 1fA0 1a00 1lc0 17c0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1cM0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1io0 1qM0 Dc0 2Rz0 Dc0 1zc0 Oo0 1zc0 Rc0 1wo0 17c0 1iM0 FA0 xB0 1fA0 1a00 14o0 bb0 LA0 xB0 Rc0 1wo0 11A0 1o00 17c0 1fA0 1a00 1fA0 1cM0 1fA0 1a00 17c0 1fA0 1a00 1io0 17c0 1lc0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1a00 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1tA0 IM0 90o0 U00 1tA0 U00 1tA0 U00 1tA0 U00 1tA0 WM0 1qM0 WM0 1qM0 WM0 1tA0 U00 1tA0 U00 1tA0 11z0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 14o0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|10e6'); -// moment.tz.setDefault('Europe/London') - -const log = console.log.bind(console); - -ReactDOM.render( - - - , - mountNode -); -```` From edaad09b672644518327470bd9598025d0a5101e Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 24 Feb 2017 16:24:40 +0800 Subject: [PATCH 4/4] update grid document for media queries rule, close #5030 --- components/grid/index.en-US.md | 4 +++- components/grid/index.zh-CN.md | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/grid/index.en-US.md b/components/grid/index.en-US.md index 8ba4875cb..3e6dfb939 100644 --- a/components/grid/index.en-US.md +++ b/components/grid/index.en-US.md @@ -104,7 +104,9 @@ Ant Design layout component if it can not meet your needs, you can use the excel | offset | the number of cells to the left of the grid spacing, no cell in grid spacing | number | 0 | | push | the number of cells that raster move to the right | number | 0 | | pull | the number of cells that raster move to the left | number | 0 | -| xs | `<768px`, could be a `span` value or a object contain above props | number\|object | - | +| xs | `<768px` and also default setting, could be a `span` value or a object contain above props | number\|object | - | | sm | `≥768px`, could be a `span` value or a object contain above props | number\|object | - | | md | `≥992px`, could be a `span` value or a object contain above props | number\|object | - | | lg | `≥1200px`, could be a `span` value or a object contain above props | number\|object | - | + +The breakpoints of responsive grid follow [BootStrap 3 media queries rules](http://getbootstrap.com/css/#grid-media-queries)(not contain `occasionally part`). diff --git a/components/grid/index.zh-CN.md b/components/grid/index.zh-CN.md index 37083bd70..fb9075d92 100644 --- a/components/grid/index.zh-CN.md +++ b/components/grid/index.zh-CN.md @@ -107,3 +107,5 @@ Ant Design 的布局组件若不能满足你的需求,你也可以直接使用 | sm | `≥768px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number\|object | - | | md | `≥992px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number\|object | - | | lg | `≥1200px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number\|object | - | + +响应式栅格的断点遵循了 [BootStrap 3 的规则](http://getbootstrap.com/css/#grid-media-queries)(不包含链接里 `occasionally` 的部分)。