You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.5 KiB
37 lines
1.5 KiB
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
|
|
});
|
|
})));
|
|
} |