@element-plus/nightly 0.0.20211230 → 0.0.20220103

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.
Files changed (258) hide show
  1. package/README.md +0 -8
  2. package/dist/index.css +1 -1
  3. package/dist/index.full.js +47534 -47521
  4. package/dist/index.full.min.js +6 -6
  5. package/dist/index.full.min.js.map +1 -1
  6. package/dist/index.full.min.mjs +6 -6
  7. package/dist/index.full.min.mjs.map +1 -1
  8. package/dist/index.full.mjs +183 -171
  9. package/es/components/button/index.d.ts +1 -1
  10. package/es/components/button/src/button.vue.d.ts +1 -1
  11. package/es/components/cascader/index.d.ts +6 -6
  12. package/es/components/cascader/src/index.vue.d.ts +3 -3
  13. package/es/components/checkbox/index.d.ts +4 -4
  14. package/es/components/checkbox/src/checkbox-button.vue.d.ts +1 -1
  15. package/es/components/checkbox/src/checkbox.vue.d.ts +2 -2
  16. package/es/components/checkbox/src/useCheckbox.d.ts +2 -2
  17. package/es/components/color-picker/index.d.ts +2 -2
  18. package/es/components/color-picker/src/index.vue.d.ts +1 -1
  19. package/es/components/config-provider/index.d.ts +8 -4
  20. package/es/components/config-provider/index.mjs +1 -1
  21. package/es/components/config-provider/index.mjs.map +1 -1
  22. package/es/components/config-provider/src/config-provider.d.ts +26 -1
  23. package/es/components/config-provider/src/config-provider.mjs +18 -4
  24. package/es/components/config-provider/src/config-provider.mjs.map +1 -1
  25. package/es/components/date-picker/index.d.ts +6 -6
  26. package/es/components/date-picker/src/date-picker.d.ts +3 -3
  27. package/es/components/descriptions/index.d.ts +1 -1
  28. package/es/components/descriptions/src/descriptions-cell.mjs +12 -3
  29. package/es/components/descriptions/src/descriptions-cell.mjs.map +1 -1
  30. package/es/components/descriptions/src/index.vue.d.ts +1 -1
  31. package/es/components/descriptions/src/index.vue_vue_type_script_lang.mjs +7 -2
  32. package/es/components/descriptions/src/index.vue_vue_type_script_lang.mjs.map +1 -1
  33. package/es/components/descriptions/src/index.vue_vue_type_template_id_788d3854_lang.mjs +14 -17
  34. package/es/components/descriptions/src/index.vue_vue_type_template_id_788d3854_lang.mjs.map +1 -1
  35. package/es/components/dialog/index.d.ts +2 -2
  36. package/es/components/dialog/src/dialog.vue.d.ts +2 -2
  37. package/es/components/dialog/src/use-dialog.mjs +1 -1
  38. package/es/components/dialog/src/use-dialog.mjs.map +1 -1
  39. package/es/components/drawer/index.d.ts +2 -2
  40. package/es/components/drawer/src/drawer.vue.d.ts +2 -2
  41. package/es/components/dropdown/index.d.ts +1 -1
  42. package/es/components/dropdown/src/dropdown.vue.d.ts +1 -1
  43. package/es/components/image/index.d.ts +2 -2
  44. package/es/components/image/src/image.vue.d.ts +2 -2
  45. package/es/components/input/index.d.ts +1 -1
  46. package/es/components/input/src/input.vue.d.ts +1 -1
  47. package/es/components/input-number/index.d.ts +3 -3
  48. package/es/components/input-number/src/input-number.vue.d.ts +3 -3
  49. package/es/components/loading/src/service.mjs +1 -1
  50. package/es/components/loading/src/service.mjs.map +1 -1
  51. package/es/components/message/src/message-method.mjs +1 -1
  52. package/es/components/message/src/message-method.mjs.map +1 -1
  53. package/es/components/message-box/src/index.vue_vue_type_script_lang.mjs +1 -1
  54. package/es/components/message-box/src/index.vue_vue_type_script_lang.mjs.map +1 -1
  55. package/es/components/message-box/src/index.vue_vue_type_template_id_7035e868_lang.mjs.map +1 -1
  56. package/es/components/notification/src/notification.vue.d.ts +2 -2
  57. package/es/components/notification/src/notify.mjs +1 -1
  58. package/es/components/notification/src/notify.mjs.map +1 -1
  59. package/es/components/overlay/index.d.ts +1 -1
  60. package/es/components/overlay/src/overlay.d.ts +1 -1
  61. package/es/components/popover/src/usePopover.mjs +1 -1
  62. package/es/components/popover/src/usePopover.mjs.map +1 -1
  63. package/es/components/popper/src/use-popper/index.mjs +1 -1
  64. package/es/components/popper/src/use-popper/index.mjs.map +1 -1
  65. package/es/components/radio/index.d.ts +3 -3
  66. package/es/components/radio/src/radio-button.vue.d.ts +1 -1
  67. package/es/components/radio/src/radio.d.ts +1 -1
  68. package/es/components/radio/src/radio.vue.d.ts +1 -1
  69. package/es/components/select/index.d.ts +1 -1
  70. package/es/components/select/src/select.vue.d.ts +1 -1
  71. package/es/components/select/src/useSelect.d.ts +1 -1
  72. package/es/components/select-v2/index.d.ts +2 -2
  73. package/es/components/select-v2/src/select.vue.d.ts +1 -1
  74. package/es/components/select-v2/src/useSelect.d.ts +1 -1
  75. package/es/components/table/index.d.ts +1 -1
  76. package/es/components/table/src/table/style-helper.d.ts +1 -1
  77. package/es/components/table/src/table.vue.d.ts +1 -1
  78. package/es/components/table/src/util.mjs +1 -1
  79. package/es/components/table/src/util.mjs.map +1 -1
  80. package/es/components/teleport/index.d.ts +1 -1
  81. package/es/components/teleport/src/teleport.vue.d.ts +1 -1
  82. package/es/components/time-picker/index.d.ts +6 -6
  83. package/es/components/time-picker/src/common/picker.vue.d.ts +4 -4
  84. package/es/components/time-picker/src/common/props.d.ts +1 -1
  85. package/es/components/time-picker/src/common/props.mjs +1 -1
  86. package/es/components/time-picker/src/common/props.mjs.map +1 -1
  87. package/es/components/time-picker/src/time-picker.d.ts +3 -3
  88. package/es/components/tree/src/model/tree-store.mjs +1 -1
  89. package/es/components/tree/src/model/tree-store.mjs.map +1 -1
  90. package/es/defaults.d.ts +11 -1
  91. package/es/hooks/index.mjs +1 -1
  92. package/es/hooks/use-common-props/index.d.ts +1 -1
  93. package/es/hooks/use-common-props/index.mjs +1 -3
  94. package/es/hooks/use-common-props/index.mjs.map +1 -1
  95. package/es/hooks/use-global-config/index.d.ts +14 -2
  96. package/es/hooks/use-global-config/index.mjs +26 -4
  97. package/es/hooks/use-global-config/index.mjs.map +1 -1
  98. package/es/hooks/use-popper/index.mjs +1 -1
  99. package/es/hooks/use-popper/index.mjs.map +1 -1
  100. package/es/index.d.ts +13 -2
  101. package/es/index.mjs +1 -1
  102. package/es/index.mjs.map +1 -1
  103. package/es/make-installer.d.ts +2 -2
  104. package/es/make-installer.mjs +14 -17
  105. package/es/make-installer.mjs.map +1 -1
  106. package/es/tokens/config-provider.d.ts +2 -2
  107. package/es/tokens/config-provider.mjs.map +1 -1
  108. package/es/utils/popup-manager.d.ts +5 -3
  109. package/es/utils/popup-manager.mjs +21 -25
  110. package/es/utils/popup-manager.mjs.map +1 -1
  111. package/es/utils/util.d.ts +2 -8
  112. package/es/utils/util.mjs +13 -10
  113. package/es/utils/util.mjs.map +1 -1
  114. package/es/version.d.ts +1 -1
  115. package/es/version.mjs +1 -1
  116. package/es/version.mjs.map +1 -1
  117. package/global.d.ts +13 -0
  118. package/lib/components/button/index.d.ts +1 -1
  119. package/lib/components/button/src/button.vue.d.ts +1 -1
  120. package/lib/components/cascader/index.d.ts +6 -6
  121. package/lib/components/cascader/src/index.vue.d.ts +3 -3
  122. package/lib/components/checkbox/index.d.ts +4 -4
  123. package/lib/components/checkbox/src/checkbox-button.vue.d.ts +1 -1
  124. package/lib/components/checkbox/src/checkbox.vue.d.ts +2 -2
  125. package/lib/components/checkbox/src/useCheckbox.d.ts +2 -2
  126. package/lib/components/color-picker/index.d.ts +2 -2
  127. package/lib/components/color-picker/src/index.vue.d.ts +1 -1
  128. package/lib/components/config-provider/index.d.ts +8 -4
  129. package/lib/components/config-provider/index.js +1 -2
  130. package/lib/components/config-provider/index.js.map +1 -1
  131. package/lib/components/config-provider/src/config-provider.d.ts +26 -1
  132. package/lib/components/config-provider/src/config-provider.js +17 -2
  133. package/lib/components/config-provider/src/config-provider.js.map +1 -1
  134. package/lib/components/date-picker/index.d.ts +6 -6
  135. package/lib/components/date-picker/src/date-picker.d.ts +3 -3
  136. package/lib/components/descriptions/index.d.ts +1 -1
  137. package/lib/components/descriptions/src/descriptions-cell.js +12 -3
  138. package/lib/components/descriptions/src/descriptions-cell.js.map +1 -1
  139. package/lib/components/descriptions/src/index.vue.d.ts +1 -1
  140. package/lib/components/descriptions/src/index.vue_vue_type_script_lang.js +6 -1
  141. package/lib/components/descriptions/src/index.vue_vue_type_script_lang.js.map +1 -1
  142. package/lib/components/descriptions/src/index.vue_vue_type_template_id_788d3854_lang.js +13 -16
  143. package/lib/components/descriptions/src/index.vue_vue_type_template_id_788d3854_lang.js.map +1 -1
  144. package/lib/components/dialog/index.d.ts +2 -2
  145. package/lib/components/dialog/src/dialog.vue.d.ts +2 -2
  146. package/lib/components/dialog/src/use-dialog.js +2 -2
  147. package/lib/components/dialog/src/use-dialog.js.map +1 -1
  148. package/lib/components/drawer/index.d.ts +2 -2
  149. package/lib/components/drawer/src/drawer.vue.d.ts +2 -2
  150. package/lib/components/dropdown/index.d.ts +1 -1
  151. package/lib/components/dropdown/src/dropdown.vue.d.ts +1 -1
  152. package/lib/components/image/index.d.ts +2 -2
  153. package/lib/components/image/src/image.vue.d.ts +2 -2
  154. package/lib/components/input/index.d.ts +1 -1
  155. package/lib/components/input/src/input.vue.d.ts +1 -1
  156. package/lib/components/input-number/index.d.ts +3 -3
  157. package/lib/components/input-number/src/input-number.vue.d.ts +3 -3
  158. package/lib/components/loading/src/service.js +1 -1
  159. package/lib/components/loading/src/service.js.map +1 -1
  160. package/lib/components/message/src/message-method.js +1 -1
  161. package/lib/components/message/src/message-method.js.map +1 -1
  162. package/lib/components/message-box/src/index.vue_vue_type_script_lang.js +2 -2
  163. package/lib/components/message-box/src/index.vue_vue_type_script_lang.js.map +1 -1
  164. package/lib/components/message-box/src/index.vue_vue_type_template_id_7035e868_lang.js.map +1 -1
  165. package/lib/components/notification/src/notification.vue.d.ts +2 -2
  166. package/lib/components/notification/src/notify.js +1 -1
  167. package/lib/components/notification/src/notify.js.map +1 -1
  168. package/lib/components/overlay/index.d.ts +1 -1
  169. package/lib/components/overlay/src/overlay.d.ts +1 -1
  170. package/lib/components/popover/src/usePopover.js +2 -2
  171. package/lib/components/popover/src/usePopover.js.map +1 -1
  172. package/lib/components/popper/src/use-popper/index.js +2 -2
  173. package/lib/components/popper/src/use-popper/index.js.map +1 -1
  174. package/lib/components/radio/index.d.ts +3 -3
  175. package/lib/components/radio/src/radio-button.vue.d.ts +1 -1
  176. package/lib/components/radio/src/radio.d.ts +1 -1
  177. package/lib/components/radio/src/radio.vue.d.ts +1 -1
  178. package/lib/components/select/index.d.ts +1 -1
  179. package/lib/components/select/src/select.vue.d.ts +1 -1
  180. package/lib/components/select/src/useSelect.d.ts +1 -1
  181. package/lib/components/select-v2/index.d.ts +2 -2
  182. package/lib/components/select-v2/src/select.vue.d.ts +1 -1
  183. package/lib/components/select-v2/src/useSelect.d.ts +1 -1
  184. package/lib/components/table/index.d.ts +1 -1
  185. package/lib/components/table/src/table/style-helper.d.ts +1 -1
  186. package/lib/components/table/src/table.vue.d.ts +1 -1
  187. package/lib/components/table/src/util.js +1 -1
  188. package/lib/components/table/src/util.js.map +1 -1
  189. package/lib/components/teleport/index.d.ts +1 -1
  190. package/lib/components/teleport/src/teleport.vue.d.ts +1 -1
  191. package/lib/components/time-picker/index.d.ts +6 -6
  192. package/lib/components/time-picker/src/common/picker.vue.d.ts +4 -4
  193. package/lib/components/time-picker/src/common/props.d.ts +1 -1
  194. package/lib/components/time-picker/src/common/props.js +1 -1
  195. package/lib/components/time-picker/src/common/props.js.map +1 -1
  196. package/lib/components/time-picker/src/time-picker.d.ts +3 -3
  197. package/lib/components/tree/src/model/tree-store.js +1 -1
  198. package/lib/components/tree/src/model/tree-store.js.map +1 -1
  199. package/lib/defaults.d.ts +11 -1
  200. package/lib/hooks/index.js +1 -0
  201. package/lib/hooks/index.js.map +1 -1
  202. package/lib/hooks/use-common-props/index.d.ts +1 -1
  203. package/lib/hooks/use-common-props/index.js +1 -3
  204. package/lib/hooks/use-common-props/index.js.map +1 -1
  205. package/lib/hooks/use-global-config/index.d.ts +14 -2
  206. package/lib/hooks/use-global-config/index.js +25 -2
  207. package/lib/hooks/use-global-config/index.js.map +1 -1
  208. package/lib/hooks/use-popper/index.js +2 -2
  209. package/lib/hooks/use-popper/index.js.map +1 -1
  210. package/lib/index.d.ts +13 -2
  211. package/lib/index.js +1 -0
  212. package/lib/index.js.map +1 -1
  213. package/lib/make-installer.d.ts +2 -2
  214. package/lib/make-installer.js +14 -17
  215. package/lib/make-installer.js.map +1 -1
  216. package/lib/tokens/config-provider.d.ts +2 -2
  217. package/lib/tokens/config-provider.js.map +1 -1
  218. package/lib/utils/popup-manager.d.ts +5 -3
  219. package/lib/utils/popup-manager.js +21 -25
  220. package/lib/utils/popup-manager.js.map +1 -1
  221. package/lib/utils/util.d.ts +2 -8
  222. package/lib/utils/util.js +17 -13
  223. package/lib/utils/util.js.map +1 -1
  224. package/lib/version.d.ts +1 -1
  225. package/lib/version.js +1 -1
  226. package/lib/version.js.map +1 -1
  227. package/package.json +2 -2
  228. package/theme-chalk/el-button.css +1 -1
  229. package/theme-chalk/el-cascader-panel.css +1 -1
  230. package/theme-chalk/el-checkbox-button.css +1 -1
  231. package/theme-chalk/el-descriptions-item.css +1 -1
  232. package/theme-chalk/el-descriptions.css +1 -1
  233. package/theme-chalk/el-form.css +1 -1
  234. package/theme-chalk/el-input-number.css +1 -1
  235. package/theme-chalk/el-radio-button.css +1 -1
  236. package/theme-chalk/el-radio.css +1 -1
  237. package/theme-chalk/index.css +1 -1
  238. package/theme-chalk/src/cascader-panel.scss +1 -1
  239. package/theme-chalk/src/common/var.scss +2 -4
  240. package/theme-chalk/src/descriptions-item.scss +56 -2
  241. package/theme-chalk/src/descriptions.scss +75 -27
  242. package/theme-chalk/src/form.scss +2 -1
  243. package/theme-chalk/src/input-number.scss +13 -4
  244. package/theme-chalk/src/radio-button.scss +4 -4
  245. package/theme-chalk/src/radio.scss +1 -1
  246. package/web-types.json +1 -1
  247. package/es/components/config-provider/src/index.d.ts +0 -19
  248. package/es/components/config-provider/src/index.mjs +0 -22
  249. package/es/components/config-provider/src/index.mjs.map +0 -1
  250. package/es/utils/config.d.ts +0 -9
  251. package/es/utils/config.mjs +0 -10
  252. package/es/utils/config.mjs.map +0 -1
  253. package/lib/components/config-provider/src/index.d.ts +0 -19
  254. package/lib/components/config-provider/src/index.js +0 -26
  255. package/lib/components/config-provider/src/index.js.map +0 -1
  256. package/lib/utils/config.d.ts +0 -9
  257. package/lib/utils/config.js +0 -15
  258. package/lib/utils/config.js.map +0 -1
