Skip to content

Commit daa5322

Browse files
committed
Merge branch 'feat-3.10.3'
# Conflicts: # components/locale-provider/__tests__/__snapshots__/index.test.js.snap
2 parents 31581dc + 97b524f commit daa5322

File tree

584 files changed

+26067
-17562
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

584 files changed

+26067
-17562
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules/
22
**/*.spec.*
33
**/style/
44
*.html
5+
/components/test/*

CHANGELOG.en-US.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,40 @@
22

33
---
44

5+
## 1.2.0
6+
`2018-12-16`
7+
### Synchronize with antd 3.10.x
8+
9+
- 🔥🔥🔥 replaced font icons with svg icons which bring benefits below::
10+
- Complete offline usage of icon, no dependency of alipay cdn font icon file and no more empty square during downloading than no need to deploy icon font files locally either.
11+
- Much more display accuracy in lower-level screens.
12+
- Support multiple colors for icon.
13+
- No need to change built-in icons with overriding styles by providing more props in component.
14+
- 🌟 Add the `theme` attribute to set the theme style of the icon.
15+
- 🌟 Added `component` attribute, you can externally pass a component to customize the control rendering result.
16+
- 🌟 The `twoToneColor` property is added to control the theme color of the two-color icon.
17+
- 🌟 Added static methods `Icon.getTowToneColor()` and `Icon.setTwoToneColor(...)` to globally get and set the theme color of all two-color icons.
18+
- 🌟 The new static method `Icon.createFromIconfontCN({...})` is added to make it easier to use icons hosted on [`iconfont.cn`](http://iconfont.cn/).
19+
- 🔥 Added a new component `Skeleton`.
20+
- 🔥 Menu will automatically close up to fit width in `horizontal` mode.
21+
- 🔥 The `placement` of the drawer supports `top` and `bottom` to accommodate more scenes.
22+
- 🌟 The following components add a `suffixIcon` prop, which is used to set the icon behind the input box. For details, please refer to the documentation.
23+
- Cascader
24+
- DatePicker
25+
- Select
26+
- TreeSelect
27+
- TimePicker
28+
- 🌟 Added Modal.open for optional icon dialog.
29+
- 🌟 Modal.info adds the configuration of `getContainer`.
30+
- 🌟 Improve RangePicker footer UI by merging them.
31+
- 🌟 The Anchor component adds `onClick` property.
32+
- 🌟 The Tab component adds the `renderTabBar` property.
33+
- 🌟 The Input component adds the `select` method.
34+
- 🌟 Steps adds the `initial` attribute.
35+
- 🌟 Upload adds `openFileDialogOnClick` prop to allow setting whether to open the upload dialog when the component is clicked.
36+
- 🌟 InputNumber adds `decimalSeparator` prop to allow setting a custom decimal.
37+
- 🐞 Fix a lot of hidden bugs that have not yet been issued, and then not list them one by one.
38+
539
## 1.1.10
640

741
`2018-12-7`

CHANGELOG.zh-CN.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,40 @@
22

33
---
44

5+
## 1.2.0
6+
`2018-12-16`
7+
### 与antd 3.10.x同步
8+
9+
- 🔥🔥🔥 使用了 svg 图标替换了原先的 font 图标,从而带来了以下优势:
10+
可以离线化使用,不需要从支付宝 cdn 下载字体文件,图标不会因为网络问题呈现方块,也无需字体文件本地部署。
11+
在低端设备上 svg 有更好的清晰度。
12+
支持多色图标。
13+
对于内建图标的更换可以提供更多 API,而不需要进行样式覆盖。
14+
- 🌟 新增 `theme` 属性,可以设置图标的主题风格。
15+
- 🌟 新增 `component` 属性,可以外部传入一个组件来自定义控制渲染结果。
16+
- 🌟 新增 `twoToneColor` 属性,可以控制双色图标的主题色。
17+
- 🌟 新增静态方法 `Icon.getTowToneColor()``Icon.setTwoToneColor(...)`,可以全局性的获取和设置所有双色图标的主题色。
18+
- 🌟 新增静态方法 `Icon.createFromIconfontCN({...})`,可以更加方便地使用 [`iconfont.cn`](http://iconfont.cn/) 上托管的图标。
19+
- 🔥 增加了一个新组件`Skeleton`
20+
- 🔥 Menu 在 `horizontal` 模式下会自动收起来适应宽度。
21+
- 🔥 Drawer 的 `placement` 支持 `top``bottom`,可以适应更多场景。
22+
- 🌟 以下组件均新增了 `suffixIcon` 属性,用于设置输入框后面的图标,具体用法可以参考文档。
23+
- Cascader
24+
- DatePicker
25+
- Select
26+
- TreeSelect
27+
- TimePicker
28+
- 🌟 新增 Modal.open 方法,用于可自定义图标的快捷对话框。
29+
- 🌟 Modal.info 增加 `getContainer` 的配置。
30+
- 🌟 合并优化了 RangePicker 的日历页脚 UI。
31+
- 🌟 Anchor 组件增加 `click` 事件。
32+
- 🌟 Tab 组件增加 `renderTabBar` 属性。
33+
- 🌟 Input 组件增加 `select` 方法。
34+
- 🌟 Steps 增加 `initial` 属性。
35+
- 🌟 Upload 组件新增 `openFileDialogOnClick` 属性,用于设置点击组件时是否打开上传对话框。
36+
- 🌟 InputNumber 组件新增 `decimalSeparator` 属性,用于设置自定义的小数点。
37+
- 🐞 修复众多隐蔽暂未提issue的bug,再此不在一一列出
38+
539
## 1.1.10
640

741
`2018-12-7`
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
export function antDecorator (Vue) {
2+
return Vue.directive('decorator', {
3+
})
4+
}
5+
16
export default {
27
// just for tag
38
install: (Vue, options) => {
4-
Vue.directive('decorator', {
5-
})
9+
antDecorator(Vue)
610
},
711
}

components/_util/antDirective.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { antInput } from './antInputDirective'
2+
import { antDecorator } from './FormDecoratorDirective'
3+
4+
export default {
5+
install: (Vue, options) => {
6+
antInput(Vue)
7+
antDecorator(Vue)
8+
},
9+
}

components/_util/antInputDirective.js

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,30 @@ if (isIE9) {
4949
})
5050
}
5151

52-
export default {
53-
install: (Vue, options) => {
54-
Vue.directive('ant-input', {
55-
inserted (el, binding, vnode, oldVnode) {
56-
if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
57-
if (!binding.modifiers || !binding.modifiers.lazy) {
58-
el.addEventListener('compositionstart', onCompositionStart)
59-
el.addEventListener('compositionend', onCompositionEnd)
60-
// Safari < 10.2 & UIWebView doesn't fire compositionend when
61-
// switching focus before confirming composition choice
62-
// this also fixes the issue where some browsers e.g. iOS Chrome
63-
// fires "change" instead of "input" on autocomplete.
64-
el.addEventListener('change', onCompositionEnd)
65-
/* istanbul ignore if */
66-
if (isIE9) {
67-
el.vmodel = true
68-
}
52+
export function antInput (Vue) {
53+
return Vue.directive('ant-input', {
54+
inserted (el, binding, vnode, oldVnode) {
55+
if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
56+
if (!binding.modifiers || !binding.modifiers.lazy) {
57+
el.addEventListener('compositionstart', onCompositionStart)
58+
el.addEventListener('compositionend', onCompositionEnd)
59+
// Safari < 10.2 & UIWebView doesn't fire compositionend when
60+
// switching focus before confirming composition choice
61+
// this also fixes the issue where some browsers e.g. iOS Chrome
62+
// fires "change" instead of "input" on autocomplete.
63+
el.addEventListener('change', onCompositionEnd)
64+
/* istanbul ignore if */
65+
if (isIE9) {
66+
el.vmodel = true
6967
}
7068
}
71-
},
72-
})
69+
}
70+
},
71+
})
72+
}
73+
74+
export default {
75+
install: (Vue, options) => {
76+
antInput(Vue)
7377
},
7478
}

