UNPKG

zent

Version:

一套前端设计语言和基于React的实现

43 lines (42 loc) 1.63 kB
import { __assign, __extends } from "tslib"; import { jsx as _jsx } from "react/jsx-runtime"; import CardTab from '../tab/CardTab'; import CommonTabsNav from './CommonTabsNav'; var CardTabsNav = (function (_super) { __extends(CardTabsNav, _super); function CardTabsNav() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.typeName = 'card'; _this.state = { fixedIds: [], }; _this.onFixedChange = function (ids) { var onFixedChange = _this.props.onFixedChange; onFixedChange === null || onFixedChange === void 0 ? void 0 : onFixedChange(ids); _this.setState({ fixedIds: ids }); }; return _this; } Object.defineProperty(CardTabsNav.prototype, "isFixedControlled", { get: function () { return 'fixedIds' in this.props; }, enumerable: false, configurable: true }); Object.defineProperty(CardTabsNav.prototype, "fixedIds", { get: function () { var ids = this.isFixedControlled ? this.props.fixedIds : this.state.fixedIds; return ids || []; }, enumerable: false, configurable: true }); CardTabsNav.prototype.renderTab = function (data) { return (_jsx(CardTab, __assign({ onSelected: this.onTabSelected, onDelete: this.onTabDel }, data, { fixedIds: this.fixedIds, onFixedChange: this.onFixedChange, id: data.key }, { children: data.title }), void 0)); }; return CardTabsNav; }(CommonTabsNav)); export default CardTabsNav;