@dazhicheng/ui 1.6.45 → 1.6.46

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,8 +1,8 @@
1
1
  import { isArray as z, isString as L, invokeArrayFns as I } from "../../node_modules/.pnpm/@vue_shared@3.5.34/node_modules/@vue/shared/dist/shared.esm-bundler.js";
2
- import { getCurrentInstance as P, watch as k, onMounted as W, onUpdated as j, onBeforeUnmount as G, isVNode as J, cloneVNode as O, setTransitionHooks as Q } from "vue";
2
+ import { getCurrentInstance as P, watch as b, onMounted as W, onUpdated as j, onBeforeUnmount as G, isVNode as J, cloneVNode as O, setTransitionHooks as Q } from "vue";
3
3
  import { isAsyncWrapper as X } from "./core/apiAsyncComponent.js";
4
4
  import { getComponentName as w } from "./core/component.js";
5
- import { MoveType as H, queuePostRenderEffect as v } from "./core/renderer.js";
5
+ import { MoveType as H, queuePostRenderEffect as A } from "./core/renderer.js";
6
6
  import { isSuspense as Y } from "./core/Suspense.js";
7
7
  import { invokeVNodeHook as M } from "./core/vnode.js";
8
8
  const Z = {
@@ -18,20 +18,20 @@ const Z = {
18
18
  includeKey: [String, RegExp, Array],
19
19
  excludeKey: [String, RegExp, Array]
20
20
  },
21
- setup(o, { slots: r, expose: y }) {
22
- const d = P(), E = d.ctx, a = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set();
23
- let u = null;
21
+ setup(o, { slots: r, expose: h }) {
22
+ const d = P(), x = d.ctx, c = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set();
23
+ let a = null;
24
24
  const f = d.suspense, {
25
25
  renderer: {
26
26
  p: U,
27
- m: N,
27
+ m: C,
28
28
  um: B,
29
29
  o: { createElement: D }
30
30
  }
31
- } = E, q = D("div");
32
- E.activate = (e, n, t, i, c) => {
31
+ } = x, q = D("div");
32
+ x.activate = (e, n, t, i, u) => {
33
33
  const s = e.component;
34
- N(e, n, t, H.ENTER, f), U(
34
+ C(e, n, t, H.ENTER, f), U(
35
35
  s.vnode,
36
36
  e,
37
37
  n,
@@ -40,100 +40,100 @@ const Z = {
40
40
  f,
41
41
  i,
42
42
  e.slotScopeIds,
43
- c
44
- ), v(() => {
43
+ u
44
+ ), A(() => {
45
45
  s.isDeactivated = !1, s.a && I(s.a);
46
46
  const g = e.props && e.props.onVnodeMounted;
47
47
  g && M(g, s.parent, e);
48
48
  }, f);
49
- }, E.deactivate = (e) => {
49
+ }, x.deactivate = (e) => {
50
50
  const n = e.component;
51
- N(e, q, null, H.LEAVE, f), v(() => {
51
+ C(e, q, null, H.LEAVE, f), A(() => {
52
52
  n.da && I(n.da);
53
53
  const t = e.props && e.props.onVnodeUnmounted;
54
54
  t && M(t, n.parent, e), n.isDeactivated = !0;
55
55
  }, f);
56
56
  };
57
- function K(e) {
58
- C(e), B(e, d, f, !0);
57
+ function F(e) {
58
+ S(e), B(e, d, f, !0);
59
59
  }
60
- function V(e) {
61
- a.forEach((n, t) => {
60
+ function K(e) {
61
+ c.forEach((n, t) => {
62
62
  const i = w(n.type);
63
63
  i && (!e || !e(i)) && m(t);
64
64
  });
65
65
  }
66
- function R(e) {
67
- a.forEach((n, t) => {
66
+ function N(e) {
67
+ c.forEach((n, t) => {
68
68
  (!e || !e(t)) && m(t);
69
69
  });
70
70
  }
71
71
  function m(e) {
72
- const n = a.get(e);
73
- !u || n.type !== u.type ? K(n) : u && C(u), a.delete(e), p.delete(e);
72
+ const n = c.get(e);
73
+ n && (!a || n.type !== a.type || n.key !== a.key) ? F(n) : a && S(a), c.delete(e), p.delete(e);
74
74
  }
75
- y({ remove: (e) => {
76
- a.has(e) && m(e);
75
+ h({ remove: (e) => {
76
+ c.has(e) && m(e);
77
77
  }, clear: () => {
78
- a.forEach((e, n) => m(n));
79
- } }), k(
78
+ c.forEach((e, n) => m(n));
79
+ } }), b(
80
80
  () => [o.include, o.exclude],
81
81
  ([e, n]) => {
82
- e && V((t) => l(e, t)), n && V((t) => !l(n, t));
82
+ e && K((t) => l(e, t)), n && K((t) => !l(n, t));
83
83
  },
84
84
  // prune post-render after `current` has been updated
85
85
  { flush: "post", deep: !0 }
86
- ), k(
86
+ ), b(
87
87
  () => [o.includeKey, o.excludeKey],
88
88
  ([e, n]) => {
89
- e && e.length && R((t) => typeof t == "string" && l(e, t)), n && n.length && R((t) => typeof t != "string" || !l(n, t));
89
+ e && N((t) => typeof t == "string" && l(e, t)), n && N((t) => typeof t != "string" || !l(n, t));
90
90
  },
91
91
  // prune post-render after `current` has been updated
92
92
  { flush: "post", deep: !0 }
93
93
  );
94
- let h = null;
95
- const T = () => {
96
- h != null && a.set(h, F(d.subTree));
94
+ let y = null;
95
+ const k = () => {
96
+ y != null && c.set(y, v(d.subTree));
97
97
  };
98
- return W(T), j(T), G(() => {
99
- a.forEach((e) => {
100
- const { subTree: n, suspense: t } = d, i = F(n);
101
- if (e.type === i.type) {
102
- C(i);
103
- const c = i.component.da;
104
- c && v(c, t);
98
+ return W(k), j(k), G(() => {
99
+ c.forEach((e) => {
100
+ const { subTree: n, suspense: t } = d, i = v(n);
101
+ if (e.type === i.type && e.key === i.key) {
102
+ S(i);
103
+ const u = i.component.da;
104
+ u && A(u, t);
105
105
  return;
106
106
  }
107
- K(e);
107
+ F(e);
108
108
  });
109
109
  }), () => {
110
- if (h = null, !r.default) return null;
110
+ if (y = null, !r.default) return null;
111
111
  const e = r.default(), n = e[0];
112
112
  if (e.length > 1)
113
- return u = null, e;
113
+ return a = null, e;
114
114
  if (!J(n) || !(n.shapeFlag & 4) && !(n.shapeFlag & 128))
115
- return u = null, n;
116
- let t = F(n);
117
- const i = t.type, c = w(
115
+ return a = null, n;
116
+ let t = v(n);
117
+ const i = t.type, u = w(
118
118
  X(t) ? t.type.__asyncResolved || {} : i
119
- ), s = t.key == null ? i : t.key, { include: g, exclude: _, includeKey: x, excludeKey: A, max: b } = o;
120
- if (g && (!c || !l(g, c)) || _ && c && l(_, c) || x && x.length && (typeof s != "string" || !l(x, s)) || A && A.length && typeof s == "string" && l(A, s))
121
- return u = t, n;
122
- const S = a.get(s);
123
- return t.el && (t = O(t), n.shapeFlag & 128 && (n.ssContent = t)), h = s, S ? (t.el = S.el, t.component = S.component, t.transition && Q(t, t.transition), t.shapeFlag |= 512, p.delete(s), p.add(s)) : (p.add(s), b && p.size > Number.parseInt(b, 10) && m(p.values().next().value || "")), t.shapeFlag |= 256, u = t, Y(n.type) ? n : t;
119
+ ), s = t.key == null ? i : t.key, { include: g, exclude: V, includeKey: R, excludeKey: T, max: _ } = o;
120
+ if (g && (!u || !l(g, u)) || V && u && l(V, u) || R && (typeof s != "string" || !l(R, s)) || T && typeof s == "string" && l(T, s))
121
+ return a = t, n;
122
+ const E = c.get(s);
123
+ return t.el && (t = O(t), n.shapeFlag & 128 && (n.ssContent = t)), y = s, E ? (t.el = E.el, t.component = E.component, t.transition && Q(t, t.transition), t.shapeFlag |= 512, p.delete(s), p.add(s)) : (p.add(s), _ && p.size > Number.parseInt(_, 10) && m(p.values().next().value)), t.shapeFlag |= 256, a = t, Y(n.type) ? n : t;
124
124
  };
125
125
  }
126
- }, ce = Z;
126
+ }, ae = Z;
127
127
  function l(o, r) {
128
- return z(o) ? o.some((y) => l(y, r)) : L(o) ? o.split(",").includes(r) : o.test ? o.test(r) : !1;
128
+ return z(o) ? o.some((h) => l(h, r)) : L(o) ? o.split(",").includes(r) : o.test ? (o.lastIndex = 0, o.test(r)) : !1;
129
129
  }
130
- function C(o) {
130
+ function S(o) {
131
131
  let r = o.shapeFlag;
132
132
  r & 256 && (r -= 256), r & 512 && (r -= 512), o.shapeFlag = r;
133
133
  }
134
- function F(o) {
134
+ function v(o) {
135
135
  return o.shapeFlag & 128 ? o.ssContent : o;
136
136
  }
137
137
  export {
138
- ce as TtKeepAlive
138
+ ae as TtKeepAlive
139
139
  };
@@ -1,13 +1,13 @@
1
- import { defineComponent as Ke, ref as h, useAttrs as Ye, useSlots as Ge, getCurrentInstance as Je, computed as m, unref as o, watch as ae, reactive as Qe, nextTick as M, provide as Xe, onMounted as We, onDeactivated as eo, onActivated as oo, onUnmounted as to, withDirectives as io, createElementBlock as lo, openBlock as no, createVNode as w, mergeProps as de, h as so, createSlots as V, withCtx as f, normalizeClass as ro, renderSlot as b, renderList as _, normalizeProps as z, guardReactiveProps as j, createElementVNode as ao } from "vue";
2
- import { TtIcon as uo } from "../../tt-icon/index.js";
1
+ import { defineComponent as Ye, inject as Ge, ref as k, useAttrs as Je, useSlots as Qe, getCurrentInstance as Xe, computed as m, unref as o, watch as j, reactive as We, nextTick as F, provide as eo, onMounted as oo, onDeactivated as to, onActivated as io, onUnmounted as lo, withDirectives as so, createElementBlock as no, openBlock as ro, createVNode as $, mergeProps as ue, h as ao, createSlots as H, withCtx as f, normalizeClass as uo, renderSlot as C, renderList as N, normalizeProps as Z, guardReactiveProps as q, createElementVNode as po } from "vue";
2
+ import { TtIcon as co } from "../../tt-icon/index.js";
3
3
  import "../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.34_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
4
- import { useDesign as po } from "../../../packages/hooks/src/useDesign.js";
5
- import { usePriorityValues as co, getPriorityValues as fo } from "../../../packages/hooks/src/usePriorityValue.js";
4
+ import { useDesign as fo } from "../../../packages/hooks/src/useDesign.js";
5
+ import { usePriorityValues as mo, getPriorityValues as vo } from "../../../packages/hooks/src/usePriorityValue.js";
6
6
  import "axios";
7
- import { dialogProps as ue, useZIndex as mo, ElDialog as vo } from "element-plus";
7
+ import { dialogProps as pe, useZIndex as go, ElDialog as bo } from "element-plus";
8
8
  import "dayjs";
9
9
  import "numeral";
10
- import { generateTestId as H, toKebabCase as go } from "../../../packages/utils/src/testid-helper.js";
10
+ import { generateTestId as K, toKebabCase as Co } from "../../../packages/utils/src/testid-helper.js";
11
11
  import "xe-utils";
12
12
  import "dayjs/plugin/utc";
13
13
  import "dayjs/plugin/timezone";
@@ -16,27 +16,27 @@ import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.j
16
16
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
17
17
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
18
18
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
19
- import { omit as pe, pick as N } from "lodash-es";
19
+ import { omit as ce, pick as U } from "lodash-es";
20
20
  import "vue-router";
21
- import bo from "../../../directives/dialog-resize/index.js";
22
- import { useStore as Co } from "@tanstack/vue-store";
23
- import To from "./components/ModalFooter.vue.js";
24
- import ho from "./components/ModalHeader.vue.js";
25
- import ko from "./components/ModalWrapper.vue.js";
26
- import { basicProps as yo } from "./props.js";
27
- import { ModalApi as Oo } from "./utils/modal-api.js";
28
- import { resolveModalTarget as ce, MODAL_OVERLAY_CLASS as Bo, MODAL_OVERLAY_CONTAINED_CLASS as Z, findTopOpenModalOverlayHost as Po, ensureContainedOverlayStyle as So, applyContainedOverlayInline as q, watchOverlayThenSuspend as fe, suspendOverlayByUid as Io, resumeOverlayByUid as Ao } from "./utils/resolve-modal-target.js";
29
- import { allocateModalZIndex as Mo } from "./utils/modal-z-index.js";
30
- import { getClientDocument as wo } from "./utils/modal-scope.js";
31
- import { pushModal as me, removeModal as U } from "./utils/modal-stack.js";
32
- import { emitModalCloseTransitionEnd as Fo } from "./utils/modal-close-transition.js";
33
- import $o from "../../../assets/svg/close.svg.js";
34
- const Do = ["aria-tt-id", "data-testid"], xo = ["data-testid"], vt = /* @__PURE__ */ Ke({
21
+ import To from "../../../directives/dialog-resize/index.js";
22
+ import { useStore as ho } from "@tanstack/vue-store";
23
+ import ko from "./components/ModalFooter.vue.js";
24
+ import yo from "./components/ModalHeader.vue.js";
25
+ import Oo from "./components/ModalWrapper.vue.js";
26
+ import { basicProps as Bo } from "./props.js";
27
+ import { ModalApi as Po } from "./utils/modal-api.js";
28
+ import { resolveModalTarget as fe, MODAL_OVERLAY_CLASS as Io, MODAL_OVERLAY_CONTAINED_CLASS as Y, findTopOpenModalOverlayHost as So, ensureContainedOverlayStyle as Ao, applyContainedOverlayInline as G, watchOverlayThenSuspend as me, suspendOverlayByUid as Mo, resumeOverlayByUid as wo } from "./utils/resolve-modal-target.js";
29
+ import { allocateModalZIndex as Fo } from "./utils/modal-z-index.js";
30
+ import { MODAL_OWNER_ACTIVE_KEY as $o, getClientDocument as Do } from "./utils/modal-scope.js";
31
+ import { pushModal as ve, removeModal as J } from "./utils/modal-stack.js";
32
+ import { emitModalCloseTransitionEnd as Lo } from "./utils/modal-close-transition.js";
33
+ import xo from "../../../assets/svg/close.svg.js";
34
+ const Eo = ["aria-tt-id", "data-testid"], _o = ["data-testid"], Ct = /* @__PURE__ */ Ye({
35
35
  name: "TtModal",
36
36
  __name: "RenderModal",
37
37
  props: {
38
- ...ue,
39
- ...yo,
38
+ ...pe,
39
+ ...Bo,
40
40
  /** modalApi */
41
41
  modalApi: {
42
42
  type: Object,
@@ -44,9 +44,9 @@ const Do = ["aria-tt-id", "data-testid"], xo = ["data-testid"], vt = /* @__PURE_
44
44
  }
45
45
  },
46
46
  emits: ["visible-change", "register", "update:visible"],
47
- setup(ve, { expose: ge, emit: be }) {
48
- var se;
49
- const d = ve, F = be, k = h(), { prefixCls: Ce } = po("modal"), p = Ye(), Te = Ge(), t = Je(), K = h(!1), Y = h(), $ = h(), he = mo();
47
+ setup(ge, { expose: be, emit: Ce }) {
48
+ var ae;
49
+ const d = ge, v = Ge($o, void 0), D = Ce, y = k(), { prefixCls: Te } = fo("modal"), p = Je(), he = Qe(), t = Xe(), Q = k(!1), X = k(), L = k(), ke = go();
50
50
  let r = d.modalApi;
51
51
  if (!r) {
52
52
  const e = d.okButtonProps ? {
@@ -56,260 +56,267 @@ const Do = ["aria-tt-id", "data-testid"], xo = ["data-testid"], vt = /* @__PURE_
56
56
  ...d,
57
57
  okButtonProps: e
58
58
  };
59
- r = new Oo(i), r.useStore = (n) => {
60
- const l = n ?? ((s) => s);
61
- return Co(r.store, l);
59
+ r = new Po(i), r.useStore = (s) => {
60
+ const l = s ?? ((n) => n);
61
+ return ho(r.store, l);
62
62
  };
63
63
  }
64
- const v = (se = r.useStore) == null ? void 0 : se.call(r), {
65
- visible: C,
66
- title: G,
67
- width: J,
68
- size: Q,
69
- fullscreen: ke,
70
- resizer: ye,
71
- top: Oe,
72
- isBottom: X,
73
- draggable: Be,
74
- showCancelBtn: Pe,
64
+ const g = (ae = r.useStore) == null ? void 0 : ae.call(r), {
65
+ visible: T,
66
+ title: W,
67
+ width: ee,
68
+ size: oe,
69
+ fullscreen: ye,
70
+ resizer: Oe,
71
+ top: Be,
72
+ isBottom: te,
73
+ draggable: Pe,
74
+ showCancelBtn: Ie,
75
75
  okText: Se,
76
- cancelText: Ie,
77
- okButtonProps: I,
78
- cancelButtonProps: Ae,
79
- confirmLoading: Me,
80
- cancelLoading: we,
81
- showOkBtn: Fe,
82
- loading: W,
83
- height: $e,
84
- showFooter: ee,
85
- loadingTip: De,
76
+ cancelText: Ae,
77
+ okButtonProps: A,
78
+ cancelButtonProps: Me,
79
+ confirmLoading: we,
80
+ cancelLoading: Fe,
81
+ showOkBtn: $e,
82
+ loading: ie,
83
+ height: De,
84
+ showFooter: le,
85
+ loadingTip: Le,
86
86
  ...xe
87
- } = co(d, v), Le = m(() => {
87
+ } = mo(d, g), Ee = m(() => {
88
88
  const e = {
89
89
  mini: "448px",
90
90
  small: "592px",
91
91
  medium: "876px"
92
92
  };
93
- return o(J) ? o(J) : e[o(Q)] ? e[o(Q)] : "500px";
94
- }), D = m(() => {
95
- var re;
96
- const e = fo(xe), i = pe(p, ["onVisibleChange", "onClose", "onClosed", "onOk", "onReceiveSharedData"]), l = {
97
- ...N(e, Object.keys(ue)),
93
+ return o(ee) ? o(ee) : e[o(oe)] ? e[o(oe)] : "500px";
94
+ }), x = m(() => {
95
+ var de;
96
+ const e = vo(xe), i = ce(p, ["onVisibleChange", "onClose", "onClosed", "onOk", "onReceiveSharedData"]), l = {
97
+ ...U(e, Object.keys(pe)),
98
98
  ...i
99
- }, s = l.appendToBody === !0 || l["append-to-body"] === !0 || l["append-to-body"] === "", u = l.appendTo && l.appendTo !== "body" ? l.appendTo : void 0, S = !s && !u, E = S ? $.value : void 0;
100
- let T = null;
101
- E ? T = E === ((re = wo()) == null ? void 0 : re.body) ? null : E : S && (T = ce());
102
- const R = !!T, qe = s || !u && !T, Ue = R || o(X) ? "40px" : "15vh";
99
+ }, n = l.appendToBody === !0 || l["append-to-body"] === !0 || l["append-to-body"] === "", u = l.appendTo && l.appendTo !== "body" ? l.appendTo : void 0, S = !n && !u, V = S ? L.value : void 0;
100
+ let h = null;
101
+ V ? h = V === ((de = Do()) == null ? void 0 : de.body) ? null : V : S && (h = fe());
102
+ const z = !!h, Ke = n || !u && !h, Ue = z || o(te) ? "40px" : "15vh";
103
103
  return {
104
104
  ...l,
105
- modelValue: o(C),
106
- width: o(Le),
105
+ modelValue: o(T),
106
+ width: o(Ee),
107
107
  destroyOnClose: !0,
108
108
  // 默认 false;可通过 modalProps.closeOnClickModal 开启点击遮罩关闭
109
109
  closeOnClickModal: e.closeOnClickModal ?? !1,
110
110
  // 禁用 element-plus 原生 ESC 关闭,改由 modal-stack 统一管理:
111
111
  // 1. 多弹窗时逐个关闭;2. 表单聚焦时 ESC 不关闭弹窗
112
112
  closeOnPressEscape: !1,
113
- top: o(Oe) ?? Ue,
113
+ top: o(Be) ?? Ue,
114
114
  fullscreen: !1,
115
115
  draggable: !1,
116
116
  // 外部显式指定优先;否则用打开时申请到的层级,element-plus 自己的 nextZIndex 不参与决策
117
- zIndex: l.zIndex ?? Y.value,
118
- appendToBody: qe,
119
- ...u ? { appendTo: u } : T ? { appendTo: T } : { appendTo: "body" },
117
+ zIndex: l.zIndex ?? X.value,
118
+ appendToBody: Ke,
119
+ ...u ? { appendTo: u } : h ? { appendTo: h } : { appendTo: "body" },
120
120
  // 区域遮罩不锁整页滚动,避免侧栏能点却滚不动
121
- lockScroll: R ? l.lockScroll ?? !1 : l.lockScroll ?? !0,
121
+ lockScroll: z ? l.lockScroll ?? !1 : l.lockScroll ?? !0,
122
122
  modalClass: [
123
123
  l.modalClass || e.modalClass || "",
124
- Bo,
124
+ Io,
125
125
  `tt-id-${t == null ? void 0 : t.uid}`,
126
- R ? Z : ""
126
+ z ? Y : ""
127
127
  ].filter(Boolean).join(" ")
128
128
  };
129
- }), Ee = m(() => {
129
+ }), _e = m(() => {
130
130
  var i;
131
- return String(((i = D.value) == null ? void 0 : i.modalClass) || "").includes(Z);
131
+ return String(((i = x.value) == null ? void 0 : i.modalClass) || "").includes(Y);
132
132
  }), Re = m(() => ({
133
- showCancelBtn: o(Pe),
133
+ showCancelBtn: o(Ie),
134
134
  okText: o(Se),
135
- cancelText: o(Ie),
136
- okButtonProps: o(I),
137
- cancelButtonProps: o(Ae),
138
- confirmLoading: o(Me),
139
- cancelLoading: o(we),
140
- showOkBtn: o(Fe)
141
- })), oe = m(() => {
142
- var s, u;
143
- const e = (s = o(I)) == null ? void 0 : s.disabled, i = o(W), n = (u = o(I)) == null ? void 0 : u.disabledTip, l = Array.isArray(n) ? n : n ? [n] : [];
135
+ cancelText: o(Ae),
136
+ okButtonProps: o(A),
137
+ cancelButtonProps: o(Me),
138
+ confirmLoading: o(we),
139
+ cancelLoading: o(Fe),
140
+ showOkBtn: o($e)
141
+ })), se = m(() => {
142
+ var n, u;
143
+ const e = (n = o(A)) == null ? void 0 : n.disabled, i = o(ie), s = (u = o(A)) == null ? void 0 : u.disabledTip, l = Array.isArray(s) ? s : s ? [s] : [];
144
144
  return e || i ? [!0, l] : [!1, []];
145
145
  });
146
- ae(
146
+ j(
147
147
  () => {
148
148
  var e;
149
- return (e = v.value) == null ? void 0 : e.visible;
149
+ return (e = g.value) == null ? void 0 : e.visible;
150
150
  },
151
151
  (e) => {
152
152
  var i;
153
- e && ($.value = Po(t == null ? void 0 : t.uid, ce()) ?? void 0, Y.value = Mo(he)), e !== C.value && (F("visible-change", !!e), F("update:visible", !!e)), t && ((i = y.emitVisible) == null || i.call(y, !!e, t == null ? void 0 : t.uid)), t != null && t.uid && (e ? (Ze(), g.value || me({ uid: t.uid, close: () => r.onClosed() }), So(), M(() => {
154
- (t == null ? void 0 : t.uid) != null && (q(t.uid), g.value && (a == null || a(), a = fe(t.uid)), requestAnimationFrame(() => {
155
- (t == null ? void 0 : t.uid) != null && (q(t.uid), g.value && Io(t.uid));
153
+ e && (L.value = So(t == null ? void 0 : t.uid, fe()) ?? void 0, X.value = Fo(ke)), e !== T.value && (D("visible-change", !!e), D("update:visible", !!e)), t && ((i = O.emitVisible) == null || i.call(O, !!e, t == null ? void 0 : t.uid)), t != null && t.uid && (e ? (qe(), (v == null ? void 0 : v.value) === !1 && w(), b.value || ve({ uid: t.uid, close: () => r.onClosed() }), Ao(), F(() => {
154
+ (t == null ? void 0 : t.uid) != null && (G(t.uid), b.value && (a == null || a(), a = me(t.uid)), requestAnimationFrame(() => {
155
+ (t == null ? void 0 : t.uid) != null && (G(t.uid), b.value && Mo(t.uid));
156
156
  }));
157
- })) : (ie(), U(t.uid))), e || r.changeOkLoading(!1);
157
+ })) : (re(), J(t.uid))), e || r.changeOkLoading(!1);
158
158
  },
159
159
  {
160
160
  immediate: !1
161
161
  }
162
- ), ae(
163
- () => o(C),
162
+ ), j(
163
+ () => o(T),
164
164
  (e) => {
165
165
  var i;
166
- e !== ((i = v.value) == null ? void 0 : i.visible) && r.setState({ visible: e }), e || r.changeOkLoading(!1);
166
+ e !== ((i = g.value) == null ? void 0 : i.visible) && r.setState({ visible: e }), e || r.changeOkLoading(!1);
167
167
  },
168
168
  {
169
169
  immediate: !1
170
170
  }
171
171
  );
172
172
  function Ve(e) {
173
- K.value = e;
174
- }
175
- function _e() {
176
- Fo(r);
173
+ Q.value = e;
177
174
  }
178
175
  function ze() {
176
+ Lo(r);
177
+ }
178
+ function je() {
179
179
  document.querySelectorAll(".el-select__popper").forEach((i) => {
180
180
  i.style.display !== "none" && (i.style.display = "none");
181
181
  });
182
182
  }
183
- function x(e) {
183
+ function E(e) {
184
184
  return e.toLowerCase().includes("modal") ? e : `modal-${e}`;
185
185
  }
186
- function je() {
186
+ function He() {
187
187
  const e = p["data-testid"] || p.dataTestid || p.testId || p["test-id"];
188
188
  return e && typeof e == "string" ? e : void 0;
189
189
  }
190
- const A = m(() => {
191
- var s;
192
- const e = (s = v.value) == null ? void 0 : s.testId;
190
+ const M = m(() => {
191
+ var n;
192
+ const e = (n = g.value) == null ? void 0 : n.testId;
193
193
  if (e)
194
- return x(e);
194
+ return E(e);
195
195
  const i = d.testId;
196
196
  if (i)
197
- return x(i);
198
- const n = je();
199
- if (n)
200
- return x(n);
201
- const l = o(G);
202
- return l && typeof l == "string" && l.trim() ? H("modal", go(l)) : t != null && t.uid ? `modal-${t.uid}` : "modal";
203
- }), He = m(() => H(A.value, "footer")), Ne = m(() => H(A.value, "body"));
204
- Xe("modalIdContext", A);
205
- const y = Qe({
197
+ return E(i);
198
+ const s = He();
199
+ if (s)
200
+ return E(s);
201
+ const l = o(W);
202
+ return l && typeof l == "string" && l.trim() ? K("modal", Co(l)) : t != null && t.uid ? `modal-${t.uid}` : "modal";
203
+ }), Ne = m(() => K(M.value, "footer")), Ze = m(() => K(M.value, "body"));
204
+ eo("modalIdContext", M);
205
+ const O = We({
206
206
  setModalProps: r.setState,
207
207
  emitVisible: void 0,
208
208
  redoModalHeight: () => {
209
- M(() => {
210
- o(k) && o(k).setModalHeight();
209
+ F(() => {
210
+ o(y) && o(y).setModalHeight();
211
211
  });
212
212
  },
213
213
  scrollToBottom: () => {
214
214
  var e;
215
- o(k) && ((e = o(k)) == null || e.onScrollBottom());
215
+ o(y) && ((e = o(y)) == null || e.onScrollBottom());
216
216
  }
217
217
  });
218
- t && F("register", y, `${t == null ? void 0 : t.uid}`);
219
- const g = h(!1), O = h(null);
220
- let a, B, c, P = 0;
221
- function L() {
218
+ t && D("register", O, `${t == null ? void 0 : t.uid}`);
219
+ const b = k(!1), B = k(null);
220
+ let a, P, c, I = 0;
221
+ function _() {
222
222
  var i;
223
- return String(((i = D.value) == null ? void 0 : i.modalClass) || "").includes(Z);
223
+ return String(((i = x.value) == null ? void 0 : i.modalClass) || "").includes(Y);
224
224
  }
225
- function te() {
226
- var i, n;
225
+ function ne() {
226
+ var i, s;
227
227
  const e = t == null ? void 0 : t.appContext.config.globalProperties.$router;
228
- return ((n = (i = e == null ? void 0 : e.currentRoute) == null ? void 0 : i.value) == null ? void 0 : n.path) ?? null;
228
+ return ((s = (i = e == null ? void 0 : e.currentRoute) == null ? void 0 : i.value) == null ? void 0 : s.path) ?? null;
229
229
  }
230
- function Ze() {
231
- if (!L()) {
232
- O.value = null;
230
+ function qe() {
231
+ if (!_()) {
232
+ B.value = null;
233
233
  return;
234
234
  }
235
- O.value = te();
235
+ B.value = ne();
236
236
  }
237
- function ie() {
238
- c !== void 0 && (window.cancelAnimationFrame(c), c = void 0), P += 1, a == null || a(), a = void 0, g.value = !1, O.value = null;
237
+ function re() {
238
+ c !== void 0 && (window.cancelAnimationFrame(c), c = void 0), I += 1, a == null || a(), a = void 0, b.value = !1, B.value = null;
239
239
  }
240
- function le() {
241
- var n;
240
+ function w() {
241
+ var s;
242
242
  const e = t == null ? void 0 : t.uid;
243
- e == null || !(o(C) || (n = v.value) != null && n.visible) || !L() || (c !== void 0 && (window.cancelAnimationFrame(c), c = void 0), P += 1, g.value = !0, a == null || a(), a = fe(e), U(e));
243
+ e == null || !(o(T) || (s = g.value) != null && s.visible) || !_() || (c !== void 0 && (window.cancelAnimationFrame(c), c = void 0), I += 1, b.value = !0, a == null || a(), a = me(e), J(e));
244
244
  }
245
- function ne() {
245
+ function R() {
246
246
  const e = t == null ? void 0 : t.uid;
247
- if (e == null || !g.value || c !== void 0) return;
248
- const i = ++P;
249
- M(() => {
250
- i === P && (c = window.requestAnimationFrame(() => {
251
- var s;
252
- if (c = void 0, i !== P) return;
253
- const n = !!(o(C) || (s = v.value) != null && s.visible), l = O.value;
254
- !n || !l || te() !== l || (a == null || a(), a = void 0, g.value = !1, Ao(e), me({ uid: e, close: () => r.onClosed() }), M(() => q(e)));
247
+ if (e == null || !b.value || c !== void 0) return;
248
+ const i = ++I;
249
+ F(() => {
250
+ i === I && (c = window.requestAnimationFrame(() => {
251
+ var n;
252
+ if (c = void 0, i !== I) return;
253
+ const s = !!(o(T) || (n = g.value) != null && n.visible), l = B.value;
254
+ s && ((v ? !v.value : !l || ne() !== l) || (a == null || a(), a = void 0, b.value = !1, wo(e), ve({ uid: e, close: () => r.onClosed() }), F(() => G(e))));
255
255
  }));
256
256
  });
257
257
  }
258
- return We(() => {
259
- const e = N(p, ["onVisibleChange", "onClosed", "onOk"]);
258
+ return oo(() => {
259
+ const e = U(p, ["onVisibleChange", "onClosed", "onOk"]);
260
260
  r.mount(
261
261
  {
262
262
  ...e,
263
263
  onClosed: e.onClosed || p.onCancel || p.onClose
264
264
  },
265
- y
265
+ O
266
266
  );
267
267
  const i = t == null ? void 0 : t.appContext.config.globalProperties.$router;
268
- i != null && i.afterEach && (B = i.afterEach((n, l) => {
268
+ v || !(i != null && i.afterEach) || (P = i.afterEach((s, l) => {
269
269
  var S;
270
- if (!(n != null && n.path) || n.path === (l == null ? void 0 : l.path) || !L() || !!!(o(C) || (S = v.value) != null && S.visible)) return;
271
- const u = O.value;
272
- u && (n.path !== u ? le() : ne());
270
+ if (!(s != null && s.path) || s.path === (l == null ? void 0 : l.path) || !_() || !!!(o(T) || (S = g.value) != null && S.visible)) return;
271
+ const u = B.value;
272
+ u && (s.path !== u ? w() : R());
273
273
  }));
274
- }), eo(() => {
275
- le();
276
- }), oo(() => {
277
- ne();
278
274
  }), to(() => {
279
- ie(), B == null || B(), B = void 0, $.value = void 0, t != null && t.uid && U(t.uid);
280
- }), ge({
275
+ w();
276
+ }), io(() => {
277
+ R();
278
+ }), j(
279
+ v ?? (() => {
280
+ }),
281
+ (e) => {
282
+ e === !1 ? w() : e && R();
283
+ },
284
+ { flush: "post" }
285
+ ), lo(() => {
286
+ re(), P == null || P(), P = void 0, L.value = void 0, t != null && t.uid && J(t.uid);
287
+ }), be({
281
288
  modalApi: r
282
289
  }), (e, i) => {
283
- var n;
284
- return io((no(), lo("div", {
285
- "aria-tt-id": `tt-id-${(n = o(t)) == null ? void 0 : n.uid}`,
286
- "data-testid": A.value
290
+ var s;
291
+ return so((ro(), no("div", {
292
+ "aria-tt-id": `tt-id-${(s = o(t)) == null ? void 0 : s.uid}`,
293
+ "data-testid": M.value
287
294
  }, [
288
- w(o(vo), de(D.value, {
289
- class: ["tt-ui-modal", o(Ce)],
295
+ $(o(bo), ue(x.value, {
296
+ class: ["tt-ui-modal", o(Te)],
290
297
  "before-close": o(r).onClosed,
291
- onClosed: _e,
292
- "close-icon": () => so(o(uo), {
298
+ onClosed: ze,
299
+ "close-icon": () => ao(o(co), {
293
300
  size: 16,
294
- icon: o($o),
301
+ icon: o(xo),
295
302
  isCustomSvg: !0
296
303
  })
297
- }), V({
304
+ }), H({
298
305
  default: f(() => [
299
- w(ko, {
306
+ $(Oo, {
300
307
  ref_key: "modalWrapperRef",
301
- ref: k,
302
- "is-bottom": o(X),
303
- height: o($e),
304
- loading: o(W),
305
- "loading-tip": o(De),
306
- contained: Ee.value,
307
- class: ro({ "pb-2!": !o(ee) }),
308
- "data-testid": Ne.value,
308
+ ref: y,
309
+ "is-bottom": o(te),
310
+ height: o(De),
311
+ loading: o(ie),
312
+ "loading-tip": o(Le),
313
+ contained: _e.value,
314
+ class: uo({ "pb-2!": !o(le) }),
315
+ "data-testid": Ze.value,
309
316
  onIsScroll: Ve
310
317
  }, {
311
318
  default: f(() => [
312
- b(e.$slots, "default")
319
+ C(e.$slots, "default")
313
320
  ]),
314
321
  _: 3
315
322
  }, 8, ["is-bottom", "height", "loading", "loading-tip", "contained", "class", "data-testid"])
@@ -319,63 +326,63 @@ const Do = ["aria-tt-id", "data-testid"], xo = ["data-testid"], vt = /* @__PURE_
319
326
  e.$slots.header ? {
320
327
  name: "header",
321
328
  fn: f(() => [
322
- b(e.$slots, "header")
329
+ C(e.$slots, "header")
323
330
  ]),
324
331
  key: "1"
325
332
  } : {
326
333
  name: "header",
327
334
  fn: f(() => [
328
- w(ho, {
329
- title: o(G),
330
- onMousedown: ze
331
- }, V({
335
+ $(yo, {
336
+ title: o(W),
337
+ onMousedown: je
338
+ }, H({
332
339
  titleToolbar: f(() => [
333
- b(e.$slots, "titleToolbar")
340
+ C(e.$slots, "titleToolbar")
334
341
  ]),
335
342
  _: 2
336
343
  }, [
337
- _(Object.keys(e.$slots), (l) => ({
344
+ N(Object.keys(e.$slots), (l) => ({
338
345
  name: l,
339
- fn: f((s) => [
340
- b(e.$slots, l, z(j(s || {})))
346
+ fn: f((n) => [
347
+ C(e.$slots, l, Z(q(n || {})))
341
348
  ])
342
349
  }))
343
350
  ]), 1032, ["title"])
344
351
  ]),
345
352
  key: "0"
346
353
  },
347
- o(Te).footer || o(ee) ? {
354
+ o(he).footer || o(le) ? {
348
355
  name: "footer",
349
356
  fn: f(() => [
350
- b(e.$slots, "footer", {}, () => [
351
- ao("div", { "data-testid": He.value }, [
352
- w(To, de(Re.value, {
357
+ C(e.$slots, "footer", {}, () => [
358
+ po("div", { "data-testid": Ne.value }, [
359
+ $(ko, ue(Re.value, {
353
360
  class: "footer",
354
- style: { borderTop: K.value ? "1px solid var(--tt-modal-footer-border-color)" : "none" },
361
+ style: { borderTop: Q.value ? "1px solid var(--tt-modal-footer-border-color)" : "none" },
355
362
  "ok-button-props": {
356
- ...o(I),
357
- disabledTip: oe.value[1],
358
- disabled: oe.value[0]
363
+ ...o(A),
364
+ disabledTip: se.value[1],
365
+ disabled: se.value[0]
359
366
  },
360
367
  onFooterok: o(r).onOk,
361
368
  onCancel: o(r).onClosed
362
- }), V({ _: 2 }, [
363
- _(Object.keys(
364
- o(N)(e.$slots, ["beforeFooter", "insertFooter", "centerFooter", "appendFooter"])
369
+ }), H({ _: 2 }, [
370
+ N(Object.keys(
371
+ o(U)(e.$slots, ["beforeFooter", "insertFooter", "centerFooter", "appendFooter"])
365
372
  ), (l) => ({
366
373
  name: l,
367
- fn: f((s) => [
368
- b(e.$slots, l, z(j({ ...s || {} })))
374
+ fn: f((n) => [
375
+ C(e.$slots, l, Z(q({ ...n || {} })))
369
376
  ])
370
377
  }))
371
378
  ]), 1040, ["style", "ok-button-props", "onFooterok", "onCancel"])
372
- ], 8, xo)
379
+ ], 8, _o)
373
380
  ])
374
381
  ]),
375
382
  key: "2"
376
383
  } : void 0,
377
- _(Object.keys(
378
- o(pe)(e.$slots, [
384
+ N(Object.keys(
385
+ o(ce)(e.$slots, [
379
386
  "default",
380
387
  "titleToolbar",
381
388
  "header",
@@ -387,16 +394,16 @@ const Do = ["aria-tt-id", "data-testid"], xo = ["data-testid"], vt = /* @__PURE_
387
394
  ])
388
395
  ), (l) => ({
389
396
  name: l,
390
- fn: f((s) => [
391
- b(e.$slots, l, z(j(s || {})))
397
+ fn: f((n) => [
398
+ C(e.$slots, l, Z(q(n || {})))
392
399
  ])
393
400
  }))
394
401
  ]), 1040, ["class", "before-close", "close-icon"])
395
- ], 8, Do)), [
396
- [o(bo), {
397
- draggable: o(Be),
398
- fullscreen: o(ke),
399
- resizer: o(ye),
402
+ ], 8, Eo)), [
403
+ [o(To), {
404
+ draggable: o(Pe),
405
+ fullscreen: o(ye),
406
+ resizer: o(Oe),
400
407
  resizeChange: o(p).resizeChange
401
408
  }]
402
409
  ]);
@@ -404,5 +411,5 @@ const Do = ["aria-tt-id", "data-testid"], xo = ["data-testid"], vt = /* @__PURE_
404
411
  }
405
412
  });
406
413
  export {
407
- vt as default
414
+ Ct as default
408
415
  };
@@ -1,37 +1,38 @@
1
- import { useStore as h } from "@tanstack/vue-store";
2
- import { reactive as x, ref as _, defineComponent as M, provide as w, nextTick as T, h as i, inject as E, onMounted as S, render as y } from "vue";
3
- import { RouterView as g } from "vue-router";
4
- import v from "../RenderModal.vue.js";
1
+ import { useStore as y } from "@tanstack/vue-store";
2
+ import { reactive as w, ref as E, defineComponent as A, provide as O, nextTick as T, h as f, inject as b, getCurrentScope as x, effectScope as g, onScopeDispose as R, render as v, onMounted as k } from "vue";
3
+ import { RouterView as L } from "vue-router";
4
+ import h from "../RenderModal.vue.js";
5
5
  /* empty css */
6
- import { ModalApi as O } from "../utils/modal-api.js";
7
- import { onModalCloseTransitionEnd as k } from "../utils/modal-close-transition.js";
8
- import { resolveModalTarget as P } from "../utils/resolve-modal-target.js";
9
- const R = Symbol("Tt_MODAL_INJECT"), L = {};
10
- function K(n = {}, c = R) {
11
- var m;
12
- const { connectedComponent: r } = n;
13
- if (r) {
14
- const e = x({}), d = _(!0);
15
- return [M(
16
- (u, { attrs: C, slots: A }) => (w(c, {
17
- extendApi(b) {
18
- Object.setPrototypeOf(e, b);
6
+ import { ModalApi as S } from "../utils/modal-api.js";
7
+ import { onModalCloseTransitionEnd as P } from "../utils/modal-close-transition.js";
8
+ import { resolveModalTarget as V } from "../utils/resolve-modal-target.js";
9
+ import { modalOwnerActive as N, MODAL_OWNER_ACTIVE_KEY as D } from "../utils/modal-scope.js";
10
+ const I = Symbol("Tt_MODAL_INJECT"), j = {};
11
+ function H(t = {}, l = I) {
12
+ var p;
13
+ const { connectedComponent: n } = t;
14
+ if (n) {
15
+ const e = w({}), s = E(!0);
16
+ return [A(
17
+ (m, { attrs: u, slots: M }) => (O(l, {
18
+ extendApi(_) {
19
+ Object.setPrototypeOf(e, _);
19
20
  },
20
- options: n,
21
+ options: t,
21
22
  async reCreateModal() {
22
- d.value = !1, await T(), d.value = !0;
23
+ s.value = !1, await T(), s.value = !0;
23
24
  }
24
- }), V(e, {
25
+ }), J(e, {
26
+ ...m,
25
27
  ...u,
26
- ...C,
27
- ...A
28
- }), () => i(
29
- d.value ? r : "div",
28
+ ...M
29
+ }), () => f(
30
+ s.value ? n : "div",
30
31
  {
31
- ...u,
32
- ...C
32
+ ...m,
33
+ ...u
33
34
  },
34
- A
35
+ M
35
36
  )),
36
37
  {
37
38
  name: "TtModal",
@@ -39,93 +40,93 @@ function K(n = {}, c = R) {
39
40
  }
40
41
  ), e];
41
42
  }
42
- const o = E(c, {}), t = {
43
- ...L,
43
+ const o = b(l, {}), r = {
44
+ ...j,
44
45
  ...o.options,
45
- ...n
46
+ ...t
46
47
  };
47
- t.onVisibleChange = (e) => {
48
- var d, a, u;
49
- (d = n.onVisibleChange) == null || d.call(n, e), (u = (a = o.options) == null ? void 0 : a.onVisibleChange) == null || u.call(a, e);
48
+ r.onVisibleChange = (e) => {
49
+ var s, i, m;
50
+ (s = t.onVisibleChange) == null || s.call(t, e), (m = (i = o.options) == null ? void 0 : i.onVisibleChange) == null || m.call(i, e);
50
51
  };
51
- const s = t.onClosed;
52
- t.onClosed = () => {
52
+ const c = r.onClosed;
53
+ r.onClosed = () => {
53
54
  var e;
54
- s == null || s(), t.destroyOnClose && ((e = o.reCreateDrawer) == null || e.call(o));
55
+ c == null || c(), r.destroyOnClose && ((e = o.reCreateDrawer) == null || e.call(o));
55
56
  };
56
- const f = new O(t), l = f;
57
- l.useStore = (e) => h(f.store, e);
58
- const p = M(
59
- (e, { attrs: d, slots: a }) => () => i(
60
- v,
57
+ const d = new S(r), a = d;
58
+ a.useStore = (e) => y(d.store, e);
59
+ const C = A(
60
+ (e, { attrs: s, slots: i }) => () => f(
61
+ h,
61
62
  {
62
63
  ...e,
63
- ...d,
64
- modalApi: l
64
+ ...s,
65
+ modalApi: a
65
66
  },
66
- a
67
+ i
67
68
  ),
68
69
  {
69
70
  name: "TtModal",
70
71
  inheritAttrs: !1
71
72
  }
72
73
  );
73
- return (m = o.extendApi) == null || m.call(o, l), [p, l];
74
+ return (p = o.extendApi) == null || p.call(o, a), [C, a];
74
75
  }
75
- function q(n, c, r) {
76
- const o = new O(r), t = o;
77
- t.useStore = (e) => h(o.store, e);
78
- const s = document.createElement("div");
79
- (r.appendToBody ? document.body : P() ?? document.body).appendChild(s);
80
- const l = M(
81
- (e, { slots: d }) => {
82
- S(() => {
83
- r && t.setModalProps(r), t.openModal();
84
- });
85
- const a = k(t, () => {
86
- a(), y(null, s), s.remove();
87
- });
88
- return () => i(
89
- v,
90
- {
91
- ...e,
92
- modalApi: t
93
- },
94
- d
95
- );
96
- },
76
+ function Q(t, l, n) {
77
+ const o = x(), r = o ? N.get(o) : void 0, c = new S(n), d = c;
78
+ d.useStore = (u) => y(c.store, u);
79
+ const a = document.createElement("div");
80
+ (n.appendToBody ? document.body : V() ?? document.body).appendChild(a);
81
+ const p = g(), e = P(d, () => p.stop());
82
+ p.run(() => {
83
+ R(() => {
84
+ e(), v(null, a), a.remove();
85
+ });
86
+ });
87
+ const s = A(
88
+ (u, { slots: M }) => (r && O(D, r), k(() => {
89
+ n && d.setModalProps(n), d.openModal();
90
+ }), () => f(
91
+ h,
92
+ {
93
+ ...u,
94
+ modalApi: d
95
+ },
96
+ M
97
+ )),
97
98
  {
98
99
  name: "TtModal",
99
100
  inheritAttrs: !1
100
101
  }
101
- ), p = i(c, {}), m = i(
102
- g,
102
+ ), i = f(l, {}), m = f(
103
+ L,
103
104
  {},
104
- () => i(
105
- l,
105
+ () => f(
106
+ s,
106
107
  {
107
- ...r
108
+ ...n
108
109
  },
109
110
  {
110
- default: () => p
111
+ default: () => i
111
112
  }
112
113
  )
113
114
  );
114
- return m.appContext = n._context, y(m, s), t;
115
+ return m.appContext = t._context, v(m, a), d;
115
116
  }
116
- async function V(n, c) {
117
- var t;
118
- if (!c || Object.keys(c).length === 0)
117
+ async function J(t, l) {
118
+ var r;
119
+ if (!l || Object.keys(l).length === 0)
119
120
  return;
120
121
  await T();
121
- const r = (t = n == null ? void 0 : n.store) == null ? void 0 : t.state;
122
- if (!r)
122
+ const n = (r = t == null ? void 0 : t.store) == null ? void 0 : r.state;
123
+ if (!n)
123
124
  return;
124
- const o = new Set(Object.keys(r));
125
- for (const s of Object.keys(c))
126
- o.has(s) && ["class"].includes(s);
125
+ const o = new Set(Object.keys(n));
126
+ for (const c of Object.keys(l))
127
+ o.has(c) && ["class"].includes(c);
127
128
  }
128
129
  export {
129
- q as showTtModal,
130
- K as useModalRender
130
+ Q as showTtModal,
131
+ H as useModalRender
131
132
  };
@@ -1,19 +1,32 @@
1
- import { inject as e } from "vue";
1
+ import { inject as n, getCurrentScope as u, shallowRef as c, computed as d, onActivated as i, onDeactivated as f } from "vue";
2
2
  import { showTtModal as M } from "./hooks/useModalRender.js";
3
- import { setModalHostApp as d } from "./utils/modal-host-app.js";
4
- const t = Symbol("SHOW_MODAL");
5
- function f(o) {
6
- d(o);
7
- const r = (n, s) => M(o, n, s);
8
- o.provide(t, r);
3
+ import { setModalHostApp as w } from "./utils/modal-host-app.js";
4
+ import { MODAL_OWNER_ACTIVE_KEY as m, modalOwnerActive as v } from "./utils/modal-scope.js";
5
+ const s = Symbol("SHOW_MODAL");
6
+ function A(t) {
7
+ w(t);
8
+ const o = (e, r) => M(t, e, r);
9
+ t.provide(s, o);
9
10
  }
10
- function m() {
11
- const o = e(t);
12
- if (!o)
11
+ function E() {
12
+ const t = n(s);
13
+ if (!t)
13
14
  throw new Error("[TtModal]: useShowModal() 需要先调用 setupModal(app) 进行注册");
14
- return o;
15
+ const o = u(), e = c(!0), r = n(m, void 0);
16
+ return o && v.set(
17
+ o,
18
+ d(() => e.value && (r == null ? void 0 : r.value) !== !1)
19
+ ), i(() => {
20
+ e.value = !0;
21
+ }), f(() => {
22
+ e.value = !1;
23
+ }), (a, l) => {
24
+ if (o && !o.active)
25
+ throw new Error("[TtModal]: 页面已销毁,不能再打开弹窗");
26
+ return o ? o.run(() => t(a, l)) : t(a, l);
27
+ };
15
28
  }
16
29
  export {
17
- f as setupModal,
18
- m as useShowModal
30
+ A as setupModal,
31
+ E as useShowModal
19
32
  };
@@ -1,7 +1,8 @@
1
- /**
2
- * 微前端隔离工具。组件库被抽成共享依赖时多个子应用共用模块级状态,
3
- * 因此模块级注册表都要按子应用分桶。
4
- */
1
+ import { EffectScope, InjectionKey, Ref } from 'vue';
2
+ /** 命令式弹窗从调用方作用域继承激活状态,WeakMap 不延长页面寿命。 */
3
+ export declare const modalOwnerActive: WeakMap<EffectScope, Readonly<Ref<boolean, boolean>>>;
4
+ /** 独立挂载的弹窗向内容组件传递所属页面状态,支持嵌套弹窗。 */
5
+ export declare const MODAL_OWNER_ACTIVE_KEY: InjectionKey<Readonly<Ref<boolean>>>;
5
6
  /** 当前作用域标识:子应用用 micro-app name,宿主页面用 host */
6
7
  export declare function getModalScopeKey(): string;
7
8
  /**
@@ -1,20 +1,23 @@
1
- function c() {
1
+ const c = /* @__PURE__ */ new WeakMap(), i = Symbol("TtModalOwnerActive");
2
+ function r() {
2
3
  return typeof window > "u" ? "host" : window.__MICRO_APP_NAME__ || "host";
3
4
  }
4
- function u(t) {
5
+ function u(e) {
5
6
  var n;
6
- const o = t.body ?? t.documentElement, e = (n = o == null ? void 0 : o.getRootNode) == null ? void 0 : n.call(o);
7
- return e instanceof Document ? e : t;
7
+ const o = e.body ?? e.documentElement, t = (n = o == null ? void 0 : o.getRootNode) == null ? void 0 : n.call(o);
8
+ return t instanceof Document ? t : e;
8
9
  }
9
- function i() {
10
+ function s() {
10
11
  return typeof document > "u" ? void 0 : document;
11
12
  }
12
- function r(t, o) {
13
- return t.closest("micro-app-body") === o.closest("micro-app-body");
13
+ function d(e, o) {
14
+ return e.closest("micro-app-body") === o.closest("micro-app-body");
14
15
  }
15
16
  export {
16
- i as getClientDocument,
17
- c as getModalScopeKey,
18
- r as isSameMicroAppScope,
17
+ i as MODAL_OWNER_ACTIVE_KEY,
18
+ s as getClientDocument,
19
+ r as getModalScopeKey,
20
+ d as isSameMicroAppScope,
21
+ c as modalOwnerActive,
19
22
  u as resolveScanDocument
20
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.6.45",
3
+ "version": "1.6.46",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",