index.js
1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import * as React from 'react';
import classNames from 'classnames';
import TabContext from '../TabContext';
export default function TabPanelList(_ref) {
var id = _ref.id,
activeKey = _ref.activeKey,
animated = _ref.animated,
tabPosition = _ref.tabPosition,
rtl = _ref.rtl,
destroyInactiveTabPane = _ref.destroyInactiveTabPane;
var _React$useContext = React.useContext(TabContext),
prefixCls = _React$useContext.prefixCls,
tabs = _React$useContext.tabs;
var tabPaneAnimated = animated.tabPane;
var activeIndex = tabs.findIndex(function (tab) {
return tab.key === activeKey;
});
return /*#__PURE__*/React.createElement("div", {
className: classNames("".concat(prefixCls, "-content-holder"))
}, /*#__PURE__*/React.createElement("div", {
className: classNames("".concat(prefixCls, "-content"), "".concat(prefixCls, "-content-").concat(tabPosition), _defineProperty({}, "".concat(prefixCls, "-content-animated"), tabPaneAnimated)),
style: activeIndex && tabPaneAnimated ? _defineProperty({}, rtl ? 'marginRight' : 'marginLeft', "-".concat(activeIndex, "00%")) : null
}, tabs.map(function (tab) {
return /*#__PURE__*/React.cloneElement(tab.node, {
key: tab.key,
prefixCls: prefixCls,
tabKey: tab.key,
id: id,
animated: tabPaneAnimated,
active: tab.key === activeKey,
destroyInactiveTabPane: destroyInactiveTabPane
});
})));
}