import { __assign, __extends } from "tslib";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import BaseTabsNav from '../base/BaseTabsNav';
import OperationTabs from './OperationTabs';
import cn from 'classnames';
import { commonTransformTabData, getFixedProps } from '../../utils';
var CommonTabsNav = (function (_super) {
    __extends(CommonTabsNav, _super);
    function CommonTabsNav() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.onTabDel = function (id) {
            var onDelete = _this.props.onDelete;
            onDelete(id);
        };
        return _this;
    }
    Object.defineProperty(CommonTabsNav.prototype, "tabsNavCls", {
        get: function () {
            var _a;
            var _b = this.props, stretch = _b.stretch, className = _b.className;
            return cn('zent-tabs-nav', "zent-tabs-nav-type__" + this.typeName, className, (_a = {},
                _a['zent-tabs-nav__stretch'] = stretch,
                _a));
        },
        enumerable: false,
        configurable: true
    });
    CommonTabsNav.prototype.renderNavExtraContent = function () {
        var navExtraContent = this.props.navExtraContent;
        return navExtraContent ? (_jsx("div", __assign({ className: "zent-tabs-nav-extra-content", "data-zv": 'v10.0.11' }, { children: navExtraContent }), void 0)) : null;
    };
    CommonTabsNav.prototype.transformTabDataList = function (tabDataList) {
        var _this = this;
        var candel = this.props.candel;
        return tabDataList.map(function (tabItem) {
            return commonTransformTabData(tabItem, candel, getFixedProps(_this.props));
        });
    };
    CommonTabsNav.prototype.render = function () {
        var navExtraContent = this.renderNavExtraContent();
        var _a = this.props, tabDataList = _a.tabDataList, overflowMode = _a.overflowMode, onChange = _a.onChange, onAdd = _a.onAdd, type = _a.type, activeId = _a.activeId, style = _a.style;
        var tabs = this.renderTabs();
        var isOperationTabs = (overflowMode && (type === 'normal' || type === 'card')) || onAdd;
        return (_jsxs("div", __assign({ className: this.tabsNavCls, style: style, "data-zv": 'v10.0.11' }, { children: [isOperationTabs ? (_jsx(OperationTabs, { overflowMode: overflowMode, onChange: onChange, onAdd: onAdd, tabDataList: tabDataList, tabs: tabs, activeId: activeId }, void 0)) : (_jsx("div", __assign({ className: "zent-tabs-nav-content", "data-zv": 'v10.0.11' }, { children: _jsx("div", __assign({ className: "zent-tabs-scroll", role: "tablist", "data-zv": 'v10.0.11' }, { children: tabs }), void 0) }), void 0)), navExtraContent] }), void 0));
    };
    return CommonTabsNav;
}(BaseTabsNav));
export default CommonTabsNav;