components/_util/antRefDirective.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

components/_util/css-animation/Event.js

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1-
const EVENT_NAME_MAP = {
1+
const START_EVENT_NAME_MAP = {
2+
transitionstart: {
3+
transition: 'transitionstart',
4+
WebkitTransition: 'webkitTransitionStart',
5+
MozTransition: 'mozTransitionStart',
6+
OTransition: 'oTransitionStart',
7+
msTransition: 'MSTransitionStart',
8+
},
9+
10+
animationstart: {
11+
animation: 'animationstart',
12+
WebkitAnimation: 'webkitAnimationStart',
13+
MozAnimation: 'mozAnimationStart',
14+
OAnimation: 'oAnimationStart',
15+
msAnimation: 'MSAnimationStart',
16+
},
17+
}
18+
19+
const END_EVENT_NAME_MAP = {
220
transitionend: {
321
transition: 'transitionend',
422
WebkitTransition: 'webkitTransitionEnd',
@@ -16,31 +34,39 @@ const EVENT_NAME_MAP = {
1634
},
1735
}
1836

37+
const startEvents = []
1938
const endEvents = []
2039

2140
function detectEvents () {
2241
const testEl = document.createElement('div')
2342
const style = testEl.style
2443

2544
if (!('AnimationEvent' in window)) {
26-
delete EVENT_NAME_MAP.animationend.animation
45+
delete START_EVENT_NAME_MAP.animationstart.animation
46+
delete END_EVENT_NAME_MAP.animationend.animation
2747
}
2848

2949
if (!('TransitionEvent' in window)) {
30-
delete EVENT_NAME_MAP.transitionend.transition
50+
delete START_EVENT_NAME_MAP.transitionstart.transition
51+
delete END_EVENT_NAME_MAP.transitionend.transition
3152
}
3253

33-
for (const baseEventName in EVENT_NAME_MAP) {
34-
if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
35-
const baseEvents = EVENT_NAME_MAP[baseEventName]
36-
for (const styleName in baseEvents) {
37-
if (styleName in style) {
38-
endEvents.push(baseEvents[styleName])
39-
break
54+
function process (EVENT_NAME_MAP, events) {
55+
for (const baseEventName in EVENT_NAME_MAP) {
56+
if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
57+
const baseEvents = EVENT_NAME_MAP[baseEventName]
58+
for (const styleName in baseEvents) {
59+
if (styleName in style) {
60+
events.push(baseEvents[styleName])
61+
break
62+
}
4063
}
4164
}
4265
}
4366
}
67+
68+
process(START_EVENT_NAME_MAP, startEvents)
69+
process(END_EVENT_NAME_MAP, endEvents)
4470
}
4571

4672
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
@@ -56,6 +82,31 @@ function removeEventListener (node, eventName, eventListener) {
5682
}
5783

5884
const TransitionEvents = {
85+
// Start events
86+
startEvents,
87+
88+
addStartEventListener (node, eventListener) {
89+
if (startEvents.length === 0) {
90+
window.setTimeout(eventListener, 0)
91+
return
92+
}
93+
startEvents.forEach((startEvent) => {
94+
addEventListener(node, startEvent, eventListener)
95+
})
96+
},
97+
98+
removeStartEventListener (node, eventListener) {
99+
if (startEvents.length === 0) {
100+
return
101+
}
102+
startEvents.forEach((startEvent) => {
103+
removeEventListener(node, startEvent, eventListener)
104+
})
105+
},
106+
107+
// End events
108+
endEvents,
109+
59110
addEndEventListener (node, eventListener) {
60111
if (endEvents.length === 0) {
61112
window.setTimeout(eventListener, 0)
@@ -66,8 +117,6 @@ const TransitionEvents = {
66117
})
67118
},
68119

69-
endEvents,
70-
71120
removeEndEventListener (node, eventListener) {
72121
if (endEvents.length === 0) {
73122
return
@@ -79,4 +128,3 @@ const TransitionEvents = {
79128
}
80129

81130
export default TransitionEvents
82-

components/_util/css-animation/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// https://github.com/yiminghe/css-animation 1.5.0
2+
13
import Event from './Event'
24
import classes from 'component-classes'
35
import { requestAnimationTimeout, cancelAnimationTimeout } from '../requestAnimationTimeout'

components/_util/props-util.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,22 @@ const getOptionProps = (instance) => {
9595
return filterProps($props, $options.propsData)
9696
}
9797

98-
const getComponentFromProp = (instance, prop) => {
98+
const getComponentFromProp = (instance, prop, options = instance, execute = true) => {
9999
if (instance.$createElement) {
100100
const h = instance.$createElement
101101
const temp = instance[prop]
102102
if (temp !== undefined) {
103-
return typeof temp === 'function' ? temp(h) : temp
103+
return typeof temp === 'function' && execute ? temp(h, options) : temp
104104
}
105-
return instance.$slots[prop]
105+
return instance.$slots[prop] ||
106+
(instance.$scopedSlots[prop] && execute && instance.$scopedSlots[prop](options)) ||
107+
(instance.$scopedSlots[prop] && instance.$scopedSlots[prop]) ||
108+
undefined
106109
} else {
107110
const h = instance.context.$createElement
108111
const temp = getPropsData(instance)[prop]
109112
if (temp !== undefined) {
110-
return typeof temp === 'function' ? temp(h) : temp
113+
return typeof temp === 'function' && execute ? temp(h, options) : temp
111114
}
112115
const slotsProp = []
113116
const componentOptions = instance.componentOptions || {};
@@ -231,7 +234,7 @@ const initDefaultProps = (propTypes, defaultProps) => {
231234
export function mergeProps () {
232235
const args = [].slice.call(arguments, 0)
233236
const props = {}
234-
args.forEach((p, i) => {
237+
args.forEach((p = {}, i) => {
235238
for (const [k, v] of Object.entries(p)) {
236239
props[k] = props[k] || {}
237240
if (isPlainObject(v)) {

0 commit comments

Comments
 (0)