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