UNPKG

1.95 kBJavaScriptView Raw
1import _extends from 'babel-runtime/helpers/extends';
2import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
3import ConfigProvider from '../config-provider';
4import Tab from './tab';
5import Item from './tabs/tab-item';
6
7Tab.Item = Item;
8
9Tab.TabPane = ConfigProvider.config(Item, {
10 transform: function transform(props, deprecated) {
11 deprecated('Tab.TabPane', 'Tab.Item', 'Tab');
12 return props;
13 }
14});
15
16export default ConfigProvider.config(Tab, {
17 transform: /* istanbul ignore next */function transform(props, deprecated) {
18 if ('type' in props) {
19 deprecated('type', 'shape', 'Tab');
20
21 var _props = props,
22 type = _props.type,
23 others = _objectWithoutProperties(_props, ['type']);
24
25 props = _extends({ shape: type }, others);
26 }
27 if ('resDirection' in props) {
28 var _props2 = props,
29 resDirection = _props2.resDirection,
30 _others = _objectWithoutProperties(_props2, ['resDirection']);
31
32 var excessMode = void 0;
33 if (resDirection === 'horizontal') {
34 deprecated('resDirection=horizontal', 'excessMode=slide', 'Tab');
35
36 excessMode = 'slide';
37 } else if (resDirection === 'vertical') {
38 deprecated('resDirection=vertical', 'excessMode=dropdown', 'Tab');
39
40 excessMode = 'dropdown';
41 }
42 props = _extends({ excessMode: excessMode }, _others);
43 }
44 if ('tabBarExtraContent' in props) {
45 deprecated('tabBarExtraContent', 'extra', 'Tab');
46
47 var _props3 = props,
48 tabBarExtraContent = _props3.tabBarExtraContent,
49 _others2 = _objectWithoutProperties(_props3, ['tabBarExtraContent']);
50
51 props = _extends({ extra: tabBarExtraContent }, _others2);
52 }
53
54 return props;
55 }
56});
\No newline at end of file