exploria-ui 2026.10.18 → 2026.10.19

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.
@@ -1,4 +1,22 @@
1
1
  import { VNode } from 'vue';
2
+ /**
3
+ * 关闭动作的触发来源。
4
+ *
5
+ * - `confirm`:点击确认按钮
6
+ * - `cancel`:点击取消按钮
7
+ * - `close`:点击右上角关闭图标
8
+ */
9
+ export type EMessageBoxAction = 'confirm' | 'cancel' | 'close';
10
+ /**
11
+ * beforeClose 回调收到的弹框实例句柄。
12
+ *
13
+ * 响应式对象:修改属性会直接反映到弹框 UI,
14
+ * 目前用于把确认按钮切换为 loading 状态(防重复提交)。
15
+ */
16
+ export interface EMessageBoxInstance {
17
+ /** 确认按钮 loading 状态,置 true 时确认按钮转 loading 且不可点击 */
18
+ confirmButtonLoading: boolean;
19
+ }
2
20
  interface MessageBoxOptions {
3
21
  title?: string;
4
22
  okText?: string;
@@ -7,12 +25,7 @@ interface MessageBoxOptions {
7
25
  /**
8
26
  * 参考动画元素。用于"指哪打哪"功能,弹框从该元素位置开始显示动画。
9
27
  *
10
- * 未传入时,自动使用最近一次鼠标落下的元素(同步点击场景下即为
11
- * 触发本次调用的按钮),无需手动传入。
12
- *
13
- * 异步操作(点击后有加载动画/请求,延迟后才弹出):等待期间用户可能
14
- * 点击其他地方,导致自动捕获的元素不准确,此时必须传入此参数,
15
- * 确保弹框从原来的触发按钮位置弹出。
28
+ * 未传入时,弹框从屏幕(或挂载容器)中间放大显示。
16
29
  */
17
30
  animationReferenceElement?: HTMLElement;
18
31
  /**
@@ -20,6 +33,18 @@ interface MessageBoxOptions {
20
33
  * 传入挂载元素后,遮罩与对话框仅覆盖该元素,且居中位置以该元素为准。
21
34
  */
22
35
  mountPoint?: HTMLElement;
36
+ /**
37
+ * 关闭前拦截。传入后,点击确认 / 取消 / 关闭图标时弹框不立即关闭,
38
+ * 关闭时机交由此回调决策:
39
+ *
40
+ * - 异步场景:置 `instance.confirmButtonLoading = true` 让确认按钮
41
+ * 转 loading(同时防重复点击),请求完成后调用 `done()` 才真正关闭
42
+ * - 校验场景:校验不通过时不调用 `done()`,弹框保持打开
43
+ * - `action` 区分触发来源(confirm / cancel / close),可只拦截确认
44
+ *
45
+ * 未调用 `done()` 前,show 返回的 Promise 保持 pending。
46
+ */
47
+ beforeClose?: (action: EMessageBoxAction, instance: EMessageBoxInstance, done: () => void) => void;
23
48
  }
24
49
  export default class EMessageBox {
25
50
  private static show;
@@ -6,6 +6,14 @@ type __VLS_Props = {
6
6
  width?: string;
7
7
  okText?: string;
8
8
  cancelText?: string;
9
+ /**
10
+ * 弹框实例句柄(beforeClose 场景由 EMessageBox.show 注入的 reactive 对象)。
11
+ * confirmButtonLoading 驱动确认按钮的 loading 视图。
12
+ * 类型内联声明避免与 EMessageBox.ts 循环依赖。
13
+ */
14
+ instance?: {
15
+ confirmButtonLoading?: boolean;
16
+ };
9
17
  };
10
18
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
11
19
  cancel: () => any;