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 _rcMotion = _interopRequireDefault(require("rc-motion"));
|
13 |
|
14 | var _LoadingOutlined = _interopRequireDefault(require("@ant-design/icons/LoadingOutlined"));
|
15 |
|
16 | var getCollapsedWidth = function getCollapsedWidth() {
|
17 | return {
|
18 | width: 0,
|
19 | opacity: 0,
|
20 | transform: 'scale(0)'
|
21 | };
|
22 | };
|
23 |
|
24 | var getRealWidth = function getRealWidth(node) {
|
25 | return {
|
26 | width: node.scrollWidth,
|
27 | opacity: 1,
|
28 | transform: 'scale(1)'
|
29 | };
|
30 | };
|
31 |
|
32 | var LoadingIcon = function LoadingIcon(_ref) {
|
33 | var prefixCls = _ref.prefixCls,
|
34 | loading = _ref.loading,
|
35 | existIcon = _ref.existIcon;
|
36 | var visible = !!loading;
|
37 |
|
38 | if (existIcon) {
|
39 | return _react["default"].createElement("span", {
|
40 | className: "".concat(prefixCls, "-loading-icon")
|
41 | }, _react["default"].createElement(_LoadingOutlined["default"], null));
|
42 | }
|
43 |
|
44 | return _react["default"].createElement(_rcMotion["default"], {
|
45 | visible: visible
|
46 | ,
|
47 | motionName: "".concat(prefixCls, "-loading-icon-motion"),
|
48 | removeOnLeave: true,
|
49 | onAppearStart: getCollapsedWidth,
|
50 | onAppearActive: getRealWidth,
|
51 | onEnterStart: getCollapsedWidth,
|
52 | onEnterActive: getRealWidth,
|
53 | onLeaveStart: getRealWidth,
|
54 | onLeaveActive: getCollapsedWidth
|
55 | }, function (_ref2, ref) {
|
56 | var className = _ref2.className,
|
57 | style = _ref2.style;
|
58 | return _react["default"].createElement("span", {
|
59 | className: "".concat(prefixCls, "-loading-icon"),
|
60 | style: style,
|
61 | ref: ref
|
62 | }, _react["default"].createElement(_LoadingOutlined["default"], {
|
63 | className: className
|
64 | }));
|
65 | });
|
66 | };
|
67 |
|
68 | var _default = LoadingIcon;
|
69 | exports["default"] = _default; |
\ | No newline at end of file |