You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
887 B
38 lines
887 B
import { Transition } from 'vue';
|
|
import type { TransitionNameType, AnimationType } from '../interface';
|
|
import { getMotion } from '../utils/motionUtil';
|
|
|
|
export interface MaskProps {
|
|
prefixCls: string;
|
|
visible?: boolean;
|
|
zIndex?: number;
|
|
mask?: boolean;
|
|
maskAnimation?: AnimationType;
|
|
maskTransitionName?: TransitionNameType;
|
|
}
|
|
|
|
export default function Mask(props: MaskProps) {
|
|
const { prefixCls, visible, zIndex, mask, maskAnimation, maskTransitionName } = props;
|
|
|
|
if (!mask) {
|
|
return null;
|
|
}
|
|
|
|
let motion = {};
|
|
|
|
if (maskTransitionName || maskAnimation) {
|
|
motion = getMotion({
|
|
prefixCls,
|
|
transitionName: maskTransitionName,
|
|
animation: maskAnimation,
|
|
});
|
|
}
|
|
|
|
return (
|
|
<Transition appear {...motion}>
|
|
<div v-if={visible} style={{ zIndex }} class={`${prefixCls}-mask`} />
|
|
</Transition>
|
|
);
|
|
}
|
|
Mask.displayName = 'Mask';
|