1 | "use strict";
|
2 |
|
3 | var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
4 |
|
5 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
6 |
|
7 | Object.defineProperty(exports, "__esModule", {
|
8 | value: true
|
9 | });
|
10 | exports.default = Mask;
|
11 |
|
12 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13 |
|
14 | var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
15 |
|
16 | var React = _interopRequireWildcard(require("react"));
|
17 |
|
18 | var _classnames = _interopRequireDefault(require("classnames"));
|
19 |
|
20 | var _rcMotion = _interopRequireDefault(require("rc-motion"));
|
21 |
|
22 | var _legacyUtil = require("../utils/legacyUtil");
|
23 |
|
24 | function Mask(props) {
|
25 | var prefixCls = props.prefixCls,
|
26 | visible = props.visible,
|
27 | zIndex = props.zIndex,
|
28 | mask = props.mask,
|
29 | maskMotion = props.maskMotion,
|
30 | maskAnimation = props.maskAnimation,
|
31 | maskTransitionName = props.maskTransitionName;
|
32 |
|
33 | if (!mask) {
|
34 | return null;
|
35 | }
|
36 |
|
37 | var motion = {};
|
38 |
|
39 | if (maskMotion || maskTransitionName || maskAnimation) {
|
40 | motion = (0, _objectSpread2.default)({
|
41 | motionAppear: true
|
42 | }, (0, _legacyUtil.getMotion)({
|
43 | motion: maskMotion,
|
44 | prefixCls: prefixCls,
|
45 | transitionName: maskTransitionName,
|
46 | animation: maskAnimation
|
47 | }));
|
48 | }
|
49 |
|
50 | return React.createElement(_rcMotion.default, (0, _extends2.default)({}, motion, {
|
51 | visible: visible,
|
52 | removeOnLeave: true
|
53 | }), function (_ref) {
|
54 | var className = _ref.className;
|
55 | return React.createElement("div", {
|
56 | style: {
|
57 | zIndex: zIndex
|
58 | },
|
59 | className: (0, _classnames.default)("".concat(prefixCls, "-mask"), className)
|
60 | });
|
61 | });
|
62 | } |
\ | No newline at end of file |