UNPKG

tdesign-mobile-vue

Version:
84 lines (80 loc) 2.81 kB
/** * tdesign v1.9.3 * (c) 2025 TDesign Group * @license MIT */ import _defineProperty from '@babel/runtime/helpers/defineProperty'; import { defineComponent, computed, createVNode, Transition, withDirectives, vShow } from 'vue'; import { preventDefault } from '../shared/dom.js'; import config from '../config.js'; import OverlayProps from './props.js'; import { usePrefixClass } from '../hooks/useClass.js'; import { useTNodeJSX } from '../hooks/tnode.js'; import 'lodash-es'; import '../config-provider/useConfig.js'; import '../config-provider/context.js'; import '../_common/js/global-config/mobile/default-config.js'; import '../_common/js/global-config/mobile/locale/zh_CN.js'; import '../_chunks/dep-fe4ae270.js'; import '@babel/runtime/helpers/typeof'; import '../_chunks/dep-a8acd638.js'; import 'dayjs'; import '../_chunks/dep-2200259b.js'; import '../config-provider/type.js'; import '../hooks/render-tnode.js'; import '../_common/js/utils/general.js'; var prefix = config.prefix; var _Overlay = defineComponent({ name: "".concat(prefix, "-overlay"), props: OverlayProps, setup: function setup(props) { var renderTNodeJSX = useTNodeJSX(); var overlayClass = usePrefixClass("overlay"); var overlayClasses = computed(function () { return _defineProperty(_defineProperty({}, "".concat(overlayClass.value), true), "".concat(overlayClass.value, "--active"), props.visible); }); var overlayStyles = computed(function () { var arr = []; if (props.customStyle) { arr.push(props.customStyle); } if (props.zIndex) { arr.push("z-index: ".concat(props.zIndex)); } if (props.duration) { arr.push("transition-duration: ".concat(props.duration, "ms")); } if (props.backgroundColor) { arr.push("background-color: ".concat(props.backgroundColor)); } return arr.join("; "); }); var handleTouchMove = function handleTouchMove(e) { if (props.preventScrollThrough) { preventDefault(e, true); } }; var handleClick = function handleClick(e) { var _props$onClick; (_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props, { e: e }); }; return function () { return createVNode(Transition, { "name": overlayClass.value }, { default: function _default() { return [withDirectives(createVNode("div", { "class": overlayClasses.value, "style": overlayStyles.value, "onClick": handleClick, "onTouchmove": handleTouchMove }, [renderTNodeJSX("default")]), [[vShow, props.visible]])]; } }); }; } }); export { _Overlay as default }; //# sourceMappingURL=overlay.js.map