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.

1 line
5.8 KiB

{"version":3,"file":"dialog2.mjs","sources":["../../../../../../packages/components/dialog/src/dialog.vue"],"sourcesContent":["<template>\n <el-teleport\n :to=\"appendTo\"\n :disabled=\"appendTo !== 'body' ? false : !appendToBody\"\n >\n <transition\n name=\"dialog-fade\"\n @after-enter=\"afterEnter\"\n @after-leave=\"afterLeave\"\n @before-leave=\"beforeLeave\"\n >\n <el-overlay\n v-show=\"visible\"\n custom-mask-event\n :mask=\"modal\"\n :overlay-class=\"modalClass\"\n :z-index=\"zIndex\"\n >\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-label=\"title || undefined\"\n :aria-labelledby=\"!title ? titleId : undefined\"\n :aria-describedby=\"bodyId\"\n :class=\"`${ns.namespace.value}-overlay-dialog`\"\n :style=\"overlayDialogStyle\"\n @click=\"overlayEvent.onClick\"\n @mousedown=\"overlayEvent.onMousedown\"\n @mouseup=\"overlayEvent.onMouseup\"\n >\n <el-focus-trap\n loop\n :trapped=\"visible\"\n focus-start-el=\"container\"\n @focus-after-trapped=\"onOpenAutoFocus\"\n @focus-after-released=\"onCloseAutoFocus\"\n @focusout-prevented=\"onFocusoutPrevented\"\n @release-requested=\"onCloseRequested\"\n >\n <el-dialog-content\n v-if=\"rendered\"\n ref=\"dialogContentRef\"\n v-bind=\"$attrs\"\n :center=\"center\"\n :align-center=\"alignCenter\"\n :close-icon=\"closeIcon\"\n :draggable=\"draggable\"\n :overflow=\"overflow\"\n :fullscreen=\"fullscreen\"\n :show-close=\"showClose\"\n :title=\"title\"\n :aria-level=\"headerAriaLevel\"\n @close=\"handleClose\"\n >\n <template #header>\n <slot\n v-if=\"!$slots.title\"\n name=\"header\"\n :close=\"handleClose\"\n :title-id=\"titleId\"\n :title-class=\"ns.e('title')\"\n />\n <slot v-else name=\"title\" />\n </template>\n <slot />\n <template v-if=\"$slots.footer\" #footer>\n <slot name=\"footer\" />\n </template>\n </el-dialog-content>\n </el-focus-trap>\n </div>\n </el-overlay>\n </transition>\n </el-teleport>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, provide, ref, useSlots } from 'vue'\nimport { ElOverlay } from '@element-plus/components/overlay'\nimport { useDeprecated, useNamespace, useSameTarget } from '@element-plus/hooks'\nimport ElFocusTrap from '@element-plus/components/focus-trap'\nimport ElTeleport from '@element-plus/components/teleport'\nimport ElDialogContent from './dialog-content.vue'\nimport { dialogInjectionKey } from './constants'\nimport { dialogEmits, dialogProps } from './dialog'\nimport { useDialog } from './use-dialog'\n\ndefineOptions({\n name: 'ElDialog',\n inheritAttrs: false,\n})\n\nconst props = defineProps(dialogProps)\ndefineEmits(dialogEmits)\nconst slots = useSlots()\n\nuseDeprecated(\n {\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 },\n computed(() => !!slots.title)\n)\n\nconst ns = useNamespace('dialog')\nconst dialogRef = ref<HTMLElement>()\nconst headerRef = ref<HTMLElement>()\nconst dialogContentRef = ref()\n\nconst {\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\nprovide(dialogInjectionKey, {\n dialogRef,\n headerRef,\n bodyI