1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 |
|
5 | Object.defineProperty(exports, "__esModule", {
|
6 | value: true
|
7 | });
|
8 | exports["default"] = void 0;
|
9 |
|
10 | var _react = _interopRequireDefault(require("react"));
|
11 |
|
12 | var _mobxReactLite = require("mobx-react-lite");
|
13 |
|
14 | function getCount(count) {
|
15 | if (typeof count === 'function') {
|
16 | return count();
|
17 | }
|
18 |
|
19 | return count;
|
20 | }
|
21 |
|
22 | var 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 | });
|
36 | Count.displayName = 'Count';
|
37 | var _default = Count;
|
38 | exports["default"] = _default;
|
39 |
|