{"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 { teleportProps } from '@element-plus/components/teleport'\nimport {\n  dialogContentProps,\n  dialogContentPropsDefaults,\n} from './dialog-content'\n\nimport type { ExtractPublicPropTypes, InjectionKey, TransitionProps } from 'vue'\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?: string\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: teleportProps.to.type,\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: String,\n  /**\n   * @description custom class names for header wrapper\n   */\n  headerClass: String,\n  /**\n   * @description custom class names for body wrapper\n   */\n  bodyClass: String,\n  /**\n   * @description custom class names for footer wrapper\n   */\n  footerClass: String,\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} as const\n"],"mappings":";;;;;;;;;;AAuGA,MAAa,cAAc,WAAW;CACpC,GAAG;CAIH,cAAc;CAId,UAAU;EACR,MAAM,cAAc,GAAG;EACvB,SAAS;EACV;CAID,aAAa,EACX,MAAM,eAAoC,SAAS,EACpD;CAID,gBAAgB;CAIhB,mBAAmB;EACjB,MAAM;EACN,SAAS;EACV;CAID,oBAAoB;EAClB,MAAM;EACN,SAAS;EACV;CAID,YAAY;EACV,MAAM;EACN,SAAS;EACV;CAID,OAAO;EACL,MAAM;EACN,SAAS;EACV;CAID,iBAAiB;CAIjB,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,YAAY;EACV,MAAM;EACN,SAAS;EACV;CAID,KAAK,EACH,MAAM,QACP;CAID,YAAY;CAIZ,YAAY;CAIZ,aAAa;CAIb,WAAW;CAIX,aAAa;CAIb,OAAO,EACL,MAAM,CAAC,QAAQ,OAAO,EACvB;CAID,QAAQ,EACN,MAAM,QACP;CACD,WAAW;CAIX,iBAAiB;EACf,MAAM;EACN,SAAS;EACV;CAID,YAAY;EACV,MAAM,eAAiC,CAAC,QAAQ,OAAO,CAAC;EACxD,SAAS;EACV;CACF,CAAU;AAOX,MAAa,cAAc;CACzB,YAAY;CACZ,cAAc;CACd,aAAa;CACb,cAAc;EACb,sBAAsB,UAAmB,UAAU,MAAM;CAC1D,qBAAqB;CACrB,sBAAsB;CACvB;AAUD,MAAa,mBACX,OAAO,mBAAmB;AAE5B,MAAa,sBAAsB;CACjC,GAAG;CACH,UAAU;CACV,mBAAmB;CACnB,oBAAoB;CACpB,YAAY;CACZ,OAAO;CACP,WAAW;CACX,YAAY;CACZ,iBAAiB;CACjB,YAAY;CACb"}