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.

0 lines
13 KiB

1 month ago
  1. {"ast":null,"code":"import { defineComponent, useSlots, computed, ref, provide, openBlock, createBlock, unref, withCtx, createVNode, Transition, withDirectives, createElementVNode, normalizeClass, normalizeStyle, mergeProps, createSlots, renderSlot, createCommentVNode, vShow } from 'vue';\nimport { ElOverlay } from '../../overlay/index.mjs';\nimport ElFocusTrap from '../../focus-trap/src/focus-trap.mjs';\nimport { ElTeleport } from '../../teleport/index.mjs';\nimport ElDialogContent from './dialog-content2.mjs';\nimport { dialogInjectionKey } from './constants.mjs';\nimport { dialogProps, dialogEmits } from './dialog2.mjs';\nimport { useDialog } from './use-dialog.mjs';\nimport _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';\nimport { useDeprecated } from '../../../hooks/use-deprecated/index.mjs';\nimport { useNamespace } from '../../../hooks/use-namespace/index.mjs';\nimport { useSameTarget } from '../../../hooks/use-same-target/index.mjs';\nconst __default__ = defineComponent({\n name: \"ElDialog\",\n inheritAttrs: false\n});\nconst _sfc_main = /* @__PURE__ */defineComponent({\n ...__default__,\n props: dialogProps,\n emits: dialogEmits,\n setup(__props, {\n expose\n }) {\n const props = __props;\n const slots = useSlots();\n useDeprecated({\n scope: \"el-dialog\",\n from: \"the title slot\",\n replacement: \"the header slot\",\n version: \"3.0.0\",\n ref: \"https://element-plus.org/en-US/component/dialog.html#slots\"\n }, computed(() => !!slots.title));\n const ns = useNamespace(\"dialog\");\n const dialogRef = ref();\n const headerRef = ref();\n const dialogContentRef = ref();\n const {\n visible,\n titleId,\n bodyId,\n style,\n overlayDialogStyle,\n rendered,\n zIndex,\n afterEnter,\n afterLeave,\n beforeLeave,\n handleClose,\n onModalClick,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onCloseRequested,\n onFocusoutPrevented\n } = useDialog(props, dialogRef);\n provide(dialogInjectionKey, {\n dialogRef,\n headerRef,\n bodyId,\n ns,\n rendered,\n style\n });\n const overlayEvent = useSameTarget(onModalClick);\n const draggable = computed(() => props.draggable && !props.fullscreen);\n const resetPosition = () => {\n var _a;\n (_a = dialogContentRef.value) == null ? void 0 : _a.resetPosition();\n };\n expose({\n visible,\n dialogContentRef,\n resetPosition\n });\n return (_ctx, _cache) => {\n return openBlock(), createBlock(unref(ElTeleport), {\n to: _ctx.appendTo,\n disabled: _ctx.appendTo !== \"body\" ? false : !_ctx.appendToBody\n }, {\n default: withCtx(() => [createVNode(Transition, {\n name: \"dialog-fade\",\n onAfterEnter: unref(afterEnter),\n onAfterLeave: unref(afterLeave),\n onBeforeLeave: unref(beforeLeave),\n persisted: \"\"\n }, {\n default: withCtx(() => [withDirectives(createVNode(unref(ElOverlay), {\n \"custom-mask-event\": \"\",\n mask: _ctx.modal,\n \"overlay-class\": _ctx.modalClass,\n \"z-index\": unref(zIndex)\n }, {\n default: withCtx(() => [createElementVNode(\"div\", {\n role: \"dialog\",\n \"aria-modal\": \"true\",\n \"aria-label\": _ctx.title || void 0,\n \"aria-labelledby\": !_ctx.title ? unref(titleId) : void 0,\n \"aria-describedby\": unref(bodyId),\n class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),\n style: normalizeStyle(unref(overlayDialogStyle)),\n onClick: unref(overlayEvent).onClick,\n onMousedown: unref(overlayEvent).onMousedown,\n onMouseup: unref(overlayEvent).onMouseup\n }, [createVNode(unref(ElFocusTrap), {\n loop: \"\",\n trapped: unref(visible),\n \"focus-start-el\": \"container\",\n