@element-plus/nightly 0.0.20220131 → 0.0.20220204
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/dist/index.full.js +348 -205
- package/dist/index.full.min.js +6 -6
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +6 -6
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +347 -207
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/autocomplete/index.d.ts +12 -4
- package/es/components/autocomplete/src/index.mjs +11 -4
- package/es/components/autocomplete/src/index.mjs.map +1 -1
- package/es/components/autocomplete/src/index.vue.d.ts +6 -2
- package/es/components/cascader/index.d.ts +12 -4
- package/es/components/cascader/src/index.mjs +12 -5
- package/es/components/cascader/src/index.mjs.map +1 -1
- package/es/components/cascader/src/index.vue.d.ts +6 -2
- package/es/components/dialog/index.d.ts +4 -0
- package/es/components/dialog/src/dialog.d.ts +1 -0
- package/es/components/dialog/src/dialog.mjs +4 -0
- package/es/components/dialog/src/dialog.mjs.map +1 -1
- package/es/components/dialog/src/dialog.vue.d.ts +4 -0
- package/es/components/dialog/src/dialog2.mjs +12 -3
- package/es/components/dialog/src/dialog2.mjs.map +1 -1
- package/es/components/drawer/index.d.ts +3 -0
- package/es/components/drawer/src/drawer.d.ts +1 -0
- package/es/components/drawer/src/drawer.vue.d.ts +3 -0
- package/es/components/index.mjs +1 -0
- package/es/components/index.mjs.map +1 -1
- package/es/components/message-box/src/index.mjs +133 -113
- package/es/components/message-box/src/index.mjs.map +1 -1
- package/es/components/message-box/src/index.vue.d.ts +14 -4
- package/es/components/message-box/src/message-box.type.d.ts +2 -0
- package/es/components/popconfirm/index.d.ts +26 -22
- package/es/components/popconfirm/src/popconfirm.d.ts +12 -11
- package/es/components/popconfirm/src/popconfirm.mjs +48 -43
- package/es/components/popconfirm/src/popconfirm.mjs.map +1 -1
- package/es/components/popconfirm/src/popconfirm.vue.d.ts +26 -22
- package/es/components/popconfirm/src/popconfirm2.mjs +8 -3
- package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
- package/es/components/popover/index.d.ts +26 -0
- package/es/components/popover/src/index.mjs +8 -3
- package/es/components/popover/src/index.mjs.map +1 -1
- package/es/components/popover/src/index.vue.d.ts +39 -26
- package/es/components/popover/src/popover.d.ts +5 -0
- package/es/components/popover/src/popover.mjs +2 -0
- package/es/components/popover/src/popover.mjs.map +1 -1
- package/es/components/popper/index.d.ts +1 -0
- package/es/components/popper/index.mjs +1 -0
- package/es/components/popper/index.mjs.map +1 -1
- package/es/components/popper/src/deprecation.d.ts +3 -0
- package/es/components/popper/src/deprecation.mjs +24 -0
- package/es/components/popper/src/deprecation.mjs.map +1 -0
- package/es/components/select/index.d.ts +6 -2
- package/es/components/select/src/select.mjs +13 -6
- package/es/components/select/src/select.mjs.map +1 -1
- package/es/components/select/src/select.vue.d.ts +30 -26
- package/es/components/select-v2/index.d.ts +12 -12
- package/es/components/select-v2/src/defaults.d.ts +2 -1
- package/es/components/select-v2/src/defaults.mjs +4 -1
- package/es/components/select-v2/src/defaults.mjs.map +1 -1
- package/es/components/select-v2/src/select.mjs +2 -2
- package/es/components/select-v2/src/select.mjs.map +1 -1
- package/es/components/select-v2/src/select.vue.d.ts +6 -6
- package/es/components/select-v2/src/useSelect.d.ts +1 -4
- package/es/components/select-v2/src/useSelect.mjs +4 -2
- package/es/components/select-v2/src/useSelect.mjs.map +1 -1
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.mjs +2 -0
- package/es/hooks/index.mjs.map +1 -1
- package/es/hooks/use-deprecated/index.d.ts +10 -0
- package/es/hooks/use-deprecated/index.mjs +17 -0
- package/es/hooks/use-deprecated/index.mjs.map +1 -0
- package/es/hooks/use-draggable/index.d.ts +2 -0
- package/es/hooks/use-draggable/index.mjs +65 -0
- package/es/hooks/use-draggable/index.mjs.map +1 -0
- package/es/index.mjs +3 -0
- package/es/index.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/autocomplete/index.d.ts +12 -4
- package/lib/components/autocomplete/src/index.js +11 -4
- package/lib/components/autocomplete/src/index.js.map +1 -1
- package/lib/components/autocomplete/src/index.vue.d.ts +6 -2
- package/lib/components/cascader/index.d.ts +12 -4
- package/lib/components/cascader/src/index.js +12 -5
- package/lib/components/cascader/src/index.js.map +1 -1
- package/lib/components/cascader/src/index.vue.d.ts +6 -2
- package/lib/components/dialog/index.d.ts +4 -0
- package/lib/components/dialog/src/dialog.d.ts +1 -0
- package/lib/components/dialog/src/dialog.js +4 -0
- package/lib/components/dialog/src/dialog.js.map +1 -1
- package/lib/components/dialog/src/dialog.vue.d.ts +4 -0
- package/lib/components/dialog/src/dialog2.js +11 -2
- package/lib/components/dialog/src/dialog2.js.map +1 -1
- package/lib/components/drawer/index.d.ts +3 -0
- package/lib/components/drawer/src/drawer.d.ts +1 -0
- package/lib/components/drawer/src/drawer.vue.d.ts +3 -0
- package/lib/components/index.js +2 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/message-box/src/index.js +140 -120
- package/lib/components/message-box/src/index.js.map +1 -1
- package/lib/components/message-box/src/index.vue.d.ts +14 -4
- package/lib/components/message-box/src/message-box.type.d.ts +2 -0
- package/lib/components/popconfirm/index.d.ts +26 -22
- package/lib/components/popconfirm/src/popconfirm.d.ts +12 -11
- package/lib/components/popconfirm/src/popconfirm.js +48 -43
- package/lib/components/popconfirm/src/popconfirm.js.map +1 -1
- package/lib/components/popconfirm/src/popconfirm.vue.d.ts +26 -22
- package/lib/components/popconfirm/src/popconfirm2.js +8 -3
- package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
- package/lib/components/popover/index.d.ts +26 -0
- package/lib/components/popover/src/index.js +8 -3
- package/lib/components/popover/src/index.js.map +1 -1
- package/lib/components/popover/src/index.vue.d.ts +39 -26
- package/lib/components/popover/src/popover.d.ts +5 -0
- package/lib/components/popover/src/popover.js +2 -0
- package/lib/components/popover/src/popover.js.map +1 -1
- package/lib/components/popper/index.d.ts +1 -0
- package/lib/components/popper/index.js +2 -0
- package/lib/components/popper/index.js.map +1 -1
- package/lib/components/popper/src/deprecation.d.ts +3 -0
- package/lib/components/popper/src/deprecation.js +28 -0
- package/lib/components/popper/src/deprecation.js.map +1 -0
- package/lib/components/select/index.d.ts +6 -2
- package/lib/components/select/src/select.js +13 -6
- package/lib/components/select/src/select.js.map +1 -1
- package/lib/components/select/src/select.vue.d.ts +30 -26
- package/lib/components/select-v2/index.d.ts +12 -12
- package/lib/components/select-v2/src/defaults.d.ts +2 -1
- package/lib/components/select-v2/src/defaults.js +4 -1
- package/lib/components/select-v2/src/defaults.js.map +1 -1
- package/lib/components/select-v2/src/select.js +2 -2
- package/lib/components/select-v2/src/select.js.map +1 -1
- package/lib/components/select-v2/src/select.vue.d.ts +6 -6
- package/lib/components/select-v2/src/useSelect.d.ts +1 -4
- package/lib/components/select-v2/src/useSelect.js +11 -9
- package/lib/components/select-v2/src/useSelect.js.map +1 -1
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +62 -58
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/use-deprecated/index.d.ts +10 -0
- package/lib/hooks/use-deprecated/index.js +21 -0
- package/lib/hooks/use-deprecated/index.js.map +1 -0
- package/lib/hooks/use-draggable/index.d.ts +2 -0
- package/lib/hooks/use-draggable/index.js +69 -0
- package/lib/hooks/use-draggable/index.js.map +1 -0
- package/lib/index.js +64 -58
- package/lib/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/tags.json +1 -1
- package/theme-chalk/el-dialog.css +1 -1
- package/theme-chalk/el-message-box.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/dialog.scss +7 -0
- package/theme-chalk/src/message-box.scss +26 -15
- package/web-types.json +1 -1
package/es/components/index.mjs
CHANGED
|
@@ -107,6 +107,7 @@ export { popconfirmProps } from './popconfirm/src/popconfirm.mjs';
|
|
|
107
107
|
export { default as ElPopperArrow } from './popper/src/arrow.mjs';
|
|
108
108
|
export { default as ElPopperTrigger } from './popper/src/trigger.mjs';
|
|
109
109
|
export { default as ElPopperContent } from './popper/src/content.mjs';
|
|
110
|
+
export { useDeprecateAppendToBody } from './popper/src/deprecation.mjs';
|
|
110
111
|
export { Effect, usePopperArrowProps, usePopperContentProps, usePopperCoreConfigProps, usePopperProps, usePopperTriggerProps } from './popper/src/popper.mjs';
|
|
111
112
|
export { POPPER_CONTENT_INJECTION_KEY, POPPER_INJECTION_KEY } from './popper/src/tokens.mjs';
|
|
112
113
|
export { progressProps } from './progress/src/progress.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, reactive, computed, watch, nextTick, onMounted, onBeforeUnmount, toRefs, resolveComponent, resolveDirective, openBlock, createBlock, Transition, withCtx, withDirectives, createVNode,
|
|
1
|
+
import { defineComponent, ref, reactive, computed, watch, nextTick, onMounted, onBeforeUnmount, toRefs, resolveComponent, resolveDirective, openBlock, createBlock, Transition, withCtx, withDirectives, createVNode, createElementVNode, createElementBlock, normalizeClass, normalizeStyle, withModifiers, resolveDynamicComponent, createCommentVNode, toDisplayString, withKeys, renderSlot, vShow, createTextVNode } from 'vue';
|
|
2
2
|
import { ElButton } from '../../button/index.mjs';
|
|
3
3
|
import '../../../directives/index.mjs';
|
|
4
4
|
import '../../../hooks/index.mjs';
|
|
@@ -14,6 +14,8 @@ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
|
14
14
|
import TrapFocus from '../../../directives/trap-focus/index.mjs';
|
|
15
15
|
import { useLocale } from '../../../hooks/use-locale/index.mjs';
|
|
16
16
|
import { useSize } from '../../../hooks/use-common-props/index.mjs';
|
|
17
|
+
import { useDraggable } from '../../../hooks/use-draggable/index.mjs';
|
|
18
|
+
import { useSameTarget } from '../../../hooks/use-same-target/index.mjs';
|
|
17
19
|
import { useModal } from '../../../hooks/use-modal/index.mjs';
|
|
18
20
|
import { usePreventGlobal } from '../../../hooks/use-prevent-global/index.mjs';
|
|
19
21
|
import { useLockscreen } from '../../../hooks/use-lockscreen/index.mjs';
|
|
@@ -62,6 +64,7 @@ const _sfc_main = defineComponent({
|
|
|
62
64
|
default: true
|
|
63
65
|
},
|
|
64
66
|
center: Boolean,
|
|
67
|
+
draggable: Boolean,
|
|
65
68
|
roundButton: {
|
|
66
69
|
default: false,
|
|
67
70
|
type: Boolean
|
|
@@ -120,8 +123,10 @@ const _sfc_main = defineComponent({
|
|
|
120
123
|
const btnSize = useSize(computed(() => props.buttonSize), { prop: true, form: true, formItem: true });
|
|
121
124
|
const iconComponent = computed(() => state.icon || TypeComponentsMap[state.type] || "");
|
|
122
125
|
const hasMessage = computed(() => !!state.message);
|
|
123
|
-
const
|
|
124
|
-
const
|
|
126
|
+
const rootRef = ref();
|
|
127
|
+
const headerRef = ref();
|
|
128
|
+
const inputRef = ref();
|
|
129
|
+
const confirmRef = ref();
|
|
125
130
|
const confirmButtonClasses = computed(() => state.confirmButtonClass);
|
|
126
131
|
watch(() => state.inputValue, async (val) => {
|
|
127
132
|
await nextTick();
|
|
@@ -152,6 +157,8 @@ const _sfc_main = defineComponent({
|
|
|
152
157
|
state.validateError = false;
|
|
153
158
|
}
|
|
154
159
|
});
|
|
160
|
+
const draggable = computed(() => props.draggable);
|
|
161
|
+
useDraggable(rootRef, headerRef, draggable);
|
|
155
162
|
onMounted(async () => {
|
|
156
163
|
await nextTick();
|
|
157
164
|
if (props.closeOnHashChange) {
|
|
@@ -177,6 +184,7 @@ const _sfc_main = defineComponent({
|
|
|
177
184
|
handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
|
|
178
185
|
}
|
|
179
186
|
};
|
|
187
|
+
const overlayEvent = useSameTarget(handleWrapperClick);
|
|
180
188
|
const handleInputEnter = () => {
|
|
181
189
|
if (state.inputType !== "textarea") {
|
|
182
190
|
return handleAction("confirm");
|
|
@@ -241,12 +249,15 @@ const _sfc_main = defineComponent({
|
|
|
241
249
|
useRestoreActive(visible);
|
|
242
250
|
return {
|
|
243
251
|
...toRefs(state),
|
|
252
|
+
overlayEvent,
|
|
244
253
|
visible,
|
|
245
254
|
hasMessage,
|
|
246
255
|
typeClass,
|
|
247
256
|
btnSize,
|
|
248
257
|
iconComponent,
|
|
249
258
|
confirmButtonClasses,
|
|
259
|
+
rootRef,
|
|
260
|
+
headerRef,
|
|
250
261
|
inputRef,
|
|
251
262
|
confirmRef,
|
|
252
263
|
doClose,
|
|
@@ -261,6 +272,7 @@ const _sfc_main = defineComponent({
|
|
|
261
272
|
const _hoisted_1 = ["aria-label"];
|
|
262
273
|
const _hoisted_2 = {
|
|
263
274
|
key: 0,
|
|
275
|
+
ref: "headerRef",
|
|
264
276
|
class: "el-message-box__header"
|
|
265
277
|
};
|
|
266
278
|
const _hoisted_3 = { class: "el-message-box__title" };
|
|
@@ -283,137 +295,145 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
283
295
|
const _directive_trap_focus = resolveDirective("trap-focus");
|
|
284
296
|
return openBlock(), createBlock(Transition, {
|
|
285
297
|
name: "fade-in-linear",
|
|
286
|
-
onAfterLeave: _cache[
|
|
298
|
+
onAfterLeave: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("vanish"))
|
|
287
299
|
}, {
|
|
288
300
|
default: withCtx(() => [
|
|
289
301
|
withDirectives(createVNode(_component_el_overlay, {
|
|
290
302
|
"z-index": _ctx.zIndex,
|
|
291
303
|
"overlay-class": ["is-message-box", _ctx.modalClass],
|
|
292
|
-
mask: _ctx.modal
|
|
293
|
-
onClick: withModifiers(_ctx.handleWrapperClick, ["self"])
|
|
304
|
+
mask: _ctx.modal
|
|
294
305
|
}, {
|
|
295
306
|
default: withCtx(() => [
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
class: normalizeClass([
|
|
302
|
-
"el-message-box",
|
|
303
|
-
_ctx.customClass,
|
|
304
|
-
{ "el-message-box--center": _ctx.center }
|
|
305
|
-
]),
|
|
306
|
-
style: normalizeStyle(_ctx.customStyle)
|
|
307
|
+
createElementVNode("div", {
|
|
308
|
+
class: "el-overlay-message-box",
|
|
309
|
+
onClick: _cache[8] || (_cache[8] = (...args) => _ctx.overlayEvent.onClick && _ctx.overlayEvent.onClick(...args)),
|
|
310
|
+
onMousedown: _cache[9] || (_cache[9] = (...args) => _ctx.overlayEvent.onMousedown && _ctx.overlayEvent.onMousedown(...args)),
|
|
311
|
+
onMouseup: _cache[10] || (_cache[10] = (...args) => _ctx.overlayEvent.onMouseup && _ctx.overlayEvent.onMouseup(...args))
|
|
307
312
|
}, [
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
313
|
+
withDirectives((openBlock(), createElementBlock("div", {
|
|
314
|
+
ref: "rootRef",
|
|
315
|
+
role: "dialog",
|
|
316
|
+
"aria-label": _ctx.title || "dialog",
|
|
317
|
+
"aria-modal": "true",
|
|
318
|
+
class: normalizeClass([
|
|
319
|
+
"el-message-box",
|
|
320
|
+
_ctx.customClass,
|
|
321
|
+
{ "el-message-box--center": _ctx.center, "is-draggable": _ctx.draggable }
|
|
322
|
+
]),
|
|
323
|
+
style: normalizeStyle(_ctx.customStyle),
|
|
324
|
+
onClick: _cache[7] || (_cache[7] = withModifiers(() => {
|
|
325
|
+
}, ["stop"]))
|
|
326
|
+
}, [
|
|
327
|
+
_ctx.title !== null && _ctx.title !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
328
|
+
createElementVNode("div", _hoisted_3, [
|
|
329
|
+
_ctx.iconComponent && _ctx.center ? (openBlock(), createBlock(_component_el_icon, {
|
|
330
|
+
key: 0,
|
|
331
|
+
class: normalizeClass(["el-message-box__status", _ctx.typeClass])
|
|
332
|
+
}, {
|
|
333
|
+
default: withCtx(() => [
|
|
334
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
|
|
335
|
+
]),
|
|
336
|
+
_: 1
|
|
337
|
+
}, 8, ["class"])) : createCommentVNode("v-if", true),
|
|
338
|
+
createElementVNode("span", null, toDisplayString(_ctx.title), 1)
|
|
339
|
+
]),
|
|
340
|
+
_ctx.showClose ? (openBlock(), createElementBlock("button", {
|
|
311
341
|
key: 0,
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
]),
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
342
|
+
type: "button",
|
|
343
|
+
class: "el-message-box__headerbtn",
|
|
344
|
+
"aria-label": "Close",
|
|
345
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel")),
|
|
346
|
+
onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"]))
|
|
347
|
+
}, [
|
|
348
|
+
createVNode(_component_el_icon, { class: "el-message-box__close" }, {
|
|
349
|
+
default: withCtx(() => [
|
|
350
|
+
createVNode(_component_close)
|
|
351
|
+
]),
|
|
352
|
+
_: 1
|
|
353
|
+
})
|
|
354
|
+
], 32)) : createCommentVNode("v-if", true)
|
|
355
|
+
], 512)) : createCommentVNode("v-if", true),
|
|
356
|
+
createElementVNode("div", _hoisted_4, [
|
|
357
|
+
createElementVNode("div", _hoisted_5, [
|
|
358
|
+
_ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (openBlock(), createBlock(_component_el_icon, {
|
|
359
|
+
key: 0,
|
|
360
|
+
class: normalizeClass(["el-message-box__status", _ctx.typeClass])
|
|
361
|
+
}, {
|
|
362
|
+
default: withCtx(() => [
|
|
363
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
|
|
364
|
+
]),
|
|
365
|
+
_: 1
|
|
366
|
+
}, 8, ["class"])) : createCommentVNode("v-if", true),
|
|
367
|
+
_ctx.hasMessage ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
368
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
369
|
+
!_ctx.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", _hoisted_7, toDisplayString(_ctx.message), 1)) : (openBlock(), createElementBlock("p", {
|
|
370
|
+
key: 1,
|
|
371
|
+
innerHTML: _ctx.message
|
|
372
|
+
}, null, 8, _hoisted_8))
|
|
373
|
+
])
|
|
374
|
+
])) : createCommentVNode("v-if", true)
|
|
375
|
+
]),
|
|
376
|
+
withDirectives(createElementVNode("div", _hoisted_9, [
|
|
377
|
+
createVNode(_component_el_input, {
|
|
378
|
+
ref: "inputRef",
|
|
379
|
+
modelValue: _ctx.inputValue,
|
|
380
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event),
|
|
381
|
+
type: _ctx.inputType,
|
|
382
|
+
placeholder: _ctx.inputPlaceholder,
|
|
383
|
+
class: normalizeClass({ invalid: _ctx.validateError }),
|
|
384
|
+
onKeydown: withKeys(withModifiers(_ctx.handleInputEnter, ["prevent"]), ["enter"])
|
|
385
|
+
}, null, 8, ["modelValue", "type", "placeholder", "class", "onKeydown"]),
|
|
386
|
+
createElementVNode("div", {
|
|
387
|
+
class: "el-message-box__errormsg",
|
|
388
|
+
style: normalizeStyle({
|
|
389
|
+
visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
|
|
390
|
+
})
|
|
391
|
+
}, toDisplayString(_ctx.editorErrorMessage), 5)
|
|
392
|
+
], 512), [
|
|
393
|
+
[vShow, _ctx.showInput]
|
|
394
|
+
])
|
|
320
395
|
]),
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
396
|
+
createElementVNode("div", _hoisted_10, [
|
|
397
|
+
_ctx.showCancelButton ? (openBlock(), createBlock(_component_el_button, {
|
|
398
|
+
key: 0,
|
|
399
|
+
loading: _ctx.cancelButtonLoading,
|
|
400
|
+
class: normalizeClass([_ctx.cancelButtonClass]),
|
|
401
|
+
round: _ctx.roundButton,
|
|
402
|
+
size: _ctx.btnSize,
|
|
403
|
+
onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")),
|
|
404
|
+
onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"]))
|
|
405
|
+
}, {
|
|
330
406
|
default: withCtx(() => [
|
|
331
|
-
|
|
407
|
+
createTextVNode(toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
|
|
332
408
|
]),
|
|
333
409
|
_: 1
|
|
334
|
-
})
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
410
|
+
}, 8, ["loading", "class", "round", "size"])) : createCommentVNode("v-if", true),
|
|
411
|
+
withDirectives(createVNode(_component_el_button, {
|
|
412
|
+
ref: "confirmRef",
|
|
413
|
+
type: "primary",
|
|
414
|
+
loading: _ctx.confirmButtonLoading,
|
|
415
|
+
class: normalizeClass([_ctx.confirmButtonClasses]),
|
|
416
|
+
round: _ctx.roundButton,
|
|
417
|
+
disabled: _ctx.confirmButtonDisabled,
|
|
418
|
+
size: _ctx.btnSize,
|
|
419
|
+
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")),
|
|
420
|
+
onKeydown: _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"]))
|
|
342
421
|
}, {
|
|
343
422
|
default: withCtx(() => [
|
|
344
|
-
(
|
|
423
|
+
createTextVNode(toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
|
|
345
424
|
]),
|
|
346
425
|
_: 1
|
|
347
|
-
}, 8, ["class"
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
!_ctx.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", _hoisted_7, toDisplayString(_ctx.message), 1)) : (openBlock(), createElementBlock("p", {
|
|
351
|
-
key: 1,
|
|
352
|
-
innerHTML: _ctx.message
|
|
353
|
-
}, null, 8, _hoisted_8))
|
|
354
|
-
])
|
|
355
|
-
])) : createCommentVNode("v-if", true)
|
|
356
|
-
]),
|
|
357
|
-
withDirectives(createElementVNode("div", _hoisted_9, [
|
|
358
|
-
createVNode(_component_el_input, {
|
|
359
|
-
ref: "inputRef",
|
|
360
|
-
modelValue: _ctx.inputValue,
|
|
361
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event),
|
|
362
|
-
type: _ctx.inputType,
|
|
363
|
-
placeholder: _ctx.inputPlaceholder,
|
|
364
|
-
class: normalizeClass({ invalid: _ctx.validateError }),
|
|
365
|
-
onKeydown: withKeys(withModifiers(_ctx.handleInputEnter, ["prevent"]), ["enter"])
|
|
366
|
-
}, null, 8, ["modelValue", "type", "placeholder", "class", "onKeydown"]),
|
|
367
|
-
createElementVNode("div", {
|
|
368
|
-
class: "el-message-box__errormsg",
|
|
369
|
-
style: normalizeStyle({
|
|
370
|
-
visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
|
|
371
|
-
})
|
|
372
|
-
}, toDisplayString(_ctx.editorErrorMessage), 5)
|
|
373
|
-
], 512), [
|
|
374
|
-
[vShow, _ctx.showInput]
|
|
375
|
-
])
|
|
376
|
-
]),
|
|
377
|
-
createElementVNode("div", _hoisted_10, [
|
|
378
|
-
_ctx.showCancelButton ? (openBlock(), createBlock(_component_el_button, {
|
|
379
|
-
key: 0,
|
|
380
|
-
loading: _ctx.cancelButtonLoading,
|
|
381
|
-
class: normalizeClass([_ctx.cancelButtonClass]),
|
|
382
|
-
round: _ctx.roundButton,
|
|
383
|
-
size: _ctx.btnSize,
|
|
384
|
-
onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")),
|
|
385
|
-
onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"]))
|
|
386
|
-
}, {
|
|
387
|
-
default: withCtx(() => [
|
|
388
|
-
createTextVNode(toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
|
|
389
|
-
]),
|
|
390
|
-
_: 1
|
|
391
|
-
}, 8, ["loading", "class", "round", "size"])) : createCommentVNode("v-if", true),
|
|
392
|
-
withDirectives(createVNode(_component_el_button, {
|
|
393
|
-
ref: "confirmRef",
|
|
394
|
-
type: "primary",
|
|
395
|
-
loading: _ctx.confirmButtonLoading,
|
|
396
|
-
class: normalizeClass([_ctx.confirmButtonClasses]),
|
|
397
|
-
round: _ctx.roundButton,
|
|
398
|
-
disabled: _ctx.confirmButtonDisabled,
|
|
399
|
-
size: _ctx.btnSize,
|
|
400
|
-
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")),
|
|
401
|
-
onKeydown: _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"]))
|
|
402
|
-
}, {
|
|
403
|
-
default: withCtx(() => [
|
|
404
|
-
createTextVNode(toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
|
|
405
|
-
]),
|
|
406
|
-
_: 1
|
|
407
|
-
}, 8, ["loading", "class", "round", "disabled", "size"]), [
|
|
408
|
-
[vShow, _ctx.showConfirmButton]
|
|
426
|
+
}, 8, ["loading", "class", "round", "disabled", "size"]), [
|
|
427
|
+
[vShow, _ctx.showConfirmButton]
|
|
428
|
+
])
|
|
409
429
|
])
|
|
430
|
+
], 14, _hoisted_1)), [
|
|
431
|
+
[_directive_trap_focus]
|
|
410
432
|
])
|
|
411
|
-
],
|
|
412
|
-
[_directive_trap_focus]
|
|
413
|
-
])
|
|
433
|
+
], 32)
|
|
414
434
|
]),
|
|
415
435
|
_: 3
|
|
416
|
-
}, 8, ["z-index", "overlay-class", "mask"
|
|
436
|
+
}, 8, ["z-index", "overlay-class", "mask"]), [
|
|
417
437
|
[vShow, _ctx.visible]
|
|
418
438
|
])
|
|
419
439
|
]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/message-box/src/index.vue"],"sourcesContent":["<template>\n <transition name=\"fade-in-linear\" @after-leave=\"$emit('vanish')\">\n <el-overlay\n v-show=\"visible\"\n :z-index=\"zIndex\"\n :overlay-class=\"['is-message-box', modalClass]\"\n :mask=\"modal\"\n @click.self=\"handleWrapperClick\"\n >\n <div\n ref=\"root\"\n v-trap-focus\n role=\"dialog\"\n :aria-label=\"title || 'dialog'\"\n aria-modal=\"true\"\n :class=\"[\n 'el-message-box',\n customClass,\n { 'el-message-box--center': center },\n ]\"\n :style=\"customStyle\"\n >\n <div\n v-if=\"title !== null && title !== undefined\"\n class=\"el-message-box__header\"\n >\n <div class=\"el-message-box__title\">\n <el-icon\n v-if=\"iconComponent && center\"\n class=\"el-message-box__status\"\n :class=\"typeClass\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <span>{{ title }}</span>\n </div>\n <button\n v-if=\"showClose\"\n type=\"button\"\n class=\"el-message-box__headerbtn\"\n aria-label=\"Close\"\n @click=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n @keydown.prevent.enter=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n >\n <el-icon class=\"el-message-box__close\"><close /></el-icon>\n </button>\n </div>\n <div class=\"el-message-box__content\">\n <div class=\"el-message-box__container\">\n <el-icon\n v-if=\"iconComponent && !center && hasMessage\"\n class=\"el-message-box__status\"\n :class=\"typeClass\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <div v-if=\"hasMessage\" class=\"el-message-box__message\">\n <slot>\n <p v-if=\"!dangerouslyUseHTMLString\">{{ message }}</p>\n <p v-else v-html=\"message\"></p>\n </slot>\n </div>\n </div>\n <div v-show=\"showInput\" class=\"el-message-box__input\">\n <el-input\n ref=\"inputRef\"\n v-model=\"inputValue\"\n :type=\"inputType\"\n :placeholder=\"inputPlaceholder\"\n :class=\"{ invalid: validateError }\"\n @keydown.prevent.enter=\"handleInputEnter\"\n />\n <div\n class=\"el-message-box__errormsg\"\n :style=\"{\n visibility: !!editorErrorMessage ? 'visible' : 'hidden',\n }\"\n >\n {{ editorErrorMessage }}\n </div>\n </div>\n </div>\n <div class=\"el-message-box__btns\">\n <el-button\n v-if=\"showCancelButton\"\n :loading=\"cancelButtonLoading\"\n :class=\"[cancelButtonClass]\"\n :round=\"roundButton\"\n :size=\"btnSize\"\n @click=\"handleAction('cancel')\"\n @keydown.prevent.enter=\"handleAction('cancel')\"\n >\n {{ cancelButtonText || t('el.messagebox.cancel') }}\n </el-button>\n <el-button\n v-show=\"showConfirmButton\"\n ref=\"confirmRef\"\n type=\"primary\"\n :loading=\"confirmButtonLoading\"\n :class=\"[confirmButtonClasses]\"\n :round=\"roundButton\"\n :disabled=\"confirmButtonDisabled\"\n :size=\"btnSize\"\n @click=\"handleAction('confirm')\"\n @keydown.prevent.enter=\"handleAction('confirm')\"\n >\n {{ confirmButtonText || t('el.messagebox.confirm') }}\n </el-button>\n </div>\n </div>\n </el-overlay>\n </transition>\n</template>\n<script lang=\"ts\">\nimport {\n defineComponent,\n nextTick,\n onMounted,\n onBeforeUnmount,\n computed,\n watch,\n reactive,\n ref,\n toRefs,\n} from 'vue'\nimport ElButton from '@element-plus/components/button'\nimport { TrapFocus } from '@element-plus/directives'\nimport {\n useModal,\n useLockscreen,\n useLocale,\n useRestoreActive,\n usePreventGlobal,\n useSize,\n} from '@element-plus/hooks'\nimport ElInput from '@element-plus/components/input'\nimport { ElOverlay } from '@element-plus/components/overlay'\nimport { PopupManager } from '@element-plus/utils/popup-manager'\nimport { on, off } from '@element-plus/utils/dom'\nimport { EVENT_CODE } from '@element-plus/utils/aria'\nimport { isValidComponentSize } from '@element-plus/utils/validators'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { TypeComponents, TypeComponentsMap } from '@element-plus/utils/icon'\n\nimport type { ComponentPublicInstance, PropType } from 'vue'\nimport type { ComponentSize } from '@element-plus/utils/types'\nimport type {\n Action,\n MessageBoxState,\n MessageBoxType,\n} from './message-box.type'\n\nexport default defineComponent({\n name: 'ElMessageBox',\n directives: {\n TrapFocus,\n },\n components: {\n ElButton,\n ElInput,\n ElOverlay,\n ElIcon,\n ...TypeComponents,\n },\n inheritAttrs: false,\n props: {\n buttonSize: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n modal: {\n type: Boolean,\n default: true,\n },\n lockScroll: {\n type: Boolean,\n default: true,\n },\n showClose: {\n type: Boolean,\n default: true,\n },\n closeOnClickModal: {\n type: Boolean,\n default: true,\n },\n closeOnPressEscape: {\n type: Boolean,\n default: true,\n },\n closeOnHashChange: {\n type: Boolean,\n default: true,\n },\n center: Boolean,\n roundButton: {\n default: false,\n type: Boolean,\n },\n container: {\n type: String, // default append to body\n default: 'body',\n },\n boxType: {\n type: String as PropType<MessageBoxType>,\n default: '',\n },\n },\n emits: ['vanish', 'action'],\n setup(props, { emit }) {\n // const popup = usePopup(props, doClose)\n const { t } = useLocale()\n const visible = ref(false)\n // s represents state\n const state = reactive<MessageBoxState>({\n beforeClose: null,\n callback: null,\n cancelButtonText: '',\n cancelButtonClass: '',\n confirmButtonText: '',\n confirmButtonClass: '',\n customClass: '',\n customStyle: {},\n dangerouslyUseHTMLString: false,\n distinguishCancelAndClose: false,\n icon: '',\n inputPattern: null,\n inputPlaceholder: '',\n inputType: 'text',\n inputValue: null,\n inputValidator: null,\n inputErrorMessage: '',\n message: null,\n modalFade: true,\n modalClass: '',\n showCancelButton: false,\n showConfirmButton: true,\n type: '',\n title: undefined,\n showInput: false,\n action: '' as Action,\n confirmButtonLoading: false,\n cancelButtonLoading: false,\n confirmButtonDisabled: false,\n editorErrorMessage: '',\n // refer to: https://github.com/ElemeFE/element/commit/2999279ae34ef10c373ca795c87b020ed6753eed\n // seemed ok for now without this state.\n // isOnComposition: false, // temporary remove\n validateError: false,\n zIndex: PopupManager.nextZIndex(),\n })\n\n const typeClass = computed(() => {\n const type = state.type\n return type && TypeComponentsMap[type]\n ? `el-message-box-icon--${type}`\n : ''\n })\n\n const btnSize = useSize(\n computed(() => props.buttonSize),\n { prop: true, form: true, formItem: true }\n )\n\n const iconComponent = computed(\n () => state.icon || TypeComponentsMap[state.type] || ''\n )\n const hasMessage = computed(() => !!state.message)\n const inputRef = ref<ComponentPublicInstance>(null)\n const confirmRef = ref<ComponentPublicInstance>(null)\n\n const confirmButtonClasses = computed(() => state.confirmButtonClass)\n\n watch(\n () => state.inputValue,\n async (val) => {\n await nextTick()\n if (props.boxType === 'prompt' && val !== null) {\n validate()\n }\n },\n { immediate: true }\n )\n\n watch(\n () => visible.value,\n (val) => {\n if (val) {\n if (props.boxType === 'alert' || props.boxType === 'confirm') {\n nextTick().then(() => {\n confirmRef.value?.$el?.focus?.()\n })\n }\n state.zIndex = PopupManager.nextZIndex()\n }\n if (props.boxType !== 'prompt') return\n if (val) {\n nextTick().then(() => {\n if (inputRef.value && inputRef.value.$el) {\n getInputElement().focus()\n }\n })\n } else {\n state.editorErrorMessage = ''\n state.validateError = false\n }\n }\n )\n\n onMounted(async () => {\n await nextTick()\n if (props.closeOnHashChange) {\n on(window, 'hashchange', doClose)\n }\n })\n\n onBeforeUnmount(() => {\n if (props.closeOnHashChange) {\n off(window, 'hashchange', doClose)\n }\n })\n\n function doClose() {\n if (!visible.value) return\n visible.value = false\n nextTick(() => {\n if (state.action) emit('action', state.action)\n })\n }\n\n const handleWrapperClick = () => {\n if (props.closeOnClickModal) {\n handleAction(state.distinguishCancelAndClose ? 'close' : 'cancel')\n }\n }\n\n const handleInputEnter = () => {\n if (state.inputType !== 'textarea') {\n return handleAction('confirm')\n }\n }\n\n const handleAction = (action: Action) => {\n if (props.boxType === 'prompt' && action === 'confirm' && !validate()) {\n return\n }\n\n state.action = action\n\n if (state.beforeClose) {\n state.beforeClose?.(action, state, doClose)\n } else {\n doClose()\n }\n }\n\n const validate = () => {\n if (props.boxType === 'prompt') {\n const inputPattern = state.inputPattern\n if (inputPattern && !inputPattern.test(state.inputValue || '')) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n const inputValidator = state.inputValidator\n if (typeof inputValidator === 'function') {\n const validateResult = inputValidator(state.inputValue)\n if (validateResult === false) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n if (typeof validateResult === 'string') {\n state.editorErrorMessage = validateResult\n state.validateError = true\n return false\n }\n }\n }\n state.editorErrorMessage = ''\n state.validateError = false\n return true\n }\n\n const getInputElement = () => {\n const inputRefs = inputRef.value.$refs\n return (inputRefs.input || inputRefs.textarea) as HTMLElement\n }\n\n const handleClose = () => {\n handleAction('close')\n }\n\n // when close on press escape is disabled, pressing esc should not callout\n // any other message box and close any other dialog-ish elements\n // e.g. Dialog has a close on press esc feature, and when it closes, it calls\n // props.beforeClose method to make a intermediate state by callout a message box\n // for some verification or alerting. then if we allow global event liek this\n // to dispatch, it could callout another message box.\n if (props.closeOnPressEscape) {\n useModal(\n {\n handleClose,\n },\n visible\n )\n } else {\n usePreventGlobal(\n visible,\n 'keydown',\n (e: KeyboardEvent) => e.code === EVENT_CODE.esc\n )\n }\n\n // locks the screen to prevent scroll\n if (props.lockScroll) {\n useLockscreen(visible)\n }\n\n // restore to prev active element.\n useRestoreActive(visible)\n\n return {\n ...toRefs(state),\n visible,\n hasMessage,\n typeClass,\n btnSize,\n iconComponent,\n confirmButtonClasses,\n inputRef,\n confirmRef,\n doClose, // for outside usage\n handleClose, // for out side usage\n handleWrapperClick,\n handleInputEnter,\n handleAction,\n t,\n }\n },\n})\n</script>\n"],"names":["_withCtx"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4JA,MAAK,YAAa,gBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,IACV;AAAA;AAAA,EAEF,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,OACG;AAAA;AAAA,EAEL,cAAc;AAAA,EACd,OAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAM;AAAA,MACN,WAAW;AAAA;AAAA,IAEb,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AA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E;AACA;AAAqC;AAGvC;AACE;AAAa;AASf;AACE;AACE,QACE;AAAA;AAEF;AAGF;AAG8C;AAKhD;AACE;AAAc;AAIhB;AAEA;AAAO;AACK;AACV,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;;;AAnaS;;;;;;;AAoCyB;;;;;;;;;;;;;;AA3DL;AAAE;;;AACjC;AAEkB;AACF;AACF,QACX,WAAK;AAAA;;;;AAGM,iBAENA;AAAA;AACH,YACD;AAAiB,YAChB,cAAK;AAAA;;AAA0C;;;;aAQxC;AAAA,kCADR;AAaQ;AAP2B;;AACxB;;;AAGL;;;;AAEsB;;;gBAIxB;AAAI;AACC,gBACL;AAAA,gBACC,cAAK;AAAA,gBAAiB;gBAGgB;;AAIvC,iDAAgD;AAAA;AAAA;;;;;kBAGpD;AAAA;AAeQ;AAZ4B;;AACzB;;;AAGL;;;;AAEmB;AAIZ,8BAFK;AAAwB,kEAClC,oBAA+B;;AAArB;;;;;;AAYZ;AANc;;kBAEb;AAAe,kBACf;AAAW,kBACX;AAAK,kBACL;AAAuB;;AASpB;AANE,yBACA;AAAA,wCAAkC;AAAA;;;;AAXtB;;;;AAqBE;;AACrB;AACK,gBACL;AAAkB,gBAClB,OAAM;AAAA,gBACN;AAAK,gBACL;AAAO;;;;;;;AAiBE;AAXM,qBACZ;AAAA;AACH,gBACA;AAAK,gBACL;AAAkB,gBAClB;AAAU,gBACV;AAAM,gBACN,WAAK;AAAA,gBACL;AAAO;;;;;;;AATiB;;;;;;;;;AAhGhB;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/message-box/src/index.vue"],"sourcesContent":["<template>\n <transition name=\"fade-in-linear\" @after-leave=\"$emit('vanish')\">\n <el-overlay\n v-show=\"visible\"\n :z-index=\"zIndex\"\n :overlay-class=\"['is-message-box', modalClass]\"\n :mask=\"modal\"\n >\n <div\n class=\"el-overlay-message-box\"\n @click=\"overlayEvent.onClick\"\n @mousedown=\"overlayEvent.onMousedown\"\n @mouseup=\"overlayEvent.onMouseup\"\n >\n <div\n ref=\"rootRef\"\n v-trap-focus\n role=\"dialog\"\n :aria-label=\"title || 'dialog'\"\n aria-modal=\"true\"\n :class=\"[\n 'el-message-box',\n customClass,\n { 'el-message-box--center': center, 'is-draggable': draggable },\n ]\"\n :style=\"customStyle\"\n @click.stop=\"\"\n >\n <div\n v-if=\"title !== null && title !== undefined\"\n ref=\"headerRef\"\n class=\"el-message-box__header\"\n >\n <div class=\"el-message-box__title\">\n <el-icon\n v-if=\"iconComponent && center\"\n class=\"el-message-box__status\"\n :class=\"typeClass\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <span>{{ title }}</span>\n </div>\n <button\n v-if=\"showClose\"\n type=\"button\"\n class=\"el-message-box__headerbtn\"\n aria-label=\"Close\"\n @click=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n @keydown.prevent.enter=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n >\n <el-icon class=\"el-message-box__close\">\n <close />\n </el-icon>\n </button>\n </div>\n <div class=\"el-message-box__content\">\n <div class=\"el-message-box__container\">\n <el-icon\n v-if=\"iconComponent && !center && hasMessage\"\n class=\"el-message-box__status\"\n :class=\"typeClass\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <div v-if=\"hasMessage\" class=\"el-message-box__message\">\n <slot>\n <p v-if=\"!dangerouslyUseHTMLString\">{{ message }}</p>\n <p v-else v-html=\"message\"></p>\n </slot>\n </div>\n </div>\n <div v-show=\"showInput\" class=\"el-message-box__input\">\n <el-input\n ref=\"inputRef\"\n v-model=\"inputValue\"\n :type=\"inputType\"\n :placeholder=\"inputPlaceholder\"\n :class=\"{ invalid: validateError }\"\n @keydown.prevent.enter=\"handleInputEnter\"\n />\n <div\n class=\"el-message-box__errormsg\"\n :style=\"{\n visibility: !!editorErrorMessage ? 'visible' : 'hidden',\n }\"\n >\n {{ editorErrorMessage }}\n </div>\n </div>\n </div>\n <div class=\"el-message-box__btns\">\n <el-button\n v-if=\"showCancelButton\"\n :loading=\"cancelButtonLoading\"\n :class=\"[cancelButtonClass]\"\n :round=\"roundButton\"\n :size=\"btnSize\"\n @click=\"handleAction('cancel')\"\n @keydown.prevent.enter=\"handleAction('cancel')\"\n >\n {{ cancelButtonText || t('el.messagebox.cancel') }}\n </el-button>\n <el-button\n v-show=\"showConfirmButton\"\n ref=\"confirmRef\"\n type=\"primary\"\n :loading=\"confirmButtonLoading\"\n :class=\"[confirmButtonClasses]\"\n :round=\"roundButton\"\n :disabled=\"confirmButtonDisabled\"\n :size=\"btnSize\"\n @click=\"handleAction('confirm')\"\n @keydown.prevent.enter=\"handleAction('confirm')\"\n >\n {{ confirmButtonText || t('el.messagebox.confirm') }}\n </el-button>\n </div>\n </div>\n </div>\n </el-overlay>\n </transition>\n</template>\n<script lang=\"ts\">\nimport {\n defineComponent,\n nextTick,\n onMounted,\n onBeforeUnmount,\n computed,\n watch,\n reactive,\n ref,\n toRefs,\n} from 'vue'\nimport ElButton from '@element-plus/components/button'\nimport { TrapFocus } from '@element-plus/directives'\nimport {\n useModal,\n useLockscreen,\n useLocale,\n useRestoreActive,\n usePreventGlobal,\n useSize,\n useDraggable,\n useSameTarget,\n} from '@element-plus/hooks'\nimport ElInput from '@element-plus/components/input'\nimport { ElOverlay } from '@element-plus/components/overlay'\nimport { PopupManager } from '@element-plus/utils/popup-manager'\nimport { on, off } from '@element-plus/utils/dom'\nimport { EVENT_CODE } from '@element-plus/utils/aria'\nimport { isValidComponentSize } from '@element-plus/utils/validators'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { TypeComponents, TypeComponentsMap } from '@element-plus/utils/icon'\n\nimport type { PropType } from 'vue'\nimport type { ComponentSize } from '@element-plus/utils/types'\nimport type {\n Action,\n MessageBoxState,\n MessageBoxType,\n} from './message-box.type'\n\nexport default defineComponent({\n name: 'ElMessageBox',\n directives: {\n TrapFocus,\n },\n components: {\n ElButton,\n ElInput,\n ElOverlay,\n ElIcon,\n ...TypeComponents,\n },\n inheritAttrs: false,\n props: {\n buttonSize: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n modal: {\n type: Boolean,\n default: true,\n },\n lockScroll: {\n type: Boolean,\n default: true,\n },\n showClose: {\n type: Boolean,\n default: true,\n },\n closeOnClickModal: {\n type: Boolean,\n default: true,\n },\n closeOnPressEscape: {\n type: Boolean,\n default: true,\n },\n closeOnHashChange: {\n type: Boolean,\n default: true,\n },\n center: Boolean,\n draggable: Boolean,\n roundButton: {\n default: false,\n type: Boolean,\n },\n container: {\n type: String, // default append to body\n default: 'body',\n },\n boxType: {\n type: String as PropType<MessageBoxType>,\n default: '',\n },\n },\n emits: ['vanish', 'action'],\n setup(props, { emit }) {\n // const popup = usePopup(props, doClose)\n const { t } = useLocale()\n const visible = ref(false)\n // s represents state\n const state = reactive<MessageBoxState>({\n beforeClose: null,\n callback: null,\n cancelButtonText: '',\n cancelButtonClass: '',\n confirmButtonText: '',\n confirmButtonClass: '',\n customClass: '',\n customStyle: {},\n dangerouslyUseHTMLString: false,\n distinguishCancelAndClose: false,\n icon: '',\n inputPattern: null,\n inputPlaceholder: '',\n inputType: 'text',\n inputValue: null,\n inputValidator: null,\n inputErrorMessage: '',\n message: null,\n modalFade: true,\n modalClass: '',\n showCancelButton: false,\n showConfirmButton: true,\n type: '',\n title: undefined,\n showInput: false,\n action: '' as Action,\n confirmButtonLoading: false,\n cancelButtonLoading: false,\n confirmButtonDisabled: false,\n editorErrorMessage: '',\n // refer to: https://github.com/ElemeFE/element/commit/2999279ae34ef10c373ca795c87b020ed6753eed\n // seemed ok for now without this state.\n // isOnComposition: false, // temporary remove\n validateError: false,\n zIndex: PopupManager.nextZIndex(),\n })\n\n const typeClass = computed(() => {\n const type = state.type\n return type && TypeComponentsMap[type]\n ? `el-message-box-icon--${type}`\n : ''\n })\n\n const btnSize = useSize(\n computed(() => props.buttonSize),\n { prop: true, form: true, formItem: true }\n )\n\n const iconComponent = computed(\n () => state.icon || TypeComponentsMap[state.type] || ''\n )\n const hasMessage = computed(() => !!state.message)\n const rootRef = ref<HTMLElement>()\n const headerRef = ref<HTMLElement>()\n const inputRef = ref<HTMLElement>()\n const confirmRef = ref<HTMLElement>()\n\n const confirmButtonClasses = computed(() => state.confirmButtonClass)\n\n watch(\n () => state.inputValue,\n async (val) => {\n await nextTick()\n if (props.boxType === 'prompt' && val !== null) {\n validate()\n }\n },\n { immediate: true }\n )\n\n watch(\n () => visible.value,\n (val) => {\n if (val) {\n if (props.boxType === 'alert' || props.boxType === 'confirm') {\n nextTick().then(() => {\n confirmRef.value?.$el?.focus?.()\n })\n }\n state.zIndex = PopupManager.nextZIndex()\n }\n if (props.boxType !== 'prompt') return\n if (val) {\n nextTick().then(() => {\n if (inputRef.value && inputRef.value.$el) {\n getInputElement().focus()\n }\n })\n } else {\n state.editorErrorMessage = ''\n state.validateError = false\n }\n }\n )\n\n const draggable = computed(() => props.draggable)\n useDraggable(rootRef, headerRef, draggable)\n\n onMounted(async () => {\n await nextTick()\n if (props.closeOnHashChange) {\n on(window, 'hashchange', doClose)\n }\n })\n\n onBeforeUnmount(() => {\n if (props.closeOnHashChange) {\n off(window, 'hashchange', doClose)\n }\n })\n\n function doClose() {\n if (!visible.value) return\n visible.value = false\n nextTick(() => {\n if (state.action) emit('action', state.action)\n })\n }\n\n const handleWrapperClick = () => {\n if (props.closeOnClickModal) {\n handleAction(state.distinguishCancelAndClose ? 'close' : 'cancel')\n }\n }\n\n const overlayEvent = useSameTarget(handleWrapperClick)\n\n const handleInputEnter = () => {\n if (state.inputType !== 'textarea') {\n return handleAction('confirm')\n }\n }\n\n const handleAction = (action: Action) => {\n if (props.boxType === 'prompt' && action === 'confirm' && !validate()) {\n return\n }\n\n state.action = action\n\n if (state.beforeClose) {\n state.beforeClose?.(action, state, doClose)\n } else {\n doClose()\n }\n }\n\n const validate = () => {\n if (props.boxType === 'prompt') {\n const inputPattern = state.inputPattern\n if (inputPattern && !inputPattern.test(state.inputValue || '')) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n const inputValidator = state.inputValidator\n if (typeof inputValidator === 'function') {\n const validateResult = inputValidator(state.inputValue)\n if (validateResult === false) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n if (typeof validateResult === 'string') {\n state.editorErrorMessage = validateResult\n state.validateError = true\n return false\n }\n }\n }\n state.editorErrorMessage = ''\n state.validateError = false\n return true\n }\n\n const getInputElement = () => {\n const inputRefs = inputRef.value.$refs\n return (inputRefs.input || inputRefs.textarea) as HTMLElement\n }\n\n const handleClose = () => {\n handleAction('close')\n }\n\n // when close on press escape is disabled, pressing esc should not callout\n // any other message box and close any other dialog-ish elements\n // e.g. Dialog has a close on press esc feature, and when it closes, it calls\n // props.beforeClose method to make a intermediate state by callout a message box\n // for some verification or alerting. then if we allow global event liek this\n // to dispatch, it could callout another message box.\n if (props.closeOnPressEscape) {\n useModal(\n {\n handleClose,\n },\n visible\n )\n } else {\n usePreventGlobal(\n visible,\n 'keydown',\n (e: KeyboardEvent) => e.code === EVENT_CODE.esc\n )\n }\n\n // locks the screen to prevent scroll\n if (props.lockScroll) {\n useLockscreen(visible)\n }\n\n // restore to prev active element.\n useRestoreActive(visible)\n\n return {\n ...toRefs(state),\n overlayEvent,\n visible,\n hasMessage,\n typeClass,\n btnSize,\n iconComponent,\n confirmButtonClasses,\n rootRef,\n headerRef,\n inputRef,\n confirmRef,\n doClose, // for outside usage\n handleClose, // for out side usage\n handleWrapperClick,\n handleInputEnter,\n handleAction,\n t,\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwKA,MAAK,YAAa,gBAAa;AAAA,EAC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ANE,2BACA;AAAA,0CAAoC;AAAA;;;;AAXxB;;;;AAqBE;;AACrB;AACK,kBACL;AAAkB,kBAClB,OAAM;AAAA,kBACN;AAAK,kBACL;AAAO;;;;;;;AAiBE;AAXM,uBACZ;AAAA;AACH,kBACA;AAAK,kBACL;AAAkB,kBAClB;AAAU,kBACV;AAAM,kBACN,WAAK;AAAA,kBACL;AAAO;;;;;;;AATiB;;;;;;;;;;AAzGlB;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
2
|
import type { ComponentSize } from 'element-plus/es/utils/types';
|
|
3
3
|
import type { Action, MessageBoxState, MessageBoxType } from './message-box.type';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -31,6 +31,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
31
31
|
default: boolean;
|
|
32
32
|
};
|
|
33
33
|
center: BooleanConstructor;
|
|
34
|
+
draggable: BooleanConstructor;
|
|
34
35
|
roundButton: {
|
|
35
36
|
default: boolean;
|
|
36
37
|
type: BooleanConstructor;
|
|
@@ -44,14 +45,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
44
45
|
default: string;
|
|
45
46
|
};
|
|
46
47
|
}, {
|
|
48
|
+
overlayEvent: {
|
|
49
|
+
onClick: (e: MouseEvent) => void;
|
|
50
|
+
onMousedown: (e: MouseEvent) => void;
|
|
51
|
+
onMouseup: (e: MouseEvent) => void;
|
|
52
|
+
};
|
|
47
53
|
visible: import("vue").Ref<boolean>;
|
|
48
54
|
hasMessage: import("vue").ComputedRef<boolean>;
|
|
49
55
|
typeClass: import("vue").ComputedRef<string>;
|
|
50
56
|
btnSize: import("vue").ComputedRef<ComponentSize>;
|
|
51
57
|
iconComponent: import("vue").ComputedRef<any>;
|
|
52
58
|
confirmButtonClasses: import("vue").ComputedRef<string>;
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
rootRef: import("vue").Ref<HTMLElement | undefined>;
|
|
60
|
+
headerRef: import("vue").Ref<HTMLElement | undefined>;
|
|
61
|
+
inputRef: import("vue").Ref<HTMLElement | undefined>;
|
|
62
|
+
confirmRef: import("vue").Ref<HTMLElement | undefined>;
|
|
55
63
|
doClose: () => void;
|
|
56
64
|
handleClose: () => void;
|
|
57
65
|
handleWrapperClick: () => void;
|
|
@@ -220,7 +228,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
220
228
|
unmounted?: (() => void) | undefined;
|
|
221
229
|
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
222
230
|
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
223
|
-
errorCaptured?: ((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | undefined;
|
|
231
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | undefined;
|
|
224
232
|
delimiters?: [string, string] | undefined;
|
|
225
233
|
__differentiator?: string | number | symbol | undefined;
|
|
226
234
|
__isBuiltIn?: boolean | undefined;
|
|
@@ -1825,6 +1833,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1825
1833
|
default: boolean;
|
|
1826
1834
|
};
|
|
1827
1835
|
center: BooleanConstructor;
|
|
1836
|
+
draggable: BooleanConstructor;
|
|
1828
1837
|
roundButton: {
|
|
1829
1838
|
default: boolean;
|
|
1830
1839
|
type: BooleanConstructor;
|
|
@@ -1842,6 +1851,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1842
1851
|
onAction?: ((...args: any[]) => any) | undefined;
|
|
1843
1852
|
}, {
|
|
1844
1853
|
center: boolean;
|
|
1854
|
+
draggable: boolean;
|
|
1845
1855
|
showClose: boolean;
|
|
1846
1856
|
closeOnClickModal: boolean;
|
|
1847
1857
|
closeOnPressEscape: boolean;
|
|
@@ -65,6 +65,8 @@ export interface ElMessageBoxOptions {
|
|
|
65
65
|
confirmButtonClass?: string;
|
|
66
66
|
/** Whether to align the content in center */
|
|
67
67
|
center?: boolean;
|
|
68
|
+
/** Whether MessageBox can be drag */
|
|
69
|
+
draggable?: boolean;
|
|
68
70
|
/** Content of the MessageBox */
|
|
69
71
|
message?: string | VNode;
|
|
70
72
|
/** Title of the MessageBox */
|
|
@@ -1,39 +1,43 @@
|
|
|
1
1
|
export declare const ElPopconfirm: import("../../utils/types").SFCWithInstall<import("vue").DefineComponent<{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
teleported: import("../../utils/props").BuildPropReturn<BooleanConstructor, boolean | (() => false) | (() => true) | undefined, unknown, unknown, unknown>;
|
|
3
|
+
title: import("../../utils/props").BuildPropReturn<StringConstructor, unknown, unknown, unknown, unknown>;
|
|
4
|
+
confirmButtonText: import("../../utils/props").BuildPropReturn<StringConstructor, unknown, unknown, unknown, unknown>;
|
|
5
|
+
cancelButtonText: import("../../utils/props").BuildPropReturn<StringConstructor, unknown, unknown, unknown, unknown>;
|
|
6
|
+
confirmButtonType: import("../../utils/props").BuildPropReturn<StringConstructor, "primary", unknown, "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text", unknown>;
|
|
7
|
+
cancelButtonType: import("../../utils/props").BuildPropReturn<StringConstructor, "text", unknown, "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text", unknown>;
|
|
8
|
+
icon: import("../../utils/props").BuildPropReturn<import("../../utils/props").PropWrapper<string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>>, any, unknown, unknown, unknown>;
|
|
9
|
+
iconColor: import("../../utils/props").BuildPropReturn<StringConstructor, "#f90", unknown, unknown, unknown>;
|
|
10
|
+
hideIcon: import("../../utils/props").BuildPropReturn<BooleanConstructor, false, unknown, unknown, unknown>;
|
|
11
|
+
hideAfter: import("../../utils/props").BuildPropReturn<NumberConstructor, 200, unknown, unknown, unknown>;
|
|
12
|
+
onConfirm: import("../../utils/props").BuildPropReturn<import("../../utils/props").PropWrapper<(e: Event) => boolean | Promise<boolean>>, unknown, unknown, unknown, unknown>;
|
|
13
|
+
onCancel: import("../../utils/props").BuildPropReturn<import("../../utils/props").PropWrapper<(e: Event) => boolean | Promise<boolean>>, unknown, unknown, unknown, unknown>;
|
|
13
14
|
}, {
|
|
14
15
|
finalConfirmButtonText: import("vue").ComputedRef<string>;
|
|
15
16
|
finalCancelButtonText: import("vue").ComputedRef<string>;
|
|
16
17
|
tooltipRef: import("vue").Ref<{
|
|
17
18
|
onClose: () => void;
|
|
18
19
|
} | undefined>;
|
|
20
|
+
compatTeleported: import("vue").ComputedRef<boolean>;
|
|
19
21
|
confirm: (e: Event) => void;
|
|
20
22
|
cancel: (e: Event) => void;
|
|
21
23
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
teleported: import("../../utils/props").BuildPropReturn<BooleanConstructor, boolean | (() => false) | (() => true) | undefined, unknown, unknown, unknown>;
|
|
25
|
+
title: import("../../utils/props").BuildPropReturn<StringConstructor, unknown, unknown, unknown, unknown>;
|
|
26
|
+
confirmButtonText: import("../../utils/props").BuildPropReturn<StringConstructor, unknown, unknown, unknown, unknown>;
|
|
27
|
+
cancelButtonText: import("../../utils/props").BuildPropReturn<StringConstructor, unknown, unknown, unknown, unknown>;
|
|
28
|
+
confirmButtonType: import("../../utils/props").BuildPropReturn<StringConstructor, "primary", unknown, "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text", unknown>;
|
|
29
|
+
cancelButtonType: import("../../utils/props").BuildPropReturn<StringConstructor, "text", unknown, "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text", unknown>;
|
|
30
|
+
icon: import("../../utils/props").BuildPropReturn<import("../../utils/props").PropWrapper<string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>>, any, unknown, unknown, unknown>;
|
|
31
|
+
iconColor: import("../../utils/props").BuildPropReturn<StringConstructor, "#f90", unknown, unknown, unknown>;
|
|
32
|
+
hideIcon: import("../../utils/props").BuildPropReturn<BooleanConstructor, false, unknown, unknown, unknown>;
|
|
33
|
+
hideAfter: import("../../utils/props").BuildPropReturn<NumberConstructor, 200, unknown, unknown, unknown>;
|
|
34
|
+
onConfirm: import("../../utils/props").BuildPropReturn<import("../../utils/props").PropWrapper<(e: Event) => boolean | Promise<boolean>>, unknown, unknown, unknown, unknown>;
|
|
35
|
+
onCancel: import("../../utils/props").BuildPropReturn<import("../../utils/props").PropWrapper<(e: Event) => boolean | Promise<boolean>>, unknown, unknown, unknown, unknown>;
|
|
33
36
|
}>>, {
|
|
34
37
|
icon: import("../../utils/props").BuildPropType<import("../../utils/props").PropWrapper<string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>>, unknown, unknown>;
|
|
35
38
|
title: string;
|
|
36
39
|
hideAfter: number;
|
|
40
|
+
teleported: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
|
|
37
41
|
confirmButtonText: string;
|
|
38
42
|
cancelButtonText: string;
|
|
39
43
|
confirmButtonType: import("../../utils/props").BuildPropType<StringConstructor, "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text", unknown>;
|