@@ -91,8 +91,8 @@ declare const _default: import("vue").DefineComponent<{
91
91
  withHeader: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
92
92
  modalFade: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
93
93
  } & {
94
- top?: string | undefined;
95
94
  zIndex?: number | undefined;
95
+ top?: string | undefined;
96
96
  width?: import("../../../utils/props").BuildPropType<readonly [StringConstructor, NumberConstructor], unknown, unknown> | undefined;
97
97
  beforeClose?: ((...args: any[]) => void) | undefined;
98
98
  modalClass?: string | undefined;
@@ -104,9 +104,9 @@ declare const _default: import("vue").DefineComponent<{
104
104
  onClosed?: (() => any) | undefined;
105
105
  }, {
106
106
  size: import("../../../utils/props").BuildPropType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
107
+ zIndex: number;
107
108
  top: string;
108
109
  title: string;
109
- zIndex: number;
110
110
  width: import("../../../utils/props").BuildPropType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
111
111
  center: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
112
112
  appendToBody: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
@@ -45,7 +45,7 @@ export declare const ElDropdown: import("../../utils/types").SFCWithInstall<impo
45
45
  visible: import("vue").Ref<boolean>;
46
46
  scrollbar: import("vue").Ref<null>;
47
47
  wrapStyle: import("vue").ComputedRef<import("vue").CSSProperties>;
48
- dropdownSize: import("vue").ComputedRef<"medium" | "mini" | import("../../utils/types").ComponentSize>;
48
+ dropdownSize: import("vue").ComputedRef<import("../../utils/types").ComponentSize>;
49
49
  handlerMainButtonClick: (event: any) => void;
50
50
  triggerVnode: import("vue").Ref<import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null>;
51
51
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "visible-change" | "command")[], "click" | "visible-change" | "command", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
@@ -50,7 +50,7 @@ declare const _default: import("vue").DefineComponent<{
50
50
  visible: import("vue").Ref<boolean>;
51
51
  scrollbar: import("vue").Ref<null>;
52
52
  wrapStyle: import("vue").ComputedRef<CSSProperties>;
53
- dropdownSize: import("vue").ComputedRef<"medium" | "mini" | import("../../../utils/types").ComponentSize>;
53
+ dropdownSize: import("vue").ComputedRef<import("../../../utils/types").ComponentSize>;
54
54
  handlerMainButtonClick: (event: any) => void;
55
55
  triggerVnode: import("vue").Ref<Nullable<ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>>>;
56
56
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "visible-change" | "command")[], "click" | "visible-change" | "command", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
@@ -37,8 +37,8 @@ export declare const ElImage: import("../../utils/types").SFCWithInstall<import(
37
37
  readonly zIndex?: unknown;
38
38
  readonly initialIndex?: unknown;
39
39
  } & {
40
- lazy: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
41
40
  zIndex: number;
41
+ lazy: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
42
42
  appendToBody: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
43
43
  src: string;
44
44
  fit: import("../../utils/props").BuildPropType<StringConstructor, "" | "fill" | "none" | "contain" | "cover" | "scale-down", unknown>;
@@ -52,8 +52,8 @@ export declare const ElImage: import("../../utils/types").SFCWithInstall<import(
52
52
  onError?: ((evt: Event) => any) | undefined;
53
53
  onSwitch?: ((val: number) => any) | undefined;
54
54
  }, {
55
- lazy: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
56
55
  zIndex: number;
56
+ lazy: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
57
57
  appendToBody: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
58
58
  src: string;
59
59
  fit: import("../../utils/props").BuildPropType<StringConstructor, "" | "fill" | "none" | "contain" | "cover" | "scale-down", unknown>;
@@ -38,8 +38,8 @@ declare const _default: import("vue").DefineComponent<{
38
38
  readonly zIndex?: unknown;
39
39
  readonly initialIndex?: unknown;
40
40
  } & {
41
- lazy: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
42
41
  zIndex: number;
42
+ lazy: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
43
43
  appendToBody: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
44
44
  src: string;
45
45
  fit: import("../../../utils/props").BuildPropType<StringConstructor, "" | "fill" | "none" | "contain" | "cover" | "scale-down", unknown>;
@@ -53,8 +53,8 @@ declare const _default: import("vue").DefineComponent<{
53
53
  onError?: ((evt: Event) => any) | undefined;
54
54
  onSwitch?: ((val: number) => any) | undefined;
55
55
  }, {
56
- lazy: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
57
56
  zIndex: number;
57
+ lazy: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
58
58
  appendToBody: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
59
59
  src: string;
60
60
  fit: import("../../../utils/props").BuildPropType<StringConstructor, "" | "fill" | "none" | "contain" | "cover" | "scale-down", unknown>;
@@ -25,7 +25,7 @@ export declare const ElInput: import("../../utils/types").SFCWithInstall<import(
25
25
  input: import("vue").Ref<HTMLInputElement | undefined>;
26
26
  textarea: import("vue").Ref<HTMLTextAreaElement | undefined>;
27
27
  attrs: import("vue").ComputedRef<Record<string, unknown>>;
28
- inputSize: import("vue").ComputedRef<"medium" | "mini" | import("../../utils/types").ComponentSize>;
28
+ inputSize: import("vue").ComputedRef<import("../../utils/types").ComponentSize>;
29
29
  validateState: import("vue").ComputedRef<string>;
30
30
  validateIcon: import("vue").ComputedRef<any>;
31
31
  containerStyle: import("vue").ComputedRef<import("../../utils/types").StyleValue>;
@@ -26,7 +26,7 @@ declare const _default: import("vue").DefineComponent<{
26
26
  input: import("vue").Ref<HTMLInputElement | undefined>;
27
27
  textarea: import("vue").Ref<HTMLTextAreaElement | undefined>;
28
28
  attrs: import("vue").ComputedRef<Record<string, unknown>>;
29
- inputSize: import("vue").ComputedRef<"medium" | "mini" | import("element-plus/es/utils/types").ComponentSize>;
29
+ inputSize: import("vue").ComputedRef<import("element-plus/es/utils/types").ComponentSize>;
30
30
  validateState: import("vue").ComputedRef<string>;
31
31
  validateIcon: import("vue").ComputedRef<any>;
32
32
  containerStyle: import("vue").ComputedRef<StyleValue>;
@@ -40,7 +40,7 @@ export declare const ElInputNumber: import("../../utils/types").SFCWithInstall<i
40
40
  input: import("vue").Ref<HTMLInputElement | undefined>;
41
41
  textarea: import("vue").Ref<HTMLTextAreaElement | undefined>;
42
42
  attrs: import("vue").ComputedRef<Record<string, unknown>>;
43
- inputSize: import("vue").ComputedRef<"medium" | "mini" | import("../../utils/types").ComponentSize>;
43
+ inputSize: import("vue").ComputedRef<import("../../utils/types").ComponentSize>;
44
44
  validateState: import("vue").ComputedRef<string>;
45
45
  validateIcon: import("vue").ComputedRef<any>;
46
46
  containerStyle: import("vue").ComputedRef<import("../../utils/types").StyleValue>;
@@ -191,7 +191,7 @@ export declare const ElInputNumber: import("../../utils/types").SFCWithInstall<i
191
191
  input: import("vue").Ref<HTMLInputElement | undefined>;
192
192
  textarea: import("vue").Ref<HTMLTextAreaElement | undefined>;
193
193
  attrs: import("vue").ComputedRef<Record<string, unknown>>;
194
- inputSize: import("vue").ComputedRef<"medium" | "mini" | import("../../utils/types").ComponentSize>;
194
+ inputSize: import("vue").ComputedRef<import("../../utils/types").ComponentSize>;
195
195
  validateState: import("vue").ComputedRef<string>;
196
196
  validateIcon: import("vue").ComputedRef<any>;
197
197
  containerStyle: import("vue").ComputedRef<import("../../utils/types").StyleValue>;
@@ -322,7 +322,7 @@ export declare const ElInputNumber: import("../../utils/types").SFCWithInstall<i
322
322
  controlsAtRight: import("vue").ComputedRef<boolean>;
323
323
  decrease: () => void;
324
324
  increase: () => void;
325
- inputNumberSize: import("vue").ComputedRef<"medium" | "mini" | import("../../utils/types").ComponentSize>;
325
+ inputNumberSize: import("vue").ComputedRef<import("../../utils/types").ComponentSize>;
326
326
  inputNumberDisabled: import("vue").ComputedRef<boolean>;
327
327
  maxDisabled: import("vue").ComputedRef<boolean>;
328
328
  minDisabled: import("vue").ComputedRef<boolean>;
@@ -41,7 +41,7 @@ declare const _default: import("vue").DefineComponent<{
41
41
  input: import("vue").Ref<HTMLInputElement | undefined>;
42
42
  textarea: import("vue").Ref<HTMLTextAreaElement | undefined>;
43
43
  attrs: import("vue").ComputedRef<Record<string, unknown>>;
44
- inputSize: import("vue").ComputedRef<"medium" | "mini" | import("../../../utils/types").ComponentSize>;
44
+ inputSize: import("vue").ComputedRef<import("../../../utils/types").ComponentSize>;
45
45
  validateState: import("vue").ComputedRef<string>;
46
46
  validateIcon: import("vue").ComputedRef<any>;
47
47
  containerStyle: import("vue").ComputedRef<import("../../../utils/types").StyleValue>;
@@ -192,7 +192,7 @@ declare const _default: import("vue").DefineComponent<{
192
192
  input: import("vue").Ref<HTMLInputElement | undefined>;
193
193
  textarea: import("vue").Ref<HTMLTextAreaElement | undefined>;
194
194
  attrs: import("vue").ComputedRef<Record<string, unknown>>;
195
- inputSize: import("vue").ComputedRef<"medium" | "mini" | import("../../../utils/types").ComponentSize>;
195
+ inputSize: import("vue").ComputedRef<import("../../../utils/types").ComponentSize>;
196
196
  validateState: import("vue").ComputedRef<string>;
197
197
  validateIcon: import("vue").ComputedRef<any>;
198
198
  containerStyle: import("vue").ComputedRef<import("../../../utils/types").StyleValue>;
@@ -323,7 +323,7 @@ declare const _default: import("vue").DefineComponent<{
323
323
  controlsAtRight: import("vue").ComputedRef<boolean>;
324
324
  decrease: () => void;
325
325
  increase: () => void;
326
- inputNumberSize: import("vue").ComputedRef<"medium" | "mini" | import("../../../utils/types").ComponentSize>;
326
+ inputNumberSize: import("vue").ComputedRef<import("../../../utils/types").ComponentSize>;
327
327
  inputNumberDisabled: import("vue").ComputedRef<boolean>;
328
328
  maxDisabled: import("vue").ComputedRef<boolean>;
329
329
  minDisabled: import("vue").ComputedRef<boolean>;
@@ -71,7 +71,7 @@ const addStyle = async (options, parent, instance) => {
71
71
  if (options.fullscreen) {
72
72
  instance.originalPosition.value = dom.getStyle(document.body, "position");
73
73
  instance.originalOverflow.value = dom.getStyle(document.body, "overflow");
74
- maskStyle.zIndex = popupManager["default"].nextZIndex();
74
+ maskStyle.zIndex = popupManager.PopupManager.nextZIndex();
75
75
  } else if (options.parent === document.body) {
76
76
  instance.originalPosition.value = dom.getStyle(document.body, "position");
77
77
  await vue.nextTick();
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sources":["../../../../../../packages/components/loading/src/service.ts"],"sourcesContent":["import { nextTick } from 'vue'\nimport { isString } from '@vue/shared'\nimport { isClient } from '@vueuse/core'\nimport { addClass, getStyle, removeClass } from '@element-plus/utils/dom'\nimport PopupManager from '@element-plus/utils/popup-manager'\nimport { createLoadingComponent } from './loading'\nimport type { LoadingInstance } from './loading'\nimport type { LoadingOptionsResolved } from '..'\nimport type { LoadingOptions } from './types'\nimport type { CSSProperties } from 'vue'\n\nlet fullscreenInstance: LoadingInstance | undefined = undefined\n\nexport const Loading = function (\n options: LoadingOptions = {}\n): LoadingInstance {\n if (!isClient) return undefined as any\n\n const resolved = resolveOptions(options)\n\n if (resolved.fullscreen && fullscreenInstance) {\n fullscreenInstance.remvoeElLoadingChild()\n fullscreenInstance.close()\n }\n\n const instance = createLoadingComponent({\n ...resolved,\n closed: () => {\n resolved.closed?.()\n if (resolved.fullscreen) fullscreenInstance = undefined\n },\n })\n\n addStyle(resolved, resolved.parent, instance)\n addClassList(resolved, resolved.parent, instance)\n\n resolved.parent.vLoadingAddClassList = () =>\n addClassList(resolved, resolved.parent, instance)\n\n /**\n * add loading-number to parent.\n * because if a fullscreen loading is triggered when somewhere\n * a v-loading.body was triggered before and it's parent is\n * document.body which with a margin , the fullscreen loading's\n * destroySelf function will remove 'el-loading-parent--relative',\n * and then the position of v-loading.body will be error.\n */\n let loadingNumber: string | null =\n resolved.parent.getAttribute('loading-number')\n if (!loadingNumber) {\n loadingNumber = '1'\n } else {\n loadingNumber = `${Number.parseInt(loadingNumber) + 1}`\n }\n resolved.parent.setAttribute('loading-number', loadingNumber)\n\n resolved.parent.appendChild(instance.$el)\n\n // after instance render, then modify visible to trigger transition\n nextTick(() => (instance.visible.value = resolved.visible))\n\n if (resolved.fullscreen) {\n fullscreenInstance = instance\n }\n return instance\n}\n\nconst resolveOptions = (options: LoadingOptions): LoadingOptionsResolved => {\n let target: HTMLElement\n if (isString(options.target)) {\n target =\n document.querySelector<HTMLElement>(options.target) ?? document.body\n } else {\n target = options.target || document.body\n }\n return {\n parent: target === document.body || options.body ? document.body : target,\n background: options.background || '',\n svg: options.svg || '',\n svgViewBox: options.svgViewBox || '',\n spinner: options.spinner || false,\n text: options.text || '',\n fullscreen: target === document.body && (options.fullscreen ?? true),\n lock: options.lock ?? false,\n customClass: options.customClass || '',\n visible: options.visible ?? true,\n target,\n }\n}\n\nconst addStyle = async (\n options: LoadingOptionsResolved,\n parent: HTMLElement,\n instance: LoadingInstance\n) => {\n const maskStyle: CSSProperties = {}\n if (options.fullscreen) {\n instance.originalPosition.value = getStyle(document.body, 'position')\n instance.originalOverflow.value = getStyle(document.body, 'overflow')\n maskStyle.zIndex = PopupManager.nextZIndex()\n } else if (options.parent === document.body) {\n instance.originalPosition.value = getStyle(document.body, 'position')\n /**\n * await dom render when visible is true in init,\n * because some component's height maybe 0.\n * e.g. el-table.\n */\n await nextTick()\n for (const property of ['top', 'left']) {\n const scroll = property === 'top' ? 'scrollTop' : 'scrollLeft'\n maskStyle[property] = `${\n (options.target as HTMLElement).getBoundingClientRect()[property] +\n document.body[scroll] +\n document.documentElement[scroll] -\n parseInt(getStyle(document.body, `margin-${property}`), 10)\n }px`\n }\n for (const property of ['height', 'width']) {\n maskStyle[property] = `${\n (options.target as HTMLElement).getBoundingClientRect()[property]\n }px`\n }\n } else {\n instance.originalPosition.value = getStyle(parent, 'position')\n }\n for (const [key, value] of Object.entries(maskStyle)) {\n instance.$el.style[key] = value\n }\n}\n\nconst addClassList = (\n options: LoadingOptions,\n parent: HTMLElement,\n instance: LoadingInstance\n) => {\n if (\n instance.originalPosition.value !== 'absolute' &&\n instance.originalPosition.value !== 'fixed'\n ) {\n addClass(parent, 'el-loading-parent--relative')\n } else {\n removeClass(parent, 'el-loading-parent--relative')\n }\n if (options.fullscreen && options.lock) {\n addClass(parent, 'el-loading-parent--hidden')\n } else {\n removeClass(parent, 'el-loading-parent--hidden')\n }\n}\n"],"names":["isClient","createLoadingComponent","nextTick","isString","getStyle","PopupManager","addClass","removeClass"],"mappings":";;;;;;;;;;;AAMA,IAAI,kBAAkB,GAAG,KAAK,CAAC,CAAC;AACpB,MAAC,OAAO,GAAG,SAAS,OAAO,GAAG,EAAE,EAAE;AAC9C,EAAE,IAAI,CAACA,aAAQ;AACf,IAAI,OAAO,KAAK,CAAC,CAAC;AAClB,EAAE,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;AAC3C,EAAE,IAAI,QAAQ,CAAC,UAAU,IAAI,kBAAkB,EAAE;AACjD,IAAI,kBAAkB,CAAC,oBAAoB,EAAE,CAAC;AAC9C,IAAI,kBAAkB,CAAC,KAAK,EAAE,CAAC;AAC/B,GAAG;AACH,EAAE,MAAM,QAAQ,GAAGC,8BAAsB,CAAC;AAC1C,IAAI,GAAG,QAAQ;AACf,IAAI,MAAM,EAAE,MAAM;AAClB,MAAM,IAAI,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AAC,CAAC;AAC7M,KAAK;AACL,IAAI,KAAK,MAAM,QAAQ,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;AAChD,MAAM,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;AACpF,KAAK;AACL,GAAG,MAAM;AACT,IAAI,QAAQ,CAAC,gBAAgB,CAAC,KAAK,GAAGA,YAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACnE,GAAG;AACH,EAAE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;AACxD,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACpC,GAAG;AACH,CAAC,CAAC;AACF,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,KAAK;AACpD,EAAE,IAAI,QAAQ,CAAC,gBAAgB,CAAC,KAAK,KAAK,UAAU,IAAI,QAAQ,CAAC,gBAAgB,CAAC,KAAK,KAAK,OAAO,EAAE;AACrG,IAAIE,YAAQ,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;AACpD,GAAG,MAAM;AACT,IAAIC,eAAW,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;AACvD,GAAG;AACH,EAAE,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,EAAE;AAC1C,IAAID,YAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;AAClD,GAAG,MAAM;AACT,IAAIC,eAAW,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;AACrD,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"service.js","sources":["../../../../../../packages/components/loading/src/service.ts"],"sourcesContent":["import { nextTick } from 'vue'\nimport { isString } from '@vue/shared'\nimport { isClient } from '@vueuse/core'\nimport { addClass, getStyle, removeClass } from '@element-plus/utils/dom'\nimport { PopupManager } from '@element-plus/utils/popup-manager'\nimport { createLoadingComponent } from './loading'\nimport type { LoadingInstance } from './loading'\nimport type { LoadingOptionsResolved } from '..'\nimport type { LoadingOptions } from './types'\nimport type { CSSProperties } from 'vue'\n\nlet fullscreenInstance: LoadingInstance | undefined = undefined\n\nexport const Loading = function (\n options: LoadingOptions = {}\n): LoadingInstance {\n if (!isClient) return undefined as any\n\n const resolved = resolveOptions(options)\n\n if (resolved.fullscreen && fullscreenInstance) {\n fullscreenInstance.remvoeElLoadingChild()\n fullscreenInstance.close()\n }\n\n const instance = createLoadingComponent({\n ...resolved,\n closed: () => {\n resolved.closed?.()\n if (resolved.fullscreen) fullscreenInstance = undefined\n },\n })\n\n addStyle(resolved, resolved.parent, instance)\n addClassList(resolved, resolved.parent, instance)\n\n resolved.parent.vLoadingAddClassList = () =>\n addClassList(resolved, resolved.parent, instance)\n\n /**\n * add loading-number to parent.\n * because if a fullscreen loading is triggered when somewhere\n * a v-loading.body was triggered before and it's parent is\n * document.body which with a margin , the fullscreen loading's\n * destroySelf function will remove 'el-loading-parent--relative',\n * and then the position of v-loading.body will be error.\n */\n let loadingNumber: string | null =\n resolved.parent.getAttribute('loading-number')\n if (!loadingNumber) {\n loadingNumber = '1'\n } else {\n loadingNumber = `${Number.parseInt(loadingNumber) + 1}`\n }\n resolved.parent.setAttribute('loading-number', loadingNumber)\n\n resolved.parent.appendChild(instance.$el)\n\n // after instance render, then modify visible to trigger transition\n nextTick(() => (instance.visible.value = resolved.visible))\n\n if (resolved.fullscreen) {\n fullscreenInstance = instance\n }\n return instance\n}\n\nconst resolveOptions = (options: LoadingOptions): LoadingOptionsResolved => {\n let target: HTMLElement\n if (isString(options.target)) {\n target =\n document.querySelector<HTMLElement>(options.target) ?? document.body\n } else {\n target = options.target || document.body\n }\n return {\n parent: target === document.body || options.body ? document.body : target,\n background: options.background || '',\n svg: options.svg || '',\n svgViewBox: options.svgViewBox || '',\n spinner: options.spinner || false,\n text: options.text || '',\n fullscreen: target === document.body && (options.fullscreen ?? true),\n lock: options.lock ?? false,\n customClass: options.customClass || '',\n visible: options.visible ?? true,\n target,\n }\n}\n\nconst addStyle = async (\n options: LoadingOptionsResolved,\n parent: HTMLElement,\n instance: LoadingInstance\n) => {\n const maskStyle: CSSProperties = {}\n if (options.fullscreen) {\n instance.originalPosition.value = getStyle(document.body, 'position')\n instance.originalOverflow.value = getStyle(document.body, 'overflow')\n maskStyle.zIndex = PopupManager.nextZIndex()\n } else if (options.parent === document.body) {\n instance.originalPosition.value = getStyle(document.body, 'position')\n /**\n * await dom render when visible is true in init,\n * because some component's height maybe 0.\n * e.g. el-table.\n */\n await nextTick()\n for (const property of ['top', 'left']) {\n const scroll = property === 'top' ? 'scrollTop' : 'scrollLeft'\n maskStyle[property] = `${\n (options.target as HTMLElement).getBoundingClientRect()[property] +\n document.body[scroll] +\n document.documentElement[scroll] -\n parseInt(getStyle(document.body, `margin-${property}`), 10)\n }px`\n }\n for (const property of ['height', 'width']) {\n maskStyle[property] = `${\n (options.target as HTMLElement).getBoundingClientRect()[property]\n }px`\n }\n } else {\n instance.originalPosition.value = getStyle(parent, 'position')\n }\n for (const [key, value] of Object.entries(maskStyle)) {\n instance.$el.style[key] = value\n }\n}\n\nconst addClassList = (\n options: LoadingOptions,\n parent: HTMLElement,\n instance: LoadingInstance\n) => {\n if (\n instance.originalPosition.value !== 'absolute' &&\n instance.originalPosition.value !== 'fixed'\n ) {\n addClass(parent, 'el-loading-parent--relative')\n } else {\n removeClass(parent, 'el-loading-parent--relative')\n }\n if (options.fullscreen && options.lock) {\n addClass(parent, 'el-loading-parent--hidden')\n } else {\n removeClass(parent, 'el-loading-parent--hidden')\n }\n}\n"],"names":["isClient","createLoadingComponent","nextTick","isString","getStyle","PopupManager","addClass","removeClass"],"mappings":";;;;;;;;;;;AAMA,IAAI,kBAAkB,GAAG,KAAK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AK,OAAO,EAAE;AACrG,IAAIE,YAAQ,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;AACpD,GAAG,MAAM;AACT,IAAIC,eAAW,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;AACvD,GAAG;AACH,EAAE,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,EAAE;AAC1C,IAAID,YAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;AAClD,GAAG,MAAM;AACT,IAAIC,eAAW,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;AACrD,GAAG;AACH,CAAC;;;;"}
@@ -41,7 +41,7 @@ const message = function(options = {}) {
41
41
  const id = `message_${seed++}`;
42
42
  const userOnClose = options.onClose;
43
43
  const props = {
44
- zIndex: popupManager["default"].nextZIndex(),
44
+ zIndex: popupManager.PopupManager.nextZIndex(),
45
45
  offset: verticalOffset,
46
46
  ...options,
47
47
  id,
@@ -1 +1 @@
1
- {"version":3,"file":"message-method.js","sources":["../../../../../../packages/components/message/src/message-method.ts"],"sourcesContent":["import { createVNode, render } from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { isVNode } from '@element-plus/utils/util'\nimport PopupManager from '@element-plus/utils/popup-manager'\nimport { debugWarn } from '@element-plus/utils/error'\nimport MessageConstructor from './message.vue'\nimport { messageTypes } from './message'\n\nimport type { Message, MessageFn, MessageQueue, MessageProps } from './message'\nimport type { ComponentPublicInstance, VNode } from 'vue'\n\nconst instances: MessageQueue = []\nlet seed = 1\n\n// TODO: Since Notify.ts is basically the same like this file. So we could do some encapsulation against them to reduce code duplication.\n\nconst message: MessageFn & Partial<Message> = function (options = {}) {\n if (!isClient) return { close: () => undefined }\n\n if (\n !isVNode(options) &&\n typeof options === 'object' &&\n options.grouping &&\n !isVNode(options.message) &&\n instances.length\n ) {\n const tempVm: any = instances.find(\n (item) =>\n `${item.vm.props?.message ?? ''}` ===\n `${(options as any).message ?? ''}`\n )\n if (tempVm) {\n tempVm.vm.component!.props.repeatNum += 1\n tempVm.vm.component!.props.type = options?.type\n return {\n close: () =>\n ((\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false),\n }\n }\n }\n\n if (typeof options === 'string' || isVNode(options)) {\n options = { message: options }\n }\n\n let verticalOffset = options.offset || 20\n instances.forEach(({ vm }) => {\n verticalOffset += (vm.el?.offsetHeight || 0) + 16\n })\n verticalOffset += 16\n\n const id = `message_${seed++}`\n const userOnClose = options.onClose\n const props: Partial<MessageProps> = {\n zIndex: PopupManager.nextZIndex(),\n offset: verticalOffset,\n ...options,\n id,\n onClose: () => {\n close(id, userOnClose)\n },\n }\n\n let appendTo: HTMLElement | null = document.body\n if (options.appendTo instanceof HTMLElement) {\n appendTo = options.appendTo\n } else if (typeof options.appendTo === 'string') {\n appendTo = document.querySelector(options.appendTo)\n }\n // should fallback to default value with a warning\n if (!(appendTo instanceof HTMLElement)) {\n debugWarn(\n 'ElMessage',\n 'the appendTo option is not an HTMLElement. Falling back to document.body.'\n )\n appendTo = document.body\n }\n\n const container = document.createElement('div')\n\n container.className = `container_${id}`\n\n const message = props.message\n const vm = createVNode(\n MessageConstructor,\n props,\n isVNode(props.message) ? { default: () => message } : null\n )\n\n // clean message element preventing mem leak\n vm.props!.onDestroy = () => {\n render(null, container)\n // since the element is destroy, then the VNode should be collected by GC as well\n // we do not want cause any mem leak because we have returned vm as a reference to users\n // so that we manually set it to false.\n }\n\n render(vm, container)\n // instances will remove this item when close function gets called. So we do not need to worry about it.\n instances.push({ vm })\n appendTo.appendChild(container.firstElementChild!)\n\n return {\n // instead of calling the onClose function directly, setting this value so that we can have the full lifecycle\n // for out component, so that all closing steps will not be skipped.\n close: () =>\n ((\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false),\n }\n}\n\nmessageTypes.forEach((type) => {\n message[type] = (options = {}) => {\n if (typeof options === 'string' || isVNode(options)) {\n options = {\n message: options,\n }\n }\n return message({\n ...options,\n type,\n })\n }\n})\n\nexport function close(id: string, userOnClose?: (vm: VNode) => void): void {\n const idx = instances.findIndex(({ vm }) => id === vm.component!.props.id)\n if (idx === -1) return\n\n const { vm } = instances[idx]\n if (!vm) return\n userOnClose?.(vm)\n\n const removedHeight = vm.el!.offsetHeight\n instances.splice(idx, 1)\n\n // adjust other instances vertical offset\n const len = instances.length\n if (len < 1) return\n for (let i = idx; i < len; i++) {\n const pos =\n parseInt(instances[i].vm.el!.style['top'], 10) - removedHeight - 16\n\n instances[i].vm.component!.props.offset = pos\n }\n}\n\nexport function closeAll(): void {\n for (let i = instances.length - 1; i >= 0; i--) {\n const instance = instances[i].vm.component\n ;(instance?.proxy as any)?.close()\n }\n}\n\nmessage.closeAll = closeAll\n\nexport default message as Message\n"],"names":["isClient","isVNode","PopupManager","debugWarn","createVNode","MessageConstructor","render","messageTypes"],"mappings":";;;;;;;;;;;;;AAOA,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,IAAI,IAAI,GAAG,CAAC,CAAC;AACR,MAAC,OAAO,GAAG,SAAS,OAAO,GAAG,EAAE,EAAE;AACvC,EAAE,IAAI,CAACA,aAAQ;AACf,IAAI,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC;AACnC,EAAE,IAAI,CAACC,WAAO,CAAC,OAAO,CAAC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,IAAI,CAACA,WAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,MAAM,EAAE;AAC7H,IAAI,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK;AAC5C,MAAM,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AACrB,MAAM,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,KAA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,KAAK,CAAC,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;AACjD,EAAE,MAAM,aAAa,GAAG,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC;AAC3C,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAC3B,EAAE,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC;AAC/B,EAAE,IAAI,GAAG,GAAG,CAAC;AACb,IAAI,OAAO;AACX,EAAE,KAAK,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;AAClC,IAAI,MAAM,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,aAAa,GAAG,EAAE,CAAC;AACnF,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC;AACjD,GAAG;AACH,CAAC;AACM,SAAS,QAAQ,GAAG;AAC3B,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;AAClD,IAAI,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC;AAC/C,IAAI,CAAC,EAAE,GAAG,QAAQ,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC;AACpF,GAAG;AACH,CAAC;AACD,OAAO,CAAC,QAAQ,GAAG,QAAQ;;;;;;"}
1
+ {"version":3,"file":"message-method.js","sources":["../../../../../../packages/components/message/src/message-method.ts"],"sourcesContent":["import { createVNode, render } from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { isVNode } from '@element-plus/utils/util'\nimport { PopupManager } from '@element-plus/utils/popup-manager'\nimport { debugWarn } from '@element-plus/utils/error'\nimport MessageConstructor from './message.vue'\nimport { messageTypes } from './message'\n\nimport type { Message, MessageFn, MessageQueue, MessageProps } from './message'\nimport type { ComponentPublicInstance, VNode } from 'vue'\n\nconst instances: MessageQueue = []\nlet seed = 1\n\n// TODO: Since Notify.ts is basically the same like this file. So we could do some encapsulation against them to reduce code duplication.\n\nconst message: MessageFn & Partial<Message> = function (options = {}) {\n if (!isClient) return { close: () => undefined }\n\n if (\n !isVNode(options) &&\n typeof options === 'object' &&\n options.grouping &&\n !isVNode(options.message) &&\n instances.length\n ) {\n const tempVm: any = instances.find(\n (item) =>\n `${item.vm.props?.message ?? ''}` ===\n `${(options as any).message ?? ''}`\n )\n if (tempVm) {\n tempVm.vm.component!.props.repeatNum += 1\n tempVm.vm.component!.props.type = options?.type\n return {\n close: () =>\n ((\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false),\n }\n }\n }\n\n if (typeof options === 'string' || isVNode(options)) {\n options = { message: options }\n }\n\n let verticalOffset = options.offset || 20\n instances.forEach(({ vm }) => {\n verticalOffset += (vm.el?.offsetHeight || 0) + 16\n })\n verticalOffset += 16\n\n const id = `message_${seed++}`\n const userOnClose = options.onClose\n const props: Partial<MessageProps> = {\n zIndex: PopupManager.nextZIndex(),\n offset: verticalOffset,\n ...options,\n id,\n onClose: () => {\n close(id, userOnClose)\n },\n }\n\n let appendTo: HTMLElement | null = document.body\n if (options.appendTo instanceof HTMLElement) {\n appendTo = options.appendTo\n } else if (typeof options.appendTo === 'string') {\n appendTo = document.querySelector(options.appendTo)\n }\n // should fallback to default value with a warning\n if (!(appendTo instanceof HTMLElement)) {\n debugWarn(\n 'ElMessage',\n 'the appendTo option is not an HTMLElement. Falling back to document.body.'\n )\n appendTo = document.body\n }\n\n const container = document.createElement('div')\n\n container.className = `container_${id}`\n\n const message = props.message\n const vm = createVNode(\n MessageConstructor,\n props,\n isVNode(props.message) ? { default: () => message } : null\n )\n\n // clean message element preventing mem leak\n vm.props!.onDestroy = () => {\n render(null, container)\n // since the element is destroy, then the VNode should be collected by GC as well\n // we do not want cause any mem leak because we have returned vm as a reference to users\n // so that we manually set it to false.\n }\n\n render(vm, container)\n // instances will remove this item when close function gets called. So we do not need to worry about it.\n instances.push({ vm })\n appendTo.appendChild(container.firstElementChild!)\n\n return {\n // instead of calling the onClose function directly, setting this value so that we can have the full lifecycle\n // for out component, so that all closing steps will not be skipped.\n close: () =>\n ((\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false),\n }\n}\n\nmessageTypes.forEach((type) => {\n message[type] = (options = {}) => {\n if (typeof options === 'string' || isVNode(options)) {\n options = {\n message: options,\n }\n }\n return message({\n ...options,\n type,\n })\n }\n})\n\nexport function close(id: string, userOnClose?: (vm: VNode) => void): void {\n const idx = instances.findIndex(({ vm }) => id === vm.component!.props.id)\n if (idx === -1) return\n\n const { vm } = instances[idx]\n if (!vm) return\n userOnClose?.(vm)\n\n const removedHeight = vm.el!.offsetHeight\n instances.splice(idx, 1)\n\n // adjust other instances vertical offset\n const len = instances.length\n if (len < 1) return\n for (let i = idx; i < len; i++) {\n const pos =\n parseInt(instances[i].vm.el!.style['top'], 10) - removedHeight - 16\n\n instances[i].vm.component!.props.offset = pos\n }\n}\n\nexport function closeAll(): void {\n for (let i = instances.length - 1; i >= 0; i--) {\n const instance = instances[i].vm.component\n ;(instance?.proxy as any)?.close()\n }\n}\n\nmessage.closeAll = closeAll\n\nexport default message as Message\n"],"names":["isClient","isVNode","PopupManager","debugWarn","createVNode","MessageConstructor","render","messageTypes"],"mappings":";;;;;;;;;;;;;AAOA,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,IAAI,IAAI,GAAG,CAAC,CAAC;AACR,MAAC,OAAO,GAAG,SAAS,OAAO,GAAG,EAAE,EAAE;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CAAC;AACM,SAAS,QAAQ,GAAG;AAC3B,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;AAClD,IAAI,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC;AAC/C,IAAI,CAAC,EAAE,GAAG,QAAQ,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC;AACpF,GAAG;AACH,CAAC;AACD,OAAO,CAAC,QAAQ,GAAG,QAAQ;;;;;;"}
@@ -113,7 +113,7 @@ var script = vue.defineComponent({
113
113
  confirmButtonDisabled: false,
114
114
  editorErrorMessage: "",
115
115
  validateError: false,
116
- zIndex: popupManager["default"].nextZIndex()
116
+ zIndex: popupManager.PopupManager.nextZIndex()
117
117
  });
118
118
  const typeClass = vue.computed(() => {
119
119
  const type = state.type;
@@ -138,7 +138,7 @@ var script = vue.defineComponent({
138
138
  (_c = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.focus) == null ? void 0 : _c.call(_b);
139
139
  });
140
140
  }
141
- state.zIndex = popupManager["default"].nextZIndex();
141
+ state.zIndex = popupManager.PopupManager.nextZIndex();
142
142
  }
143
143
  if (props.boxType !== "prompt")
144
144
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"index.vue_vue_type_script_lang.js","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 :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=\"buttonSize || ''\"\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=\"buttonSize || ''\"\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} 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 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 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":["defineComponent","TrapFocus","ElButton","ElInput","ElOverlay","TypeComponents","useLocale","ref","PopupManager","computed","TypeComponentsMap","nextTick","off","useModal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgJA,aAAeA,mBAAe,CAAC;;AAE/B,EAAE,UAAU,EAAE;AACd,eAAIC;AACJ,GAAG;EACD;cACEC,gBAAQ;aACRC,eAAO;AACX,eAAIC,iBAAS;;AAEb,IAAI,GAAGC,mBAAc;GAClB;EACD,YAAY;OACP,EAAE;;MAEH,IAAI,EAAE;MACN;KACD;IACD,KAAK,EAAE;MACL,IAAI;MACJ,OAAO,EAAE,IAAI;;IAEf,UAAU,EAAE;MACV;MACA,OAAO;;aAEA,EAAE;;MAET;;;;MAIA,OAAO;;;;MAIP,OAAO,EAAE;;;;MAIT,OAAO,EAAE,IAAI;;UAET,EAAE,OAAO;IACf;MACE,OAAO,EAAE,KAAK;MACd,IAAI,EAAE,O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mBACI;;;gBAGH;aACH;iBACI;;;;MAIX;MACA;;;;;;"}
1
+ {"version":3,"file":"index.vue_vue_type_script_lang.js","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 :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=\"buttonSize || ''\"\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=\"buttonSize || ''\"\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} 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 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 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":["defineComponent","TrapFocus","ElButton","ElInput","ElOverlay","TypeComponents","useLocale","ref","PopupManager","computed","TypeComponentsMap","nextTick","off","useModal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgJA,aAAeA,mBAAe,CAAC;;AAE/B,EAAE,UAAU,EAAE;AACd,eAAIC;AACJ,GAAG;EACD;cACEC,gBAAQ;aACRC,eAAO;AACX,eAAI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YAC5B,KAAK,CAAC,kBAAkB;;;;;OAK7B;WACI,CAAC;MACN;;MAEA;;MAEA,MAAM,SAAS,GAAG;aACX,SAAS,CAAC,KAAK,IAAI,SAAS,SAAS;MAC5C;UACI;MACJ;;;MAGAC,gBAAQ,CAAC;mBACI;SACV,OAAO,CAAC,CAAC;WACP;8BACW,CAAC,OAAO,EAAE;;aAEnB,CAAC,UAAU,EAAE;2BACP,CAAC;;4BAEA,CAAC,QAAQ;WAClB;oBACK,KAAK,CAAC;aACT;gBACG;eACD;mBACI;;;gBAGH;aACH;iBACI;;;;MAIX;MACA;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.vue_vue_type_template_id_7035e868_lang.js","sources":["../../../../../../packages/components/message-box/src/index.vue?vue&type=template&id=7035e868&lang.js"],"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 :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=\"buttonSize || ''\"\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=\"buttonSize || ''\"\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} 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 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 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":["_withModifiers","_createCommentVNode","_withCtx","_createTextVNode"],"mappings":";;;;;;;;;;EAuBU;;qBAEK,KAAK,EAAC;qBAyBR,KAAK,EAAC;;;;EASgB;;;;mDAO4B;eAmBlD,KAAK,EAAC,sBAAsB;;;;;;;;;;;IApF3B;;;;;QAGP,SAAOA;;QAEP;;;0BAGD;;YACE,KAAI;;;;;;;;sDASe;;;;;;;;;;+CAYb;;;;;;;;iCAKa;;;;;;;;;;;;;wBAWf;;;;;;;;;;;;;;;sBAOEC;;;;;;;;;;;0BAOY;8CAAV;;;8BACU,SAAgB;;;;;;;;kBAM5B;;;yCAEgB;;;;;;uBAMX,EAACC;kBACLC;;;;;;;;0CAQP;;;;;yBAIU;;;yFAGc;;;;;;;;;;;;;wBAUd;;;;;;;;;"}
1
+ {"version":3,"file":"index.vue_vue_type_template_id_7035e868_lang.js","sources":["../../../../../../packages/components/message-box/src/index.vue?vue&type=template&id=7035e868&lang.js"],"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 :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=\"buttonSize || ''\"\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=\"buttonSize || ''\"\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} 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 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 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":["_withModifiers","_createCommentVNode","_withCtx","_createTextVNode"],"mappings":";;;;;;;;;;EAuBU;;qBAEK,KAAK,EAAC;qBAyBR,KAAK,EAAC;;;;EASgB;;;;mDAO4B;eAmBlD,KAAK,EAAC,sBAAsB;;;;;;;;;;;IApF3B;;;;;QAGP,SAAOA;;QAEP;;;0BAGD;;YACE,KAAI;;;;;;;;sDASe;;;;;;;;;;+CAYb;;;;;;;;iCAKa;;;;;;;;;;;;;wBAWf;;;;;;;;;;;;;;;sBAOEC;;;;;;;;;;;0BAOY;8CAAV;;;8BACU,SAAgB;;;;;;;;kBAM5B;;;yCAEgB;;;;;;uBAMX,EAACC;kBACLC;;;;;;;;0CAQP;;;;;yBAIU;;;yFAGc;;;;;;;;;;;;;wBAUd;;;;;;;;;"}
@@ -45,8 +45,8 @@ declare const _default: import("vue").DefineComponent<{
45
45
  } & {
46
46
  type: import("../../../utils/props").BuildPropType<StringConstructor, "" | "success" | "warning" | "info" | "error", unknown>;
47
47
  icon: import("../../../utils/props").BuildPropType<import("../../../utils/props").PropWrapper<string | Comment>, unknown, unknown>;
48
- title: string;
49
48
  zIndex: number;
49
+ title: string;
50
50
  message: import("../../../utils/props").BuildPropType<import("../../../utils/props").PropWrapper<string | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
51
51
  [key: string]: any;
52
52
  }>>, unknown, unknown>;
@@ -65,8 +65,8 @@ declare const _default: import("vue").DefineComponent<{
65
65
  }, {
66
66
  type: import("../../../utils/props").BuildPropType<StringConstructor, "" | "success" | "warning" | "info" | "error", unknown>;
67
67
  icon: import("../../../utils/props").BuildPropType<import("../../../utils/props").PropWrapper<string | Comment>, unknown, unknown>;
68
- title: string;
69
68
  zIndex: number;
69
+ title: string;
70
70
  message: import("../../../utils/props").BuildPropType<import("../../../utils/props").PropWrapper<string | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
71
71
  [key: string]: any;
72
72
  }>>, unknown, unknown>;
@@ -35,7 +35,7 @@ const notify = function(options = {}) {
35
35
  const id = `notification_${seed++}`;
36
36
  const userOnClose = options.onClose;
37
37
  const props = {
38
- zIndex: popupManager["default"].nextZIndex(),
38
+ zIndex: popupManager.PopupManager.nextZIndex(),
39
39
  offset: verticalOffset,
40
40
  ...options,
41
41
  id,
@@ -1 +1 @@
1
- {"version":3,"file":"notify.js","sources":["../../../../../../packages/components/notification/src/notify.ts"],"sourcesContent":["import { createVNode, render } from 'vue'\nimport { isClient } from '@vueuse/core'\nimport PopupManager from '@element-plus/utils/popup-manager'\nimport { isVNode } from '@element-plus/utils/util'\nimport { debugWarn } from '@element-plus/utils/error'\nimport NotificationConstructor from './notification.vue'\nimport { notificationTypes } from './notification'\n\nimport type { ComponentPublicInstance, VNode } from 'vue'\nimport type {\n NotificationOptions,\n Notify,\n NotifyFn,\n NotificationQueue,\n NotificationProps,\n} from './notification'\n\n// This should be a queue but considering there were `non-autoclosable` notifications.\nconst notifications: Record<\n NotificationOptions['position'],\n NotificationQueue\n> = {\n 'top-left': [],\n 'top-right': [],\n 'bottom-left': [],\n 'bottom-right': [],\n}\n\n// the gap size between each notification\nconst GAP_SIZE = 16\nlet seed = 1\n\nconst notify: NotifyFn & Partial<Notify> = function (options = {}) {\n if (!isClient) return { close: () => undefined }\n\n if (typeof options === 'string' || isVNode(options)) {\n options = { message: options }\n }\n\n const position = options.position || 'top-right'\n\n let verticalOffset = options.offset || 0\n notifications[position].forEach(({ vm }) => {\n verticalOffset += (vm.el?.offsetHeight || 0) + GAP_SIZE\n })\n verticalOffset += GAP_SIZE\n\n const id = `notification_${seed++}`\n const userOnClose = options.onClose\n const props: Partial<NotificationProps> = {\n // default options end\n zIndex: PopupManager.nextZIndex(),\n offset: verticalOffset,\n ...options,\n id,\n onClose: () => {\n close(id, position, userOnClose)\n },\n }\n\n let appendTo: HTMLElement | null = document.body\n if (options.appendTo instanceof HTMLElement) {\n appendTo = options.appendTo\n } else if (typeof options.appendTo === 'string') {\n appendTo = document.querySelector(options.appendTo)\n }\n\n // should fallback to default value with a warning\n if (!(appendTo instanceof HTMLElement)) {\n debugWarn(\n 'ElNotification',\n 'the appendTo option is not an HTMLElement. Falling back to document.body.'\n )\n appendTo = document.body\n }\n\n const container = document.createElement('div')\n\n const vm = createVNode(\n NotificationConstructor,\n props,\n isVNode(props.message)\n ? {\n default: () => props.message,\n }\n : null\n )\n\n // clean notification element preventing mem leak\n vm.props!.onDestroy = () => {\n render(null, container)\n }\n\n // instances will remove this item when close function gets called. So we do not need to worry about it.\n render(vm, container)\n notifications[position].push({ vm })\n appendTo.appendChild(container.firstElementChild!)\n\n return {\n // instead of calling the onClose function directly, setting this value so that we can have the full lifecycle\n // for out component, so that all closing steps will not be skipped.\n close: () => {\n ;(\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false\n },\n }\n}\nnotificationTypes.forEach((type) => {\n notify[type] = (options = {}) => {\n if (typeof options === 'string' || isVNode(options)) {\n options = {\n message: options,\n }\n }\n return notify({\n ...options,\n type,\n })\n }\n})\n\n/**\n * This function gets called when user click `x` button or press `esc` or the time reached its limitation.\n * Emitted by transition@before-leave event so that we can fetch the current notification.offsetHeight, if this was called\n * by @after-leave the DOM element will be removed from the page thus we can no longer fetch the offsetHeight.\n * @param {String} id notification id to be closed\n * @param {Position} position the positioning strategy\n * @param {Function} userOnClose the callback called when close passed by user\n */\nexport function close(\n id: string,\n position: NotificationOptions['position'],\n userOnClose?: (vm: VNode) => void\n): void {\n // maybe we can store the index when inserting the vm to notification list.\n const orientedNotifications = notifications[position]\n const idx = orientedNotifications.findIndex(\n ({ vm }) => vm.component?.props.id === id\n )\n if (idx === -1) return\n const { vm } = orientedNotifications[idx]\n if (!vm) return\n // calling user's on close function before notification gets removed from DOM.\n userOnClose?.(vm)\n\n // note that this is called @before-leave, that's why we were able to fetch this property.\n const removedHeight = vm.el!.offsetHeight\n const verticalPos = position.split('-')[0]\n orientedNotifications.splice(idx, 1)\n const len = orientedNotifications.length\n if (len < 1) return\n // starting from the removing item.\n for (let i = idx; i < len; i++) {\n // new position equals the current offsetTop minus removed height plus 16px(the gap size between each item)\n const { el, component } = orientedNotifications[i].vm\n const pos = parseInt(el!.style[verticalPos], 10) - removedHeight - GAP_SIZE\n component!.props.offset = pos\n }\n}\n\nexport function closeAll(): void {\n // loop through all directions, close them at once.\n for (const orientedNotifications of Object.values(notifications)) {\n orientedNotifications.forEach(({ vm }) => {\n // same as the previous close method, we'd like to make sure lifecycle gets handle properly.\n ;(\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false\n })\n }\n}\n\nnotify.closeAll = closeAll\n\nexport default notify as Notify\n"],"names":["isClient","isVNode","PopupManager","debugWarn","createVNode","NotificationConstructor","render","notificationTypes"],"mappings":";;;;;;;;;;;;;AAOA,MAAM,aAAa,GAAG;AACtB,EAAE,UAAU,EAAE,EAAE;AAChB,EAAE,WAAW,EAAE,EAAE;AACjB,EAAE,aAAa,EAAE,EAAE;AACnB,EAAE,cAAc,EAAE,EAAE;AACpB,CAAC,CAAC;AACF,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,IAAI,IAAI,GAAG,CAAC,CAAC;AACR,MAAC,MAAM,GAAG,SAAS,OAAO,GAAG,EAAE,EAAE;AACtC,EAAE,IAAI,CAACA,aAAQ;AACf,IAAI,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC;AACnC,EAAE,IAAI,OAAO,OAAO,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CAAC;AAC3C,EAAE,IAAI,GAAG,GAAG,CAAC;AACb,IAAI,OAAO;AACX,EAAE,KAAK,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;AAClC,IAAI,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1D,IAAI,MAAM,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,GAAG,aAAa,GAAG,QAAQ,CAAC;AAC/E,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC;AACjC,GAAG;AACH,CAAC;AACM,SAAS,QAAQ,GAAG;AAC3B,EAAE,KAAK,MAAM,qBAAqB,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;AACpE,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK;AAC9C,MAAM,CAAC;AACP,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;AACzC,KAAK,CAAC,CAAC;AACP,GAAG;AACH,CAAC;AACD,MAAM,CAAC,QAAQ,GAAG,QAAQ;;;;;;"}
1
+ {"version":3,"file":"notify.js","sources":["../../../../../../packages/components/notification/src/notify.ts"],"sourcesContent":["import { createVNode, render } from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { PopupManager } from '@element-plus/utils/popup-manager'\nimport { isVNode } from '@element-plus/utils/util'\nimport { debugWarn } from '@element-plus/utils/error'\nimport NotificationConstructor from './notification.vue'\nimport { notificationTypes } from './notification'\n\nimport type { ComponentPublicInstance, VNode } from 'vue'\nimport type {\n NotificationOptions,\n Notify,\n NotifyFn,\n NotificationQueue,\n NotificationProps,\n} from './notification'\n\n// This should be a queue but considering there were `non-autoclosable` notifications.\nconst notifications: Record<\n NotificationOptions['position'],\n NotificationQueue\n> = {\n 'top-left': [],\n 'top-right': [],\n 'bottom-left': [],\n 'bottom-right': [],\n}\n\n// the gap size between each notification\nconst GAP_SIZE = 16\nlet seed = 1\n\nconst notify: NotifyFn & Partial<Notify> = function (options = {}) {\n if (!isClient) return { close: () => undefined }\n\n if (typeof options === 'string' || isVNode(options)) {\n options = { message: options }\n }\n\n const position = options.position || 'top-right'\n\n let verticalOffset = options.offset || 0\n notifications[position].forEach(({ vm }) => {\n verticalOffset += (vm.el?.offsetHeight || 0) + GAP_SIZE\n })\n verticalOffset += GAP_SIZE\n\n const id = `notification_${seed++}`\n const userOnClose = options.onClose\n const props: Partial<NotificationProps> = {\n // default options end\n zIndex: PopupManager.nextZIndex(),\n offset: verticalOffset,\n ...options,\n id,\n onClose: () => {\n close(id, position, userOnClose)\n },\n }\n\n let appendTo: HTMLElement | null = document.body\n if (options.appendTo instanceof HTMLElement) {\n appendTo = options.appendTo\n } else if (typeof options.appendTo === 'string') {\n appendTo = document.querySelector(options.appendTo)\n }\n\n // should fallback to default value with a warning\n if (!(appendTo instanceof HTMLElement)) {\n debugWarn(\n 'ElNotification',\n 'the appendTo option is not an HTMLElement. Falling back to document.body.'\n )\n appendTo = document.body\n }\n\n const container = document.createElement('div')\n\n const vm = createVNode(\n NotificationConstructor,\n props,\n isVNode(props.message)\n ? {\n default: () => props.message,\n }\n : null\n )\n\n // clean notification element preventing mem leak\n vm.props!.onDestroy = () => {\n render(null, container)\n }\n\n // instances will remove this item when close function gets called. So we do not need to worry about it.\n render(vm, container)\n notifications[position].push({ vm })\n appendTo.appendChild(container.firstElementChild!)\n\n return {\n // instead of calling the onClose function directly, setting this value so that we can have the full lifecycle\n // for out component, so that all closing steps will not be skipped.\n close: () => {\n ;(\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false\n },\n }\n}\nnotificationTypes.forEach((type) => {\n notify[type] = (options = {}) => {\n if (typeof options === 'string' || isVNode(options)) {\n options = {\n message: options,\n }\n }\n return notify({\n ...options,\n type,\n })\n }\n})\n\n/**\n * This function gets called when user click `x` button or press `esc` or the time reached its limitation.\n * Emitted by transition@before-leave event so that we can fetch the current notification.offsetHeight, if this was called\n * by @after-leave the DOM element will be removed from the page thus we can no longer fetch the offsetHeight.\n * @param {String} id notification id to be closed\n * @param {Position} position the positioning strategy\n * @param {Function} userOnClose the callback called when close passed by user\n */\nexport function close(\n id: string,\n position: NotificationOptions['position'],\n userOnClose?: (vm: VNode) => void\n): void {\n // maybe we can store the index when inserting the vm to notification list.\n const orientedNotifications = notifications[position]\n const idx = orientedNotifications.findIndex(\n ({ vm }) => vm.component?.props.id === id\n )\n if (idx === -1) return\n const { vm } = orientedNotifications[idx]\n if (!vm) return\n // calling user's on close function before notification gets removed from DOM.\n userOnClose?.(vm)\n\n // note that this is called @before-leave, that's why we were able to fetch this property.\n const removedHeight = vm.el!.offsetHeight\n const verticalPos = position.split('-')[0]\n orientedNotifications.splice(idx, 1)\n const len = orientedNotifications.length\n if (len < 1) return\n // starting from the removing item.\n for (let i = idx; i < len; i++) {\n // new position equals the current offsetTop minus removed height plus 16px(the gap size between each item)\n const { el, component } = orientedNotifications[i].vm\n const pos = parseInt(el!.style[verticalPos], 10) - removedHeight - GAP_SIZE\n component!.props.offset = pos\n }\n}\n\nexport function closeAll(): void {\n // loop through all directions, close them at once.\n for (const orientedNotifications of Object.values(notifications)) {\n orientedNotifications.forEach(({ vm }) => {\n // same as the previous close method, we'd like to make sure lifecycle gets handle properly.\n ;(\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false\n })\n }\n}\n\nnotify.closeAll = closeAll\n\nexport default notify as Notify\n"],"names":["isClient","isVNode","PopupManager","debugWarn","createVNode","NotificationConstructor","render","notificationTypes"],"mappings":";;;;;;;;;;;;;AAOA,MAAM,aAAa,GAAG;AACtB,EAAE,UAAU,EAAE,EAAE;AAChB,EAAE,WAAW,EAAE,EAAE;AACjB,EAAE,aAAa,EAAE,EAAE;AACnB,EA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utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
25
24
  zIndex: import("../../utils/props").BuildPropType<import("../../utils/props").PropWrapper<import("csstype").ZIndexProperty>, unknown, unknown>;
25
+ mask: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
26
26
  customMaskEvent: import("../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
27
27
  overlayClass: import("../../utils/props").BuildPropType<import("../../utils/props").PropWrapper<string | string[] | Record<string, boolean>>, unknown, unknown>;
28
28
  }>;
@@ -34,8 +34,8 @@ declare const _default: import("vue").DefineComponent<{
34
34
  }> & {
35
35
  onClick?: ((evt: MouseEvent) => any) | undefined;
36
36
  }, {
37
- mask: import("element-plus/es/utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
38
37
  zIndex: import("element-plus/es/utils/props").BuildPropType<import("element-plus/es/utils/props").PropWrapper<ZIndexProperty>, unknown, unknown>;
38
+ mask: import("element-plus/es/utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
39
39
  customMaskEvent: import("element-plus/es/utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
40
40
  overlayClass: import("element-plus/es/utils/props").BuildPropType<import("element-plus/es/utils/props").PropWrapper<string | string[] | Record<string, boolean>>, unknown, unknown>;
41
41
  }>;
@@ -12,7 +12,7 @@ var index = require('../../popper/src/use-popper/index.js');
12
12
  const SHOW_EVENT = "show";
13
13
  const HIDE_EVENT = "hide";
14
14
  function usePopover(props, ctx) {
15
- const zIndex = vue.ref(popupManager["default"].nextZIndex());
15
+ const zIndex = vue.ref(popupManager.PopupManager.nextZIndex());
16
16
  const width = vue.computed(() => {
17
17
  if (shared.isString(props.width)) {
18
18
  return props.width;
@@ -28,7 +28,7 @@ function usePopover(props, ctx) {
28
28
  const popperProps = index["default"](props, ctx);
29
29
  vue.watch(popperProps.visibility, (val) => {
30
30
  if (val) {
31
- zIndex.value = popupManager["default"].nextZIndex();
31
+ zIndex.value = popupManager.PopupManager.nextZIndex();
32
32
  }
33
33
  ctx.emit(val ? SHOW_EVENT : HIDE_EVENT);
34
34
  });