mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 01:41:20 +08:00
79 lines
1.5 KiB
TypeScript
79 lines
1.5 KiB
TypeScript
import { buildProps, definePropType, isBoolean } from '@element-plus/utils'
|
|
import { UPDATE_MODEL_EVENT } from '@element-plus/constants'
|
|
import { dialogContentProps } from './dialog-content'
|
|
|
|
import type { ExtractPropTypes } from 'vue'
|
|
|
|
type DoneFn = (cancel?: boolean) => void
|
|
export type DialogBeforeCloseFn = (done: DoneFn) => void
|
|
|
|
export const dialogProps = buildProps({
|
|
...dialogContentProps,
|
|
appendToBody: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
beforeClose: {
|
|
type: definePropType<DialogBeforeCloseFn>(Function),
|
|
},
|
|
destroyOnClose: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
closeOnClickModal: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
closeOnPressEscape: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
lockScroll: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
modal: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
openDelay: {
|
|
type: Number,
|
|
default: 0,
|
|
},
|
|
closeDelay: {
|
|
type: Number,
|
|
default: 0,
|
|
},
|
|
top: {
|
|
type: String,
|
|
},
|
|
modelValue: {
|
|
type: Boolean,
|
|
required: true,
|
|
},
|
|
modalClass: String,
|
|
width: {
|
|
type: [String, Number],
|
|
},
|
|
zIndex: {
|
|
type: Number,
|
|
},
|
|
trapFocus: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
} as const)
|
|
|
|
export type DialogProps = ExtractPropTypes<typeof dialogProps>
|
|
|
|
export const dialogEmits = {
|
|
open: () => true,
|
|
opened: () => true,
|
|
close: () => true,
|
|
closed: () => true,
|
|
[UPDATE_MODEL_EVENT]: (value: boolean) => isBoolean(value),
|
|
openAutoFocus: () => true,
|
|
closeAutoFocus: () => true,
|
|
}
|
|
export type DialogEmits = typeof dialogEmits
|