From d24a647392f4d9bdd18eb892410f9f267dfa8371 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Tue, 21 Mar 2017 23:42:16 +0800 Subject: [PATCH] feat: Tabs[onNextClick] Tabs[onPrevClick], close: #4395 (#5412) --- components/tabs/index.en-US.md | 2 ++ components/tabs/index.tsx | 9 +++++++-- components/tabs/index.zh-CN.md | 2 ++ package.json | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/components/tabs/index.en-US.md b/components/tabs/index.en-US.md index b110599aa9..14d1f0eead 100644 --- a/components/tabs/index.en-US.md +++ b/components/tabs/index.en-US.md @@ -24,6 +24,8 @@ Ant Design has 3 types Tabs for different situation. | defaultActiveKey | Default actived tabPanel's key, if activeKey is not setted. | - | | onChange | Callback when tab is switched | Function | - | | onTabClick | Callback when tab is clicked | Function | - | +| onPrevClick | Callback when prev button is clicked | Function | 无 | +| onNextClick | Callback when next button is clicked | Function | 无 | | tabBarExtraContent | Extra element in tab bar | React.ReactNode | - | | tabBarStyle | tar bar style object | object | - | | type | Basic style of tabs. Options: line, card & editable-card | string | line | diff --git a/components/tabs/index.tsx b/components/tabs/index.tsx index 85d90d8318..d523a2b397 100755 --- a/components/tabs/index.tsx +++ b/components/tabs/index.tsx @@ -1,5 +1,4 @@ -import React from 'react'; -import { cloneElement } from 'react'; +import React, { cloneElement } from 'react'; import { findDOMNode } from 'react-dom'; import RcTabs, { TabPane } from 'rc-tabs'; import ScrollableInkTabBar from 'rc-tabs/lib/ScrollableInkTabBar'; @@ -18,6 +17,8 @@ export interface TabsProps { hideAdd?: boolean; onChange?: (activeKey: string) => void; onTabClick?: Function; + onPrevClick?: (e) => void; + onNextClick?: (e) => void; tabBarExtraContent?: React.ReactNode | null; tabBarStyle?: React.CSSProperties; type?: TabsType; @@ -95,6 +96,8 @@ export default class Tabs extends React.Component { tabBarStyle, hideAdd, onTabClick, + onPrevClick, + onNextClick, animated, } = this.props; warning( @@ -152,6 +155,8 @@ export default class Tabs extends React.Component { ); diff --git a/components/tabs/index.zh-CN.md b/components/tabs/index.zh-CN.md index e5382eb326..8a31d8c9f4 100644 --- a/components/tabs/index.zh-CN.md +++ b/components/tabs/index.zh-CN.md @@ -27,6 +27,8 @@ Ant Design 依次提供了三级选项卡,分别用于不同的场景。 | defaultActiveKey | 初始化选中面板的 key,如果没有设置 activeKey | string | 第一个面板 | | onChange | 切换面板的回调 | Function | 无 | | onTabClick | tab 被点击的回调 | Function | 无 | +| onPrevClick | prev 按钮被点击的回调 | Function | 无 | +| onNextClick | next 按钮被点击的回调 | Function | 无 | | tabBarExtraContent | tab bar 上额外的元素 | React.ReactNode | 无 | | tabBarStyle | tar bar 的样式对象 | object | - | | type | 页签的基本样式,可选 `line`、`card` `editable-card` 类型 | string | 'line' | diff --git a/package.json b/package.json index 0b52a1f278..930f34526f 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "rc-steps": "~2.4.0", "rc-switch": "~1.4.2", "rc-table": "~5.2.13", - "rc-tabs": "~7.2.0", + "rc-tabs": "~7.3.0", "rc-time-picker": "~2.2.1", "rc-tooltip": "~3.4.2", "rc-tree": "~1.4.0",