UNPKG

965 BJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports["default"] = void 0;
9
10var _react = _interopRequireDefault(require("react"));
11
12var _mobxReactLite = require("mobx-react-lite");
13
14function getCount(count) {
15 if (typeof count === 'function') {
16 return count();
17 }
18
19 return count;
20}
21
22var Count = (0, _mobxReactLite.observer)(function Count(props) {
23 var count = props.count,
24 overflowCount = props.overflowCount,
25 prefixCls = props.prefixCls;
26 var number = getCount(count);
27
28 if (number) {
29 return _react["default"].createElement("span", {
30 className: "".concat(prefixCls, "-tab-count")
31 }, overflowCount && number > overflowCount ? "".concat(overflowCount, "+") : number);
32 }
33
34 return null;
35});
36Count.displayName = 'Count';
37var _default = Count;
38exports["default"] = _default;
39//# sourceMappingURL=Count.js.map