@dazhicheng/ui 1.6.40 → 1.6.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/tt-modal/src/RenderModal.vue.js +231 -258
- package/dist/components/tt-modal/src/utils/modal-z-index.d.ts +0 -7
- package/dist/components/tt-modal/src/utils/modal-z-index.js +14 -16
- package/dist/components/tt-modal/src/utils/resolve-modal-target.d.ts +0 -13
- package/dist/components/tt-modal/src/utils/resolve-modal-target.js +73 -106
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +181 -208
- package/package.json +3 -3
|
@@ -3,13 +3,6 @@ import { useZIndex } from 'element-plus';
|
|
|
3
3
|
export type ElementPlusZIndex = ReturnType<typeof useZIndex>;
|
|
4
4
|
/** 当前已打开弹窗里的最高层级 */
|
|
5
5
|
export declare function getOpenModalMaxZIndex(): number;
|
|
6
|
-
/**
|
|
7
|
-
* 把 element-plus 计数器抬到 target 之上。弹窗内的下拉、气泡仍由它发号,
|
|
8
|
-
* 且默认 Teleport 到 body 与遮罩同级,不同步就会落到弹窗下面。
|
|
9
|
-
* @param elementPlusZIndex 计数器句柄
|
|
10
|
-
* @param target 需要被压住的层级
|
|
11
|
-
*/
|
|
12
|
-
export declare function syncElementPlusZIndexAbove(elementPlusZIndex: ElementPlusZIndex, target: number): void;
|
|
13
6
|
/**
|
|
14
7
|
* 申请一个高于当前所有已打开弹窗的层级。
|
|
15
8
|
*
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import { getOpenModalOverlays as
|
|
2
|
-
const
|
|
3
|
-
let
|
|
4
|
-
function
|
|
5
|
-
return
|
|
1
|
+
import { getOpenModalOverlays as r, readOverlayZIndex as x } from "./resolve-modal-target.js";
|
|
2
|
+
const a = 1, c = 2e3;
|
|
3
|
+
let o = 0;
|
|
4
|
+
function s() {
|
|
5
|
+
return r().reduce((n, e) => Math.max(n, x(e)), 0);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
d(), a += 1;
|
|
7
|
+
function I(n, e) {
|
|
8
|
+
const { currentZIndex: d, nextZIndex: l } = n;
|
|
9
|
+
let t = 0;
|
|
10
|
+
for (; d.value <= e && t < c; )
|
|
11
|
+
l(), t += 1;
|
|
13
12
|
}
|
|
14
13
|
function u(n) {
|
|
15
14
|
const e = Math.max(
|
|
16
15
|
n.nextZIndex(),
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
s() + a,
|
|
17
|
+
o + a
|
|
19
18
|
);
|
|
20
|
-
return
|
|
19
|
+
return o = e, I(n, e), e;
|
|
21
20
|
}
|
|
22
21
|
export {
|
|
23
22
|
u as allocateModalZIndex,
|
|
24
|
-
|
|
25
|
-
s as syncElementPlusZIndexAbove
|
|
23
|
+
s as getOpenModalMaxZIndex
|
|
26
24
|
};
|
|
@@ -5,19 +5,6 @@ export declare const MODAL_OVERLAY_CLASS = "tt-modal-overlay";
|
|
|
5
5
|
export declare function ensureContainedOverlayStyle(doc?: Document): void;
|
|
6
6
|
/** 用内联样式强制区域遮罩,压过 EP 的 position:fixed(含内部 overlay-dialog) */
|
|
7
7
|
export declare function applyContainedOverlayInline(uid: string | number, doc?: Document): void;
|
|
8
|
-
/**
|
|
9
|
-
* 打开/resume:保证区域遮罩能吃到点击。
|
|
10
|
-
* 同容器内页面兄弟 z-index 更高时会点穿;仅调 DOM 顺序不够,需抬遮罩层级。
|
|
11
|
-
*
|
|
12
|
-
* 不把 axios / v-loading 的 `.el-loading-mask` 算进兄弟层级:
|
|
13
|
-
* 编辑弹窗拉详情时 loading 会挂到同一 `#app`,若据此抬遮罩却未同步 EP,
|
|
14
|
-
* 弹窗内 PanelSelect / Select 下拉会掉到遮罩下面。
|
|
15
|
-
*/
|
|
16
|
-
export declare function ensureOverlayHitTarget(uid: string | number, doc?: Document): void;
|
|
17
|
-
/** 区域弹窗锁挂载容器滚动(不锁 body,侧栏/顶栏仍可操作) */
|
|
18
|
-
export declare function lockModalMountScroll(target: HTMLElement | null): void;
|
|
19
|
-
/** 关闭/切走时恢复挂载容器滚动 */
|
|
20
|
-
export declare function unlockModalMountScroll(target: HTMLElement | null): void;
|
|
21
8
|
/** KeepAlive / 切页:隐藏已 Teleport 出去的遮罩,避免挡其它页。找到并隐藏则 true */
|
|
22
9
|
export declare function suspendOverlayByUid(uid: string | number, doc?: Document): boolean;
|
|
23
10
|
/**
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { getClientDocument as
|
|
2
|
-
import { getOpenModalUids as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
import { getClientDocument as S, isSameMicroAppScope as _, resolveScanDocument as C } from "./modal-scope.js";
|
|
2
|
+
import { getOpenModalUids as O } from "./modal-stack.js";
|
|
3
|
+
const A = 48, m = 8, a = "tt-modal-overlay--contained", E = "tt-modal-overlay", y = "tt-modal-overlay-contained-style-v2";
|
|
4
|
+
function M(t = document) {
|
|
5
5
|
var r;
|
|
6
6
|
if (typeof t > "u") return;
|
|
7
7
|
const o = `
|
|
8
|
-
.el-overlay.${
|
|
9
|
-
.el-overlay.${
|
|
8
|
+
.el-overlay.${a},
|
|
9
|
+
.el-overlay.${a} .el-overlay-dialog {
|
|
10
10
|
position: absolute !important;
|
|
11
11
|
inset: 0 !important;
|
|
12
12
|
height: 100% !important;
|
|
13
13
|
}
|
|
14
|
-
.el-overlay.${
|
|
14
|
+
.el-overlay.${a} .el-overlay-dialog {
|
|
15
15
|
overflow: auto !important;
|
|
16
16
|
}
|
|
17
|
-
.el-overlay.${
|
|
17
|
+
.el-overlay.${a} .tt-ui-modal.el-dialog {
|
|
18
18
|
--tt-modal-contained-top: 40px;
|
|
19
19
|
--tt-modal-contained-bottom: 24px;
|
|
20
20
|
margin-top: var(--tt-modal-contained-top) !important;
|
|
@@ -24,197 +24,164 @@ function I(t = document) {
|
|
|
24
24
|
flex-direction: column !important;
|
|
25
25
|
overflow: hidden !important;
|
|
26
26
|
}
|
|
27
|
-
.el-overlay.${
|
|
28
|
-
.el-overlay.${
|
|
27
|
+
.el-overlay.${a} .tt-ui-modal.el-dialog .el-dialog__header,
|
|
28
|
+
.el-overlay.${a} .tt-ui-modal.el-dialog .el-dialog__footer {
|
|
29
29
|
flex-shrink: 0;
|
|
30
30
|
}
|
|
31
|
-
.el-overlay.${
|
|
31
|
+
.el-overlay.${a} .tt-ui-modal.el-dialog .el-dialog__body {
|
|
32
32
|
display: flex !important;
|
|
33
33
|
flex: 1 1 auto !important;
|
|
34
34
|
flex-direction: column !important;
|
|
35
35
|
min-height: 0 !important;
|
|
36
36
|
overflow: hidden !important;
|
|
37
37
|
}
|
|
38
|
-
.el-overlay.${
|
|
38
|
+
.el-overlay.${a} .tt-ui-modal.el-dialog .tt-modal-wrapper {
|
|
39
39
|
flex: 1 1 auto !important;
|
|
40
40
|
min-height: 0 !important;
|
|
41
41
|
max-height: none !important;
|
|
42
42
|
overflow: auto !important;
|
|
43
43
|
}
|
|
44
44
|
`.trim();
|
|
45
|
-
let e = t.getElementById(
|
|
45
|
+
let e = t.getElementById(y);
|
|
46
46
|
if (e) {
|
|
47
47
|
e.textContent = o;
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
(r = t.getElementById("tt-modal-overlay-contained-style")) == null || r.remove(), e = t.createElement("style"), e.id =
|
|
50
|
+
(r = t.getElementById("tt-modal-overlay-contained-style")) == null || r.remove(), e = t.createElement("style"), e.id = y, e.textContent = o;
|
|
51
51
|
const n = t.head || t.documentElement;
|
|
52
52
|
n == null || n.appendChild(e);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function f(t) {
|
|
55
55
|
t.style.setProperty("position", "absolute", "important"), t.style.setProperty("top", "0", "important"), t.style.setProperty("right", "0", "important"), t.style.setProperty("bottom", "0", "important"), t.style.setProperty("left", "0", "important"), t.style.setProperty("height", "100%", "important");
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function v(t) {
|
|
58
58
|
["position", "top", "right", "bottom", "left", "height"].forEach((o) => t.style.removeProperty(o));
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function w(t, o = document) {
|
|
61
61
|
const e = o.querySelector(`.el-overlay.tt-id-${t}`);
|
|
62
62
|
if (!e) return;
|
|
63
63
|
const n = e.querySelector(".el-overlay-dialog"), r = !!e.closest("micro-app-body");
|
|
64
|
-
if (!e.classList.contains(
|
|
65
|
-
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
g(e), n && g(n), O(t, o);
|
|
69
|
-
}
|
|
70
|
-
const d = "data-tt-modal-scroll-lock";
|
|
71
|
-
function O(t, o = document) {
|
|
72
|
-
var s;
|
|
73
|
-
const e = o.querySelector(`.el-overlay.tt-id-${t}`);
|
|
74
|
-
if (!(e != null && e.parentElement)) return;
|
|
75
|
-
e.style.setProperty("pointer-events", "auto"), (s = e.querySelector(".el-overlay-dialog")) == null || s.style.setProperty("pointer-events", "auto");
|
|
76
|
-
const n = e.parentElement;
|
|
77
|
-
let r = 0;
|
|
78
|
-
for (const l of Array.from(n.children)) {
|
|
79
|
-
if (l === e || !(l instanceof HTMLElement) || l.classList.contains(A) || l.classList.contains("el-loading-mask")) continue;
|
|
80
|
-
const a = Number.parseInt(l.style.zIndex || getComputedStyle(l).zIndex || "0", 10);
|
|
81
|
-
Number.isNaN(a) || (r = Math.max(r, a));
|
|
82
|
-
}
|
|
83
|
-
const i = m(e);
|
|
84
|
-
r >= i && (e.style.zIndex = String(r + 1)), n.lastElementChild !== e && n.appendChild(e);
|
|
85
|
-
}
|
|
86
|
-
function D(t) {
|
|
87
|
-
if (!t) return;
|
|
88
|
-
const o = Number(t.getAttribute(d) || "0");
|
|
89
|
-
o === 0 && (t.dataset.ttModalPrevOverflow = t.style.overflow || "", t.style.overflow = "hidden"), t.setAttribute(d, String(o + 1));
|
|
90
|
-
}
|
|
91
|
-
function k(t) {
|
|
92
|
-
if (!t) return;
|
|
93
|
-
const o = Number(t.getAttribute(d) || "0");
|
|
94
|
-
if (o <= 1) {
|
|
95
|
-
t.style.overflow = t.dataset.ttModalPrevOverflow || "", delete t.dataset.ttModalPrevOverflow, t.removeAttribute(d);
|
|
64
|
+
if (!e.classList.contains(a) && !r) {
|
|
65
|
+
v(e), n && v(n);
|
|
96
66
|
return;
|
|
97
67
|
}
|
|
98
|
-
|
|
68
|
+
f(e), n && f(n);
|
|
99
69
|
}
|
|
100
|
-
function
|
|
70
|
+
function g(t, o = document) {
|
|
101
71
|
const e = o.querySelector(`.el-overlay.tt-id-${t}`);
|
|
102
72
|
return e ? (e.dataset.ttModalSuspended = "1", e.style.setProperty("display", "none", "important"), !0) : !1;
|
|
103
73
|
}
|
|
104
|
-
function
|
|
105
|
-
if (
|
|
74
|
+
function B(t, o = document, e = 3e3) {
|
|
75
|
+
if (g(t, o)) return () => {
|
|
106
76
|
};
|
|
107
77
|
const n = o.body || o.documentElement;
|
|
108
78
|
if (!n) return () => {
|
|
109
79
|
};
|
|
110
80
|
let r = !1;
|
|
111
81
|
const i = () => {
|
|
112
|
-
r || (r = !0, s.disconnect(), clearTimeout(
|
|
82
|
+
r || (r = !0, s.disconnect(), clearTimeout(c));
|
|
113
83
|
}, s = new MutationObserver(() => {
|
|
114
|
-
|
|
84
|
+
g(t, o) && i();
|
|
115
85
|
});
|
|
116
86
|
s.observe(n, { childList: !0, subtree: !0 });
|
|
117
|
-
const
|
|
87
|
+
const c = window.setTimeout(i, e);
|
|
118
88
|
return i;
|
|
119
89
|
}
|
|
120
|
-
function
|
|
90
|
+
function D(t, o = document) {
|
|
121
91
|
const e = o.querySelector(`.el-overlay.tt-id-${t}`);
|
|
122
|
-
!e || e.dataset.ttModalSuspended !== "1" || (delete e.dataset.ttModalSuspended, e.style.removeProperty("display"),
|
|
92
|
+
!e || e.dataset.ttModalSuspended !== "1" || (delete e.dataset.ttModalSuspended, e.style.removeProperty("display"), w(t, o));
|
|
123
93
|
}
|
|
124
|
-
function
|
|
94
|
+
function h(t) {
|
|
125
95
|
const o = t.style.zIndex || getComputedStyle(t).zIndex, e = Number.parseInt(o, 10);
|
|
126
96
|
return Number.isNaN(e) ? 0 : e;
|
|
127
97
|
}
|
|
128
|
-
function
|
|
129
|
-
const o = t ??
|
|
130
|
-
return o ? Array.from(
|
|
98
|
+
function I(t) {
|
|
99
|
+
const o = t ?? S();
|
|
100
|
+
return o ? Array.from(C(o).querySelectorAll(`.${E}`)).filter(
|
|
131
101
|
(e) => e.isConnected && e.dataset.ttModalSuspended !== "1" && e.style.display !== "none"
|
|
132
102
|
) : [];
|
|
133
103
|
}
|
|
134
|
-
function
|
|
135
|
-
const n =
|
|
104
|
+
function H(t, o, e) {
|
|
105
|
+
const n = S(), r = o ?? (n == null ? void 0 : n.body);
|
|
136
106
|
if (!n || !r) return null;
|
|
137
|
-
const i =
|
|
138
|
-
if (t != null &&
|
|
139
|
-
const u =
|
|
140
|
-
return !!u &&
|
|
107
|
+
const i = O().map((l) => `tt-id-${l}`), s = I(n).filter((l) => {
|
|
108
|
+
if (t != null && l.classList.contains(`tt-id-${t}`) || !i.some((b) => l.classList.contains(b))) return !1;
|
|
109
|
+
const u = l.parentElement;
|
|
110
|
+
return !!u && _(u, r);
|
|
141
111
|
});
|
|
142
|
-
return s.length === 0 ? null : s.reduce((
|
|
112
|
+
return s.length === 0 ? null : s.reduce((l, u) => h(u) >= h(l) ? u : l).parentElement;
|
|
143
113
|
}
|
|
144
|
-
function
|
|
114
|
+
function P(t) {
|
|
145
115
|
return t.isConnected ? t.getClientRects().length > 0 : !1;
|
|
146
116
|
}
|
|
147
117
|
function T(t) {
|
|
148
|
-
return t.isConnected ? (t.clientHeight || t.getBoundingClientRect().height) >=
|
|
118
|
+
return t.isConnected ? (t.clientHeight || t.getBoundingClientRect().height) >= A : !1;
|
|
149
119
|
}
|
|
150
|
-
function
|
|
120
|
+
function x(t) {
|
|
151
121
|
const o = window.innerHeight || document.documentElement.clientHeight || 0;
|
|
152
122
|
if (o === 0) return !0;
|
|
153
123
|
const e = t.getBoundingClientRect();
|
|
154
|
-
return e.height > o +
|
|
124
|
+
return e.height > o + m ? !1 : e.top >= -m;
|
|
155
125
|
}
|
|
156
|
-
function
|
|
126
|
+
function p(t) {
|
|
157
127
|
return !!t.closest("micro-app-body");
|
|
158
128
|
}
|
|
159
|
-
function
|
|
160
|
-
return !t || !t.isConnected || o && !T(t) || o && !
|
|
129
|
+
function d(t, o = !0) {
|
|
130
|
+
return !t || !t.isConnected || o && !T(t) || o && !P(t) ? null : t;
|
|
161
131
|
}
|
|
162
|
-
function
|
|
132
|
+
function N(t) {
|
|
163
133
|
getComputedStyle(t).position === "static" && (t.style.position = "relative");
|
|
164
134
|
}
|
|
165
|
-
function
|
|
135
|
+
function R() {
|
|
166
136
|
const t = window.__MICRO_APP_NAME__;
|
|
167
137
|
if (t) {
|
|
168
|
-
const i = typeof CSS < "u" && CSS.escape ? CSS.escape(t) : t, s = document.querySelector(`micro-app[name="${i}"] micro-app-body #app`),
|
|
169
|
-
if (
|
|
138
|
+
const i = typeof CSS < "u" && CSS.escape ? CSS.escape(t) : t, s = document.querySelector(`micro-app[name="${i}"] micro-app-body #app`), c = d(s, !1);
|
|
139
|
+
if (c) return c;
|
|
170
140
|
}
|
|
171
141
|
const o = document.querySelector("#app");
|
|
172
142
|
if (o) {
|
|
173
|
-
const i =
|
|
143
|
+
const i = d(o, !1);
|
|
174
144
|
return i || o;
|
|
175
145
|
}
|
|
176
146
|
const e = document.querySelector("micro-app-body #app");
|
|
177
147
|
if (e) {
|
|
178
|
-
const i =
|
|
148
|
+
const i = d(e, !1);
|
|
179
149
|
if (i) return i;
|
|
180
150
|
}
|
|
181
151
|
const n = document.body;
|
|
182
|
-
return n && (n.tagName === "MICRO-APP-BODY" ||
|
|
152
|
+
return n && (n.tagName === "MICRO-APP-BODY" || p(n)) ? n : document.querySelector("micro-app-body");
|
|
183
153
|
}
|
|
184
|
-
function
|
|
154
|
+
function $() {
|
|
185
155
|
const t = document.querySelector("#app-content");
|
|
186
|
-
if (t && !
|
|
187
|
-
const e =
|
|
156
|
+
if (t && !p(t)) {
|
|
157
|
+
const e = d(t, !0);
|
|
188
158
|
if (e) return e;
|
|
189
159
|
}
|
|
190
160
|
const o = document.querySelectorAll("#app");
|
|
191
161
|
for (const e of Array.from(o)) {
|
|
192
162
|
const n = e;
|
|
193
|
-
if (
|
|
194
|
-
const r =
|
|
163
|
+
if (p(n)) continue;
|
|
164
|
+
const r = d(n, !0);
|
|
195
165
|
if (r) return r;
|
|
196
166
|
}
|
|
197
167
|
return null;
|
|
198
168
|
}
|
|
199
|
-
function
|
|
169
|
+
function V() {
|
|
200
170
|
if (typeof document > "u") return null;
|
|
201
|
-
|
|
202
|
-
const t = window.__MICRO_APP_ENVIRONMENT__ ?
|
|
203
|
-
return !t || !
|
|
171
|
+
M();
|
|
172
|
+
const t = window.__MICRO_APP_ENVIRONMENT__ ? R() : $();
|
|
173
|
+
return !t || !x(t) ? null : (N(t), t);
|
|
204
174
|
}
|
|
205
175
|
export {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
S as suspendOverlayByUid,
|
|
218
|
-
k as unlockModalMountScroll,
|
|
219
|
-
z as watchOverlayThenSuspend
|
|
176
|
+
E as MODAL_OVERLAY_CLASS,
|
|
177
|
+
a as MODAL_OVERLAY_CONTAINED_CLASS,
|
|
178
|
+
w as applyContainedOverlayInline,
|
|
179
|
+
M as ensureContainedOverlayStyle,
|
|
180
|
+
H as findTopOpenModalOverlayHost,
|
|
181
|
+
I as getOpenModalOverlays,
|
|
182
|
+
h as readOverlayZIndex,
|
|
183
|
+
V as resolveModalTarget,
|
|
184
|
+
D as resumeOverlayByUid,
|
|
185
|
+
g as suspendOverlayByUid,
|
|
186
|
+
B as watchOverlayThenSuspend
|
|
220
187
|
};
|