update vc-tabs

pull/9/head
tjz 2018-04-07 18:52:02 +08:00
parent b7027ca779
commit 4ab5cf70d8
16 changed files with 26 additions and 9 deletions

View File

@ -1,6 +1,6 @@
import Tabs from './tabs' import Tabs from './tabs'
import TabPane from './src/TabPane' import TabPane from '../vc-tabs/src/TabPane'
import TabContent from './src/TabContent' import TabContent from '../vc-tabs/src/TabContent'
Tabs.TabPane = TabPane Tabs.TabPane = TabPane
export default Tabs export default Tabs
export { TabPane, TabContent } export { TabPane, TabContent }

View File

@ -1,5 +1,5 @@
import Tabs from './src/Tabs' import Tabs from '../vc-tabs/src/Tabs'
import isFlexSupported from '../_util/isFlexSupported' import isFlexSupported from '../_util/isFlexSupported'
import { hasProp, getComponentFromProp, getComponentName, isEmptyElement } from '../_util/props-util' import { hasProp, getComponentFromProp, getComponentName, isEmptyElement } from '../_util/props-util'
import warning from '../_util/warning' import warning from '../_util/warning'

View File

@ -93,6 +93,20 @@ export default {
newState.statePageSize = val newState.statePageSize = val
this.setState(newState) this.setState(newState)
}, },
stateCurrent(val, oldValue) {
// When current page change, fix focused style of prev item
// A hacky solution of https://github.com/ant-design/ant-design/issues/8948
this.$nextTick(()=>{
if(this.$refs.paginationNode) {
const lastCurrentNode = this.$refs.paginationNode.querySelector(
`.${this.prefixCls}-item-${oldValue}`
);
if (lastCurrentNode && document.activeElement === lastCurrentNode) {
lastCurrentNode.blur();
}
}
})
},
}, },
methods: { methods: {
isValid (page) { isValid (page) {
@ -494,6 +508,7 @@ export default {
<ul <ul
class={`${prefixCls}`} class={`${prefixCls}`}
unselectable='unselectable' unselectable='unselectable'
ref='paginationNode'
> >
{totalText} {totalText}
<li <li

View File

@ -1,3 +1,4 @@
// base rc-table 6.1.7 7cd6abab4a2bd55adc7a9207c23feb62c3cd015b
import T from './src/Table' import T from './src/Table'
import Column from './src/Column' import Column from './src/Column'
import ColumnGroup from './src/ColumnGroup' import ColumnGroup from './src/ColumnGroup'

View File

@ -36,7 +36,8 @@ function offset (elem) {
function componentDidUpdate (component, init) { function componentDidUpdate (component, init) {
const { styles = {}} = component.$props const { styles = {}} = component.$props
const wrapNode = component.$refs.nav || component.$refs.root const rootNode = component.$refs.root
const wrapNode = component.$refs.nav || rootNode
const containerOffset = offset(wrapNode) const containerOffset = offset(wrapNode)
const inkBarNode = component.$refs.inkBar const inkBarNode = component.$refs.inkBar
const activeTab = component.$refs.activeTab const activeTab = component.$refs.activeTab
@ -57,7 +58,7 @@ function componentDidUpdate (component, init) {
// If tabNode'width width equal to wrapNode'width when tabBarPosition is top or bottom // If tabNode'width width equal to wrapNode'width when tabBarPosition is top or bottom
// It means no css working, then ink bar should not have width until css is loaded // It means no css working, then ink bar should not have width until css is loaded
// Fix https://github.com/ant-design/ant-design/issues/7564 // Fix https://github.com/ant-design/ant-design/issues/7564
if (width === wrapNode.offsetWidth) { if (width === rootNode.offsetWidth) {
width = 0 width = 0
} else if (styles.inkBar && styles.inkBar.width !== undefined) { } else if (styles.inkBar && styles.inkBar.width !== undefined) {
width = parseFloat(styles.inkBar.width, 10) width = parseFloat(styles.inkBar.width, 10)

View File

@ -43,8 +43,8 @@ export default {
cls += ` ${prefixCls}-tab-disabled` cls += ` ${prefixCls}-tab-disabled`
} else { } else {
} }
const onClick = () => { const onClick = (e) => {
!disabled && this.__emit('tabClick', tabKey) !disabled && this.__emit('tabClick', tabKey, e)
} }
let tabC = typeof tab === 'function' ? child.tab(h) : tab let tabC = typeof tab === 'function' ? child.tab(h) : tab

View File

@ -89,8 +89,8 @@ export default {
} }
return activeKey return activeKey
}, },
handleTabClick (activeKey) { handleTabClick (activeKey,e) {
this.__emit('tabClick', activeKey) this.__emit('tabClick', activeKey, e)
this.setActiveKey(activeKey) this.setActiveKey(activeKey)
}, },