Skip to content

Commit 5b55bac

Browse files
authored
update to antd3.8.3 (#159)
* refactor: align * feat: update align to 2.4.3 * feat: update trigger 2.5.4 * feat: update tooltip 3.7.2 * fix: align * feat: update vc-calendar to 9.6.2 * feat: update vc-checkbox to 2.1.5 * feat: update vc-dialog to 7.1.8 * feat: update vc-from to 2.2.1 * feat: update vc-notification to 3.1.1 * test: update snapshots * feat: update vc-tree to 1.12.6 * feat: update vc-table to 6.2.8 * feat: update vc-upload to 2.5.1 * feat: update vc-input-number to 4.0.12 * feat: update vc-tabs to 9.2.6 * refactor: vc-menu * refactor: update vc-menu to 7.0.5 * style: remove unused * feat: update pagination to 1.16.5 * feat: add vc-progress 2.2.5 tag * feat: add vc-rate 2.4.0 tag * feat: update vc-slider to 8.6.1 * fix: tooltip error * style: delete conosle * feat: update vc-steps to 3.1.1 * add vc-switch tag 1.6.0 * feat: update upload to 2.5.1 * fix: update vc-menu * fix: update store * fix: add ref dir * fix: trigger mock shouldComponentUpdate * fix: update vc-select * revert: trigger lazyrenderbox * fix: update vc-select * fix: update vc-select * fix: update vc-select * fix: update vc-menu * fix: update vc-slick ref * update style to 3.8.2 * test: update snapshots * update vc-select * update util & affix * feat: add drawer * fix: support title add slot mode * test: update affix test * update alert * update anchor * update snapshots * fix: doc and vc-drawer * update select & auto-complete * update back-top & grid * feractor: avatar * test: add drawer test * update badge * update button * update card * update divider * feat: update vc-tabs to 9.3.6 and tabs * add afterEnter callback * update form * fix: update drawer * test: update snapshots * update modal & notification * test: update snapshots * update message * update locale-provider * update dropdown * update layout popconfirm popover * update time-picker * update menu * update date-picker * docs: update input docs * update input * update snapshots * update table * update test snapshots * feat: update progress * update checkbox * feat: update spin * update radio * docs: slider steps timeline * update list * update transfer * update collapse * update cascader * update upload
1 parent 0b31163 commit 5b55bac

File tree

602 files changed

+16181
-8206
lines changed

Some content is hidden

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

602 files changed

+16181
-8206
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
22
**/*.spec.*
3+
**/style/

components/_util/BaseMixin.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
1+
import { getOptionProps } from './props-util'
2+
13
export default {
4+
directives: {
5+
ref: {
6+
bind: function (el, binding, vnode) {
7+
binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm)
8+
},
9+
update: function (el, binding, vnode) {
10+
binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm)
11+
},
12+
unbind: function (el, binding, vnode) {
13+
binding.value(null)
14+
},
15+
},
16+
},
217
methods: {
318
setState (state, callback) {
4-
Object.assign(this.$data, typeof state === 'function' ? state(this.$data) : state)
19+
const newState = typeof state === 'function' ? state(this.$data) : state
20+
if (this.getDerivedStateFromProps) {
21+
Object.assign(newState, this.getDerivedStateFromProps(getOptionProps(this), this.$data, true) || {})
22+
}
23+
Object.assign(this.$data, newState)
524
this.$nextTick(() => {
625
callback && callback()
726
})

components/_util/antRefDirective.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ export default {
22
install: (Vue, options) => {
33
Vue.directive('ant-ref', {
44
bind: function (el, binding, vnode) {
5-
binding.value(vnode)
5+
binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm)
66
},
77
update: function (el, binding, vnode) {
8-
binding.value(vnode)
8+
binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm)
99
},
1010
unbind: function (el, binding, vnode) {
1111
binding.value(null)

components/_util/getTransitionProps.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import animate from './css-animation'
22
const noop = () => {}
33
const getTransitionProps = (transitionName, opt = {}) => {
4-
const { beforeEnter, enter, leave, afterLeave, appear = true, tag } = opt
4+
const { beforeEnter, enter, afterEnter, leave, afterLeave, appear = true, tag } = opt
55
const transitionProps = {
66
props: {
77
appear,
@@ -12,6 +12,7 @@ const getTransitionProps = (transitionName, opt = {}) => {
1212
enter: enter || ((el, done) => {
1313
animate(el, `${transitionName}-enter`, done)
1414
}),
15+
afterEnter: afterEnter || noop,
1516
leave: leave || ((el, done) => {
1617
animate(el, `${transitionName}-leave`, done)
1718
}),

components/_util/isNumeric.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const isNumeric = (value) => {
2+
return !isNaN(parseFloat(value)) && isFinite(value)
3+
}
4+
export default isNumeric

components/_util/openAnimation.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import cssAnimation from './css-animation'
2-
import getRequestAnimationFrame, { cancelRequestAnimationFrame } from './getRequestAnimationFrame'
3-
4-
const reqAnimFrame = getRequestAnimationFrame()
2+
import raf from 'raf'
53

64
function animate (node, show, done) {
75
let height
@@ -19,16 +17,16 @@ function animate (node, show, done) {
1917
},
2018
active () {
2119
if (requestAnimationFrameId) {
22-
cancelRequestAnimationFrame(requestAnimationFrameId)
20+
raf.cancel(requestAnimationFrameId)
2321
}
24-
requestAnimationFrameId = reqAnimFrame(() => {
22+
requestAnimationFrameId = raf(() => {
2523
node.style.height = `${show ? height : 0}px`
2624
node.style.opacity = show ? 1 : 0
2725
})
2826
},
2927
end () {
3028
if (requestAnimationFrameId) {
31-
cancelRequestAnimationFrame(requestAnimationFrameId)
29+
raf.cancel(requestAnimationFrameId)
3230
}
3331
node.style.height = ''
3432
node.style.opacity = ''

components/_util/proxyComponent.jsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
import PropTypes from './vue-types'
3+
import { getOptionProps } from './props-util'
4+
5+
function getDisplayName (WrappedComponent) {
6+
return WrappedComponent.name || 'Component'
7+
}
8+
export default function wrapWithConnect (WrappedComponent) {
9+
const tempProps = WrappedComponent.props || {}
10+
const methods = WrappedComponent.methods || {}
11+
const props = {}
12+
Object.keys(tempProps).forEach(k => { props[k] = PropTypes.any })
13+
WrappedComponent.props.__propsSymbol__ = PropTypes.any
14+
WrappedComponent.props.children = PropTypes.array.def([])
15+
const ProxyWrappedComponent = {
16+
props,
17+
model: WrappedComponent.model,
18+
name: `Proxy_${getDisplayName(WrappedComponent)}`,
19+
methods: {
20+
getProxyWrappedInstance () {
21+
return this.$refs.wrappedInstance
22+
},
23+
},
24+
render () {
25+
const { $listeners, $slots = {}, $attrs } = this
26+
const props = getOptionProps(this)
27+
const wrapProps = {
28+
props: {
29+
...props,
30+
__propsSymbol__: Symbol(),
31+
children: $slots.default || [],
32+
},
33+
on: $listeners,
34+
attrs: $attrs,
35+
}
36+
return (
37+
<WrappedComponent {...wrapProps} ref='wrappedInstance'/>
38+
)
39+
},
40+
}
41+
Object.keys(methods).map(m => {
42+
ProxyWrappedComponent.methods[m] = function () {
43+
this.getProxyWrappedInstance()[m](...arguments)
44+
}
45+
})
46+
return ProxyWrappedComponent
47+
}

components/_util/store/Provider.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
},
88
provide () {
99
return {
10-
_store: this.$props,
10+
storeContext: this.$props,
1111
}
1212
},
1313
render () {

components/_util/store/connect.jsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ export default function connect (mapStateToProps) {
1919
name: `Connect_${getDisplayName(WrappedComponent)}`,
2020
props,
2121
inject: {
22-
_store: { default: {}},
22+
storeContext: { default: {}},
2323
},
2424
data () {
25-
this.store = this._store.store
25+
this.store = this.storeContext.store
2626
return {
2727
subscribed: finnalMapStateToProps(this.store.getState(), this.$props),
2828
}
29+
},
30+
watch: {
31+
2932
},
3033
mounted () {
3134
this.trySubscribe()
@@ -41,8 +44,7 @@ export default function connect (mapStateToProps) {
4144
}
4245

4346
const nextState = finnalMapStateToProps(this.store.getState(), this.$props)
44-
if (!shallowEqual(this.nextState, nextState)) {
45-
this.nextState = nextState
47+
if (!shallowEqual(this.subscribed, nextState)) {
4648
this.subscribed = nextState
4749
}
4850
},
@@ -60,9 +62,12 @@ export default function connect (mapStateToProps) {
6062
this.unsubscribe = null
6163
}
6264
},
65+
getWrappedInstance () {
66+
return this.$refs.wrappedInstance
67+
},
6368
},
6469
render () {
65-
const { $listeners, $slots, $attrs, $scopedSlots, subscribed, store } = this
70+
const { $listeners, $slots = {}, $attrs, $scopedSlots, subscribed, store } = this
6671
const props = getOptionProps(this)
6772
const wrapProps = {
6873
props: {
@@ -72,11 +77,14 @@ export default function connect (mapStateToProps) {
7277
},
7378
on: $listeners,
7479
attrs: $attrs,
75-
slots: $slots,
7680
scopedSlots: $scopedSlots,
7781
}
7882
return (
79-
<WrappedComponent {...wrapProps}/>
83+
<WrappedComponent {...wrapProps} ref='wrappedInstance'>
84+
{Object.keys($slots).map(name => {
85+
return <template slot={name}>{$slots[name]}</template>
86+
})}
87+
</WrappedComponent>
8088
)
8189
},
8290
}

components/_util/throttleByAnimationFrame.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import getRequestAnimationFrame, { cancelRequestAnimationFrame } from '../_util/getRequestAnimationFrame'
2-
3-
const reqAnimFrame = getRequestAnimationFrame()
1+
import raf from 'raf'
42

53
export default function throttleByAnimationFrame (fn) {
64
let requestId
@@ -12,11 +10,11 @@ export default function throttleByAnimationFrame (fn) {
1210

1311
const throttled = (...args) => {
1412
if (requestId == null) {
15-
requestId = reqAnimFrame(later(args))
13+
requestId = raf(later(args))
1614
}
1715
}
1816

19-
throttled.cancel = () => cancelRequestAnimationFrame(requestId)
17+
throttled.cancel = () => raf.cancel(requestId)
2018

2119
return throttled
2220
}

0 commit comments

Comments
 (0)