diff --git a/components/alert/__tests__/__snapshots__/demo.test.js.snap b/components/alert/__tests__/__snapshots__/demo.test.js.snap
index 23160bc1e..9a54cd606 100644
--- a/components/alert/__tests__/__snapshots__/demo.test.js.snap
+++ b/components/alert/__tests__/__snapshots__/demo.test.js.snap
@@ -2,10 +2,18 @@
exports[`renders ./components/alert/demo/banner.md correctly 1`] = `
Success Text
@@ -33,20 +59,42 @@ exports[`renders ./components/alert/demo/description.md correctly 1`] = `
exports[`renders ./components/alert/demo/icon.md correctly 1`] = `
-
Success Tips
-
Informational Notes
-
Warning
-
Error
-
Success Tips Detailed description and advices about successful copywriting.
-
Informational Notes Additional description and informations about copywriting.
-
Warning This is a warning notice about copywriting.
-
Error This is an error message about copywriting.
+
+
+
+
+
+
+
+ Success Tips Detailed description and advices about successful copywriting.
+
+
+
+ Informational Notes Additional description and informations about copywriting.
+
+
+
+ Warning This is a warning notice about copywriting.
+
+
+
+ Error This is an error message about copywriting.
`;
exports[`renders ./components/alert/demo/smooth-closed.md correctly 1`] = `
`;
diff --git a/components/anchor/demo/index.vue b/components/anchor/demo/index.vue
index 941f1f6c6..9b7fdd9af 100644
--- a/components/anchor/demo/index.vue
+++ b/components/anchor/demo/index.vue
@@ -28,7 +28,7 @@ export default {
subtitle: '锚点',
cols: 2,
type: 'Other',
- zhType: '其它',
+ zhType: '其他',
title: 'Anchor',
render () {
return (
diff --git a/components/back-top/demo/index.vue b/components/back-top/demo/index.vue
index e6a93f968..eb9648fc5 100644
--- a/components/back-top/demo/index.vue
+++ b/components/back-top/demo/index.vue
@@ -21,6 +21,7 @@ const md = {
export default {
category: 'Components',
type: 'Other',
+ zhType: '其他',
subtitle: '回到顶部',
title: 'BackTop',
render () {
diff --git a/components/badge/Badge.jsx b/components/badge/Badge.jsx
index 258cd0b24..e9c9d5f25 100644
--- a/components/badge/Badge.jsx
+++ b/components/badge/Badge.jsx
@@ -73,7 +73,7 @@ export default {
[`${prefixCls}-not-a-wrapper`]: !children.length,
})
const styleWithOffset = offset ? {
- marginLeft: typeof offset[0] === 'number' ? `${offset[0]}px` : offset[0],
+ right: -parseInt(offset[0], 10),
marginTop: typeof offset[1] === 'number' ? `${offset[1]}px` : offset[1],
...numberStyle,
} : numberStyle
diff --git a/components/badge/__tests__/__snapshots__/demo.test.js.snap b/components/badge/__tests__/__snapshots__/demo.test.js.snap
index 719178a71..6e4863e27 100644
--- a/components/badge/__tests__/__snapshots__/demo.test.js.snap
+++ b/components/badge/__tests__/__snapshots__/demo.test.js.snap
@@ -5,13 +5,17 @@ exports[`renders ./components/badge/demo/basic.md correctly 1`] = `
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
-
+
`;
-exports[`renders ./components/badge/demo/dot.md correctly 1`] = ``;
+exports[`renders ./components/badge/demo/dot.md correctly 1`] = ``;
exports[`renders ./components/badge/demo/link.md correctly 1`] = `0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
`;
diff --git a/components/badge/demo/index.vue b/components/badge/demo/index.vue
index 25ba23d82..99d19c522 100644
--- a/components/badge/demo/index.vue
+++ b/components/badge/demo/index.vue
@@ -29,6 +29,7 @@
category: 'Components',
subtitle: '徽标数',
type: 'Data Display',
+ zhType: '数据展示',
title: 'Badge',
render () {
return (
@@ -61,6 +62,7 @@
border-radius: 4px;
background: #eee;
display: inline-block;
+ vertical-align: middle;
}
#components-badge-demo .ant-badge-not-a-wrapper:not(.ant-badge-status) {
margin-right: 8px;
diff --git a/components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap b/components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap
index daafe045e..211a16938 100644
--- a/components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap
+++ b/components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap
@@ -12,7 +12,7 @@ exports[`renders ./components/breadcrumb/demo/separator.md correctly 1`] = `
`;
exports[`renders ./components/breadcrumb/demo/withIcon.md correctly 1`] = `
-/ Application List /
+
`;
diff --git a/components/breadcrumb/demo/index.vue b/components/breadcrumb/demo/index.vue
index bbea90951..aec8c2f4a 100644
--- a/components/breadcrumb/demo/index.vue
+++ b/components/breadcrumb/demo/index.vue
@@ -31,6 +31,7 @@
category: 'Components',
subtitle: '面包屑',
type: 'Navigation',
+ zhType: '导航',
title: 'Breadcrumb',
render () {
return (
diff --git a/components/button/__tests__/__snapshots__/demo.test.js.snap b/components/button/__tests__/__snapshots__/demo.test.js.snap
index 3dab9dde4..4dff6fe2a 100644
--- a/components/button/__tests__/__snapshots__/demo.test.js.snap
+++ b/components/button/__tests__/__snapshots__/demo.test.js.snap
@@ -11,10 +11,19 @@ exports[`renders ./components/button/demo/button-group.md correctly 1`] = `
L M R
L M M R
With Icon
- Go back
+
-
+ Go forward
+
+
+
`;
@@ -26,20 +35,60 @@ exports[`renders ./components/button/demo/disabled.md correctly 1`] = `
exports[`renders ./components/button/demo/ghost.md correctly 1`] = `Primary Default Dashed danger
`;
-exports[`renders ./components/button/demo/icon.md correctly 1`] = ` Search Search Search Search
`;
+exports[`renders ./components/button/demo/icon.md correctly 1`] = `
+
+
+
+
+ Search
+
+
+
+ Search
+
+
+
+ Search
+
+
+
+ Search
+`;
-exports[`renders ./components/button/demo/loading.md correctly 1`] = `Loading Loading mouseenter me! 延迟1s
`;
+exports[`renders ./components/button/demo/loading.md correctly 1`] = `
+
+
+ Loading
+
+ Loading mouseenter me!
+
+ 延迟1s
+
+
+
+
+`;
exports[`renders ./components/button/demo/multiple.md correctly 1`] = `
Primary secondary
- Actions
+ Actions
+
+
`;
exports[`renders ./components/button/demo/size.md correctly 1`] = `
`;
diff --git a/components/button/__tests__/__snapshots__/index.test.js.snap b/components/button/__tests__/__snapshots__/index.test.js.snap
index 0a9dc15e2..834e92354 100644
--- a/components/button/__tests__/__snapshots__/index.test.js.snap
+++ b/components/button/__tests__/__snapshots__/index.test.js.snap
@@ -6,15 +6,35 @@ exports[`Button fixbug renders {0} , 0 and {false} 2`] = `
`;
-exports[`Button renders Chinese characters correctly 1`] = `
按钮 `;
+exports[`Button renders Chinese characters correctly 1`] = `
+
+
+ 按钮
+`;
-exports[`Button renders Chinese characters correctly 2`] = `
按钮`;
+exports[`Button renders Chinese characters correctly 2`] = `
+
+
+ 按钮
+`;
-exports[`Button renders Chinese characters correctly 3`] = `
按钮 `;
+exports[`Button renders Chinese characters correctly 3`] = `
+
+
+ 按钮
+`;
-exports[`Button renders Chinese characters correctly 4`] = `
按钮 `;
+exports[`Button renders Chinese characters correctly 4`] = `
+
+
+ 按钮
+`;
-exports[`Button renders Chinese characters correctly 5`] = `
按 钮 `;
+exports[`Button renders Chinese characters correctly 5`] = `
+
+
+ 按 钮
+`;
exports[`Button renders correctly 1`] = `
Follow `;
diff --git a/components/button/button.jsx b/components/button/button.jsx
index 7a49ebffa..36a21e8fb 100644
--- a/components/button/button.jsx
+++ b/components/button/button.jsx
@@ -65,7 +65,10 @@ export default {
methods: {
fixTwoCNChar () {
// Fix for HOC usage like
- const node = this.$el
+ const node = this.$refs.buttonNode
+ if (!node) {
+ return
+ }
const buttonText = node.textContent || node.innerText
if (this.isNeedInserted() && isTwoCNChar(buttonText)) {
if (!this.hasTwoCNChar) {
@@ -76,9 +79,10 @@ export default {
}
},
handleClick (event) {
- // this.clicked = true
- // clearTimeout(this.timeout)
- // this.timeout = setTimeout(() => (this.clicked = false), 500)
+ const { sLoading } = this.$data
+ if (sLoading) {
+ return
+ }
this.$emit('click', event)
},
insertSpace (child, needInserted) {
@@ -101,6 +105,9 @@ export default {
const { htmlType, classes, icon,
disabled, handleClick,
sLoading, $slots, $attrs, $listeners } = this
+ const now = new Date()
+ const isChristmas = now.getMonth() === 11 && now.getDate() === 25
+ const title = isChristmas ? 'Ho Ho Ho!' : $attrs.title
const buttonProps = {
props: {
},
@@ -108,8 +115,9 @@ export default {
...$attrs,
type: htmlType,
disabled,
+ title,
},
- class: classes,
+ class: { ...classes, christmas: isChristmas },
on: {
...$listeners,
click: handleClick,
@@ -118,16 +126,17 @@ export default {
const iconType = sLoading ? 'loading' : icon
const iconNode = iconType ?
: null
const kids = $slots.default && $slots.default.length === 1 ? this.insertSpace($slots.default[0], this.isNeedInserted()) : $slots.default
+
if ('href' in $attrs) {
return (
-
+
{iconNode}{kids}
)
} else {
return (
-
+
{iconNode}{kids}
diff --git a/components/button/demo/index.vue b/components/button/demo/index.vue
index a39748f17..29c380c90 100644
--- a/components/button/demo/index.vue
+++ b/components/button/demo/index.vue
@@ -26,6 +26,7 @@ const md = {
export default {
category: 'Components',
type: 'General',
+ zhType: '通用',
title: 'Button',
subtitle: '按钮',
render () {
diff --git a/components/button/index.en-US.md b/components/button/index.en-US.md
index 01844a0d4..9c3ea1361 100644
--- a/components/button/index.en-US.md
+++ b/components/button/index.en-US.md
@@ -17,7 +17,7 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
### events
| Events Name | Description | Arguments |
| --- | --- | --- |
-| click | set the handler to handle `click` event | function(e) |
+| click | set the handler to handle `click` event | (event) => void |
`
Hello world! ` will be rendered into `
Hello world! `, and all the properties which are not listed above will be transferred to the `
` tag.
diff --git a/components/button/index.zh-CN.md b/components/button/index.zh-CN.md
index 80971eafc..afd88a3a8 100644
--- a/components/button/index.zh-CN.md
+++ b/components/button/index.zh-CN.md
@@ -19,7 +19,7 @@
### 事件
| 事件名称 | 说明 | 回调参数 |
| --- | --- | --- |
-| click | `click` 事件的 handler | function(e) |
+| click | 点击按钮时的回调 | (event) => void |
-`Hello world! ` 最终会被渲染为 `Hello world! `,并且除了上表中的属性,其它属性都会直接传到 ` `。
+`Hello world! ` 最终会被渲染为 `Hello world! `,并且除了上表中的属性,其它属性都会直接传到原生 button 上。
diff --git a/components/calendar/Header.jsx b/components/calendar/Header.jsx
index 43da7f308..bf0442c0b 100644
--- a/components/calendar/Header.jsx
+++ b/components/calendar/Header.jsx
@@ -84,7 +84,7 @@ export default {
const currentYear = value.get('year')
if (rangeEnd.get('year') === currentYear) {
end = rangeEnd.get('month') + 1
- } else {
+ } else if (rangeStart.get('year') === currentYear) {
start = rangeStart.get('month')
}
}
diff --git a/components/calendar/__tests__/__snapshots__/index.test.js.snap b/components/calendar/__tests__/__snapshots__/index.test.js.snap
new file mode 100644
index 000000000..7d8d9b783
--- /dev/null
+++ b/components/calendar/__tests__/__snapshots__/index.test.js.snap
@@ -0,0 +1,306 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Calendar Calendar should support locale 1`] = `
+
+
+
+
+
+
+
+ Su
+ Mo
+ Tu
+ We
+ Th
+ Fr
+ Sa
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
diff --git a/components/calendar/__tests__/index.test.js b/components/calendar/__tests__/index.test.js
index be4cee1ac..b40eb9c1f 100644
--- a/components/calendar/__tests__/index.test.js
+++ b/components/calendar/__tests__/index.test.js
@@ -1,6 +1,7 @@
import Moment from 'moment'
import { mount } from '@vue/test-utils'
import { asyncExpect } from '@/tests/utils'
+import MockDate from 'mockdate'
import Vue from 'vue'
import Calendar from '..'
@@ -152,4 +153,15 @@ describe('Calendar', () => {
done()
})
})
+
+ it('Calendar should support locale', () => {
+ MockDate.set(Moment('2018-10-19'))
+ // eslint-disable-next-line
+ const zhCN = require('../locale/zh_CN').default;
+ const wrapper = mount(Calendar, { propsData: {
+ locale: zhCN,
+ }})
+ expect(wrapper.html()).toMatchSnapshot()
+ MockDate.reset()
+ })
})
diff --git a/components/calendar/demo/index.vue b/components/calendar/demo/index.vue
index 9be0423c9..f81368e01 100644
--- a/components/calendar/demo/index.vue
+++ b/components/calendar/demo/index.vue
@@ -28,6 +28,7 @@ When data is in the form of dates, such as schedules, timetables, prices calenda
export default {
category: 'Components',
type: 'Data Display',
+ zhType: '数据展示',
subtitle: '日历',
cols: 1,
title: 'Calendar',
diff --git a/components/calendar/index.en-US.md b/components/calendar/index.en-US.md
index c248c7404..7763009f8 100644
--- a/components/calendar/index.en-US.md
+++ b/components/calendar/index.en-US.md
@@ -4,7 +4,7 @@
**Note:** Part of the Calendar's locale is read from `value`. So, please set the locale of `moment` correctly.
````html
-// The default locale is en-US, if you want to use other locale, just set locale in entry file globaly.
+// The default locale is en-US, if you want to use other locale, just set locale in entry file globally.
// import moment from 'moment';
// import 'moment/locale/zh-cn';
// moment.locale('zh-cn');
diff --git a/components/calendar/index.jsx b/components/calendar/index.jsx
index f21e0f257..891df3a1e 100644
--- a/components/calendar/index.jsx
+++ b/components/calendar/index.jsx
@@ -41,7 +41,7 @@ export const CalendarProps = () => ({
// monthCellRender: PropTypes.func,
// dateFullCellRender: PropTypes.func,
// monthFullCellRender: PropTypes.func,
- locale: PropTypes.any,
+ locale: PropTypes.object,
// onPanelChange?: (date?: moment.Moment, mode?: CalendarMode) => void;
// onSelect?: (date?: moment.Moment) => void;
disabledDate: PropTypes.func,
@@ -226,13 +226,24 @@ const Calendar = {
)
},
+ getDefaultLocale () {
+ const result = {
+ ...enUS,
+ ...this.$props.locale,
+ }
+ result.lang = {
+ ...result.lang,
+ ...(this.$props.locale || {}).lang,
+ }
+ return result
+ },
},
render () {
return (