2022-02-11 11:03:15 +08:00
|
|
|
import { buildProps, definePropType, iconPropType } from '@element-plus/utils'
|
2022-02-09 16:59:08 +08:00
|
|
|
import { UPDATE_MODEL_EVENT } from '@element-plus/constants'
|
|
|
|
import type { ExtractPropTypes } from 'vue'
|
2021-09-13 12:01:37 +08:00
|
|
|
|
2021-10-06 19:56:24 +08:00
|
|
|
export const dialogProps = buildProps({
|
2021-09-13 12:01:37 +08:00
|
|
|
appendToBody: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2021-10-06 19:56:24 +08:00
|
|
|
beforeClose: {
|
2021-09-22 20:27:23 +08:00
|
|
|
type: definePropType<(...args: any[]) => void>(Function),
|
2021-10-06 19:56:24 +08:00
|
|
|
},
|
2021-09-13 12:01:37 +08:00
|
|
|
destroyOnClose: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
center: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
customClass: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2021-12-07 17:51:15 +08:00
|
|
|
closeIcon: {
|
2022-02-09 16:59:08 +08:00
|
|
|
type: iconPropType,
|
2021-12-07 17:51:15 +08:00
|
|
|
default: '',
|
|
|
|
},
|
2021-09-13 12:01:37 +08:00
|
|
|
closeOnClickModal: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
closeOnPressEscape: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
fullscreen: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2022-02-03 21:04:25 +08:00
|
|
|
draggable: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2021-09-13 12:01:37 +08:00
|
|
|
lockScroll: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
modal: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
showClose: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
openDelay: {
|
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
|
|
|
closeDelay: {
|
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
|
|
|
top: {
|
|
|
|
type: String,
|
|
|
|
},
|
|
|
|
modelValue: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
modalClass: String,
|
2021-10-06 19:56:24 +08:00
|
|
|
width: {
|
2021-09-13 12:01:37 +08:00
|
|
|
type: [String, Number],
|
2021-10-06 19:56:24 +08:00
|
|
|
},
|
2021-09-13 12:01:37 +08:00
|
|
|
zIndex: {
|
|
|
|
type: Number,
|
|
|
|
},
|
2021-10-06 19:56:24 +08:00
|
|
|
} as const)
|
2021-09-13 12:01:37 +08:00
|
|
|
export type DialogProps = ExtractPropTypes<typeof dialogProps>
|
|
|
|
|
|
|
|
export const dialogEmits = {
|
2021-09-13 13:19:06 +08:00
|
|
|
open: () => true,
|
|
|
|
opened: () => true,
|
|
|
|
close: () => true,
|
|
|
|
closed: () => true,
|
2021-09-13 12:01:37 +08:00
|
|
|
[UPDATE_MODEL_EVENT]: (value: boolean) => typeof value === 'boolean',
|
|
|
|
}
|
|
|
|
export type DialogEmits = typeof dialogEmits
|