{"version":3,"file":"dialog.mjs","names":[],"sources":["../../../../../../packages/components/dialog/src/dialog.ts"],"sourcesContent":["import { buildProps, definePropType, isBoolean } from '@element-plus/utils'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport {\n  dialogContentProps,\n  dialogContentPropsDefaults,\n} from './dialog-content'\n\nimport type { ExtractPublicPropTypes, InjectionKey, TransitionProps } from 'vue'\nimport type { ClassValue } from '@element-plus/utils'\nimport type { DialogContentProps } from './dialog-content'\nimport type Dialog from './dialog.vue'\n\ntype DoneFn = (cancel?: boolean) => void\n\nexport type DialogBeforeCloseFn = (done: DoneFn) => void\n\nexport type DialogTransition = string | TransitionProps\n\n/**\n * @description dialog component props\n */\nexport interface DialogProps extends DialogContentProps {\n  /**\n   * @description whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true`\n   */\n  appendToBody?: boolean\n  /**\n   * @description which element the Dialog appends to\n   */\n  appendTo?: string | HTMLElement\n  /**\n   * @description callback before Dialog closes, and it will prevent Dialog from closing, use done to close the dialog\n   */\n  beforeClose?: DialogBeforeCloseFn\n  /**\n   * @description destroy elements in Dialog when closed\n   */\n  destroyOnClose?: boolean\n  /**\n   * @description whether the Dialog can be closed by clicking the mask\n   */\n  closeOnClickModal?: boolean\n  /**\n   * @description whether the Dialog can be closed by pressing ESC\n   */\n  closeOnPressEscape?: boolean\n  /**\n   * @description whether scroll of body is disabled while Dialog is displayed\n   */\n  lockScroll?: boolean\n  /**\n   * @description whether a mask is displayed\n   */\n  modal?: boolean\n  /**\n   * @description whether the mask is penetrable\n   */\n  modalPenetrable?: boolean\n  /**\n   * @description the Time(milliseconds) before open\n   */\n  openDelay?: number\n  /**\n   * @description the Time(milliseconds) before close\n   */\n  closeDelay?: number\n  /**\n   * @description value for `margin-top` of Dialog CSS, default is 15vh\n   */\n  top?: string\n  /**\n   * @description visibility of Dialog\n   */\n  modelValue?: boolean\n  /**\n   * @description custom class names for mask\n   */\n  modalClass?: ClassValue\n  /**\n   * @description width of Dialog, default is 50%\n   */\n  width?: string | number\n  /**\n   * @description same as z-index in native CSS, z-order of dialog\n   */\n  zIndex?: number\n  /**\n   * @description trap focus within dialog\n   */\n  trapFocus?: boolean\n  /**\n   * @description header's aria-level attribute\n   */\n  headerAriaLevel?: string\n  /**\n   * @description custom transition configuration for dialog animation, it can be a string (transition name) or an object with Vue transition props\n   */\n  transition?: DialogTransition\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `DialogProps` instead.\n */\nexport const dialogProps = buildProps({\n  ...dialogContentProps,\n  /**\n   * @description whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true`\n   */\n  appendToBody: Boolean,\n  /**\n   * @description which element the Dialog appends to\n   */\n  appendTo: {\n    type: definePropType<string | HTMLElement>([String, Object]),\n    default: 'body',\n  },\n  /**\n   * @description callback before Dialog closes, and it will prevent Dialog from closing, use done to close the dialog\n   */\n  beforeClose: {\n    type: definePropType<DialogBeforeCloseFn>(Function),\n  },\n  /**\n   * @description destroy elements in Dialog when closed\n   */\n  destroyOnClose: Boolean,\n  /**\n   * @description whether the Dialog can be closed by clicking the mask\n   */\n  closeOnClickModal: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description whether the Dialog can be closed by pressing ESC\n   */\n  closeOnPressEscape: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description whether scroll of body is disabled while Dialog is displayed\n   */\n  lockScroll: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description whether a mask is displayed\n   */\n  modal: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description whether the mask is penetrable\n   */\n  modalPenetrable: Boolean,\n  /**\n   * @description the Time(milliseconds) before open\n   */\n  openDelay: {\n    type: Number,\n    default: 0,\n  },\n  /**\n   * @description the Time(milliseconds) before close\n   */\n  closeDelay: {\n    type: Number,\n    default: 0,\n  },\n  /**\n   * @description value for `margin-top` of Dialog CSS, default is 15vh\n   */\n  top: {\n    type: String,\n  },\n  /**\n   * @description visibility of Dialog\n   */\n  modelValue: Boolean,\n  /**\n   * @description custom class names for mask\n   */\n  modalClass: {\n    type: definePropType<ClassValue>([String, Array, Object, Boolean]),\n    default: undefined,\n  },\n  /**\n   * @description width of Dialog, default is 50%\n   */\n  width: {\n    type: [String, Number],\n  },\n  /**\n   * @description same as z-index in native CSS, z-order of dialog\n   */\n  zIndex: {\n    type: Number,\n  },\n  trapFocus: Boolean,\n  /**\n   * @description header's aria-level attribute\n   */\n  headerAriaLevel: {\n    type: String,\n    default: '2',\n  },\n  /**\n   * @description custom transition configuration for dialog animation, it can be a string (transition name) or an object with Vue transition props\n   */\n  transition: {\n    type: definePropType<DialogTransition>([String, Object]),\n    default: undefined,\n  },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `DialogProps` instead.\n */\nexport type DialogPropsPublic = ExtractPublicPropTypes<typeof dialogProps>\n\nexport const dialogEmits = {\n  open: () => true,\n  opened: () => true,\n  close: () => true,\n  closed: () => true,\n  [UPDATE_MODEL_EVENT]: (value: boolean) => isBoolean(value),\n  openAutoFocus: () => true,\n  closeAutoFocus: () => true,\n}\nexport type DialogEmits = typeof dialogEmits\nexport type DialogInstance = InstanceType<typeof Dialog> & unknown\nexport interface DialogConfigContext {\n  alignCenter?: boolean\n  draggable?: boolean\n  overflow?: boolean\n  transition?: DialogTransition\n}\n\nexport const dialogContextKey: InjectionKey<DialogConfigContext> =\n  Symbol('dialogContextKey')\n\nexport const dialogPropsDefaults = {\n  ...dialogContentPropsDefaults,\n  appendTo: 'body',\n  closeOnClickModal: true,\n  closeOnPressEscape: true,\n  lockScroll: true,\n  modal: true,\n  openDelay: 0,\n  closeDelay: 0,\n  headerAriaLevel: '2',\n  transition: undefined,\n  modalClass: undefined,\n} as const\n"],"mappings":";;;;;;;;AAuGA,MAAa,cAAc,WAAW;CACpC,GAAG;;;;CAIH,cAAc;;;;CAId,UAAU;EACR,MAAM,eAAqC,CAAC,QAAQ,MAAM,CAAC;EAC3D,SAAS;CACX;;;;CAIA,aAAa,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