@dazhicheng/ui 1.6.38 → 1.6.40
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/assets/svg/download.svg.js +1 -1
- package/dist/components/tt-area/TtArea.vue.js +1 -1
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
- package/dist/components/tt-icon/index.vue.js +2 -2
- package/dist/components/tt-loading/src/loading.vue.js +2 -2
- package/dist/components/tt-modal/src/RenderModal.vue.js +258 -231
- package/dist/components/tt-modal/src/utils/modal-z-index.d.ts +7 -0
- package/dist/components/tt-modal/src/utils/modal-z-index.js +16 -14
- package/dist/components/tt-modal/src/utils/resolve-modal-target.d.ts +13 -0
- package/dist/components/tt-modal/src/utils/resolve-modal-target.js +106 -73
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +208 -181
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -3,6 +3,13 @@ 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;
|
|
6
13
|
/**
|
|
7
14
|
* 申请一个高于当前所有已打开弹窗的层级。
|
|
8
15
|
*
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import { getOpenModalOverlays as
|
|
2
|
-
const
|
|
3
|
-
let
|
|
4
|
-
function
|
|
5
|
-
return
|
|
1
|
+
import { getOpenModalOverlays as l, readOverlayZIndex as c } from "./resolve-modal-target.js";
|
|
2
|
+
const o = 1, r = 2e3;
|
|
3
|
+
let t = 0;
|
|
4
|
+
function M() {
|
|
5
|
+
return l().reduce((n, e) => Math.max(n, c(e)), 0);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
function s(n, e) {
|
|
8
|
+
t = Math.max(t, e);
|
|
9
|
+
const { currentZIndex: x, nextZIndex: d } = n;
|
|
10
|
+
let a = 0;
|
|
11
|
+
for (; x.value <= e && a < r; )
|
|
12
|
+
d(), a += 1;
|
|
12
13
|
}
|
|
13
14
|
function u(n) {
|
|
14
15
|
const e = Math.max(
|
|
15
16
|
n.nextZIndex(),
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
M() + o,
|
|
18
|
+
t + o
|
|
18
19
|
);
|
|
19
|
-
return
|
|
20
|
+
return t = e, s(n, e), e;
|
|
20
21
|
}
|
|
21
22
|
export {
|
|
22
23
|
u as allocateModalZIndex,
|
|
23
|
-
|
|
24
|
+
M as getOpenModalMaxZIndex,
|
|
25
|
+
s as syncElementPlusZIndexAbove
|
|
24
26
|
};
|
|
@@ -5,6 +5,19 @@ 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;
|
|
8
21
|
/** KeepAlive / 切页:隐藏已 Teleport 出去的遮罩,避免挡其它页。找到并隐藏则 true */
|
|
9
22
|
export declare function suspendOverlayByUid(uid: string | number, doc?: Document): boolean;
|
|
10
23
|
/**
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { getClientDocument as
|
|
2
|
-
import { getOpenModalUids as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
import { getClientDocument as b, isSameMicroAppScope as M, resolveScanDocument as _ } from "./modal-scope.js";
|
|
2
|
+
import { getOpenModalUids as E } from "./modal-stack.js";
|
|
3
|
+
const w = 48, y = 8, c = "tt-modal-overlay--contained", A = "tt-modal-overlay", v = "tt-modal-overlay-contained-style-v2";
|
|
4
|
+
function I(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.${c},
|
|
9
|
+
.el-overlay.${c} .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.${c} .el-overlay-dialog {
|
|
15
15
|
overflow: auto !important;
|
|
16
16
|
}
|
|
17
|
-
.el-overlay.${
|
|
17
|
+
.el-overlay.${c} .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,164 +24,197 @@ function M(t = document) {
|
|
|
24
24
|
flex-direction: column !important;
|
|
25
25
|
overflow: hidden !important;
|
|
26
26
|
}
|
|
27
|
-
.el-overlay.${
|
|
28
|
-
.el-overlay.${
|
|
27
|
+
.el-overlay.${c} .tt-ui-modal.el-dialog .el-dialog__header,
|
|
28
|
+
.el-overlay.${c} .tt-ui-modal.el-dialog .el-dialog__footer {
|
|
29
29
|
flex-shrink: 0;
|
|
30
30
|
}
|
|
31
|
-
.el-overlay.${
|
|
31
|
+
.el-overlay.${c} .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.${c} .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(v);
|
|
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 = v, e.textContent = o;
|
|
51
51
|
const n = t.head || t.documentElement;
|
|
52
52
|
n == null || n.appendChild(e);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function g(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 h(t) {
|
|
58
58
|
["position", "top", "right", "bottom", "left", "height"].forEach((o) => t.style.removeProperty(o));
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function P(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
|
-
|
|
64
|
+
if (!e.classList.contains(c) && !r) {
|
|
65
|
+
h(e), n && h(n);
|
|
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);
|
|
66
96
|
return;
|
|
67
97
|
}
|
|
68
|
-
|
|
98
|
+
t.setAttribute(d, String(o - 1));
|
|
69
99
|
}
|
|
70
|
-
function
|
|
100
|
+
function S(t, o = document) {
|
|
71
101
|
const e = o.querySelector(`.el-overlay.tt-id-${t}`);
|
|
72
102
|
return e ? (e.dataset.ttModalSuspended = "1", e.style.setProperty("display", "none", "important"), !0) : !1;
|
|
73
103
|
}
|
|
74
|
-
function
|
|
75
|
-
if (
|
|
104
|
+
function z(t, o = document, e = 3e3) {
|
|
105
|
+
if (S(t, o)) return () => {
|
|
76
106
|
};
|
|
77
107
|
const n = o.body || o.documentElement;
|
|
78
108
|
if (!n) return () => {
|
|
79
109
|
};
|
|
80
110
|
let r = !1;
|
|
81
111
|
const i = () => {
|
|
82
|
-
r || (r = !0, s.disconnect(), clearTimeout(
|
|
112
|
+
r || (r = !0, s.disconnect(), clearTimeout(l));
|
|
83
113
|
}, s = new MutationObserver(() => {
|
|
84
|
-
|
|
114
|
+
S(t, o) && i();
|
|
85
115
|
});
|
|
86
116
|
s.observe(n, { childList: !0, subtree: !0 });
|
|
87
|
-
const
|
|
117
|
+
const l = window.setTimeout(i, e);
|
|
88
118
|
return i;
|
|
89
119
|
}
|
|
90
|
-
function
|
|
120
|
+
function V(t, o = document) {
|
|
91
121
|
const e = o.querySelector(`.el-overlay.tt-id-${t}`);
|
|
92
|
-
!e || e.dataset.ttModalSuspended !== "1" || (delete e.dataset.ttModalSuspended, e.style.removeProperty("display"),
|
|
122
|
+
!e || e.dataset.ttModalSuspended !== "1" || (delete e.dataset.ttModalSuspended, e.style.removeProperty("display"), P(t, o), O(t, o));
|
|
93
123
|
}
|
|
94
|
-
function
|
|
124
|
+
function m(t) {
|
|
95
125
|
const o = t.style.zIndex || getComputedStyle(t).zIndex, e = Number.parseInt(o, 10);
|
|
96
126
|
return Number.isNaN(e) ? 0 : e;
|
|
97
127
|
}
|
|
98
|
-
function
|
|
99
|
-
const o = t ??
|
|
100
|
-
return o ? Array.from(
|
|
128
|
+
function N(t) {
|
|
129
|
+
const o = t ?? b();
|
|
130
|
+
return o ? Array.from(_(o).querySelectorAll(`.${A}`)).filter(
|
|
101
131
|
(e) => e.isConnected && e.dataset.ttModalSuspended !== "1" && e.style.display !== "none"
|
|
102
132
|
) : [];
|
|
103
133
|
}
|
|
104
|
-
function
|
|
105
|
-
const n =
|
|
134
|
+
function Y(t, o, e) {
|
|
135
|
+
const n = b(), r = o ?? (n == null ? void 0 : n.body);
|
|
106
136
|
if (!n || !r) return null;
|
|
107
|
-
const i =
|
|
108
|
-
if (t != null &&
|
|
109
|
-
const u =
|
|
110
|
-
return !!u &&
|
|
137
|
+
const i = E().map((a) => `tt-id-${a}`), s = N(n).filter((a) => {
|
|
138
|
+
if (t != null && a.classList.contains(`tt-id-${t}`) || !i.some((C) => a.classList.contains(C))) return !1;
|
|
139
|
+
const u = a.parentElement;
|
|
140
|
+
return !!u && M(u, r);
|
|
111
141
|
});
|
|
112
|
-
return s.length === 0 ? null : s.reduce((
|
|
142
|
+
return s.length === 0 ? null : s.reduce((a, u) => m(u) >= m(a) ? u : a).parentElement;
|
|
113
143
|
}
|
|
114
|
-
function
|
|
144
|
+
function x(t) {
|
|
115
145
|
return t.isConnected ? t.getClientRects().length > 0 : !1;
|
|
116
146
|
}
|
|
117
147
|
function T(t) {
|
|
118
|
-
return t.isConnected ? (t.clientHeight || t.getBoundingClientRect().height) >=
|
|
148
|
+
return t.isConnected ? (t.clientHeight || t.getBoundingClientRect().height) >= w : !1;
|
|
119
149
|
}
|
|
120
|
-
function
|
|
150
|
+
function L(t) {
|
|
121
151
|
const o = window.innerHeight || document.documentElement.clientHeight || 0;
|
|
122
152
|
if (o === 0) return !0;
|
|
123
153
|
const e = t.getBoundingClientRect();
|
|
124
|
-
return e.height > o +
|
|
154
|
+
return e.height > o + y ? !1 : e.top >= -y;
|
|
125
155
|
}
|
|
126
|
-
function
|
|
156
|
+
function f(t) {
|
|
127
157
|
return !!t.closest("micro-app-body");
|
|
128
158
|
}
|
|
129
|
-
function
|
|
130
|
-
return !t || !t.isConnected || o && !T(t) || o && !
|
|
159
|
+
function p(t, o = !0) {
|
|
160
|
+
return !t || !t.isConnected || o && !T(t) || o && !x(t) ? null : t;
|
|
131
161
|
}
|
|
132
|
-
function
|
|
162
|
+
function R(t) {
|
|
133
163
|
getComputedStyle(t).position === "static" && (t.style.position = "relative");
|
|
134
164
|
}
|
|
135
|
-
function
|
|
165
|
+
function $() {
|
|
136
166
|
const t = window.__MICRO_APP_NAME__;
|
|
137
167
|
if (t) {
|
|
138
|
-
const i = typeof CSS < "u" && CSS.escape ? CSS.escape(t) : t, s = document.querySelector(`micro-app[name="${i}"] micro-app-body #app`),
|
|
139
|
-
if (
|
|
168
|
+
const i = typeof CSS < "u" && CSS.escape ? CSS.escape(t) : t, s = document.querySelector(`micro-app[name="${i}"] micro-app-body #app`), l = p(s, !1);
|
|
169
|
+
if (l) return l;
|
|
140
170
|
}
|
|
141
171
|
const o = document.querySelector("#app");
|
|
142
172
|
if (o) {
|
|
143
|
-
const i =
|
|
173
|
+
const i = p(o, !1);
|
|
144
174
|
return i || o;
|
|
145
175
|
}
|
|
146
176
|
const e = document.querySelector("micro-app-body #app");
|
|
147
177
|
if (e) {
|
|
148
|
-
const i =
|
|
178
|
+
const i = p(e, !1);
|
|
149
179
|
if (i) return i;
|
|
150
180
|
}
|
|
151
181
|
const n = document.body;
|
|
152
|
-
return n && (n.tagName === "MICRO-APP-BODY" ||
|
|
182
|
+
return n && (n.tagName === "MICRO-APP-BODY" || f(n)) ? n : document.querySelector("micro-app-body");
|
|
153
183
|
}
|
|
154
|
-
function
|
|
184
|
+
function q() {
|
|
155
185
|
const t = document.querySelector("#app-content");
|
|
156
|
-
if (t && !
|
|
157
|
-
const e =
|
|
186
|
+
if (t && !f(t)) {
|
|
187
|
+
const e = p(t, !0);
|
|
158
188
|
if (e) return e;
|
|
159
189
|
}
|
|
160
190
|
const o = document.querySelectorAll("#app");
|
|
161
191
|
for (const e of Array.from(o)) {
|
|
162
192
|
const n = e;
|
|
163
|
-
if (
|
|
164
|
-
const r =
|
|
193
|
+
if (f(n)) continue;
|
|
194
|
+
const r = p(n, !0);
|
|
165
195
|
if (r) return r;
|
|
166
196
|
}
|
|
167
197
|
return null;
|
|
168
198
|
}
|
|
169
|
-
function
|
|
199
|
+
function G() {
|
|
170
200
|
if (typeof document > "u") return null;
|
|
171
|
-
|
|
172
|
-
const t = window.__MICRO_APP_ENVIRONMENT__ ?
|
|
173
|
-
return !t || !
|
|
201
|
+
I();
|
|
202
|
+
const t = window.__MICRO_APP_ENVIRONMENT__ ? $() : q();
|
|
203
|
+
return !t || !L(t) ? null : (R(t), t);
|
|
174
204
|
}
|
|
175
205
|
export {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
206
|
+
A as MODAL_OVERLAY_CLASS,
|
|
207
|
+
c as MODAL_OVERLAY_CONTAINED_CLASS,
|
|
208
|
+
P as applyContainedOverlayInline,
|
|
209
|
+
I as ensureContainedOverlayStyle,
|
|
210
|
+
O as ensureOverlayHitTarget,
|
|
211
|
+
Y as findTopOpenModalOverlayHost,
|
|
212
|
+
N as getOpenModalOverlays,
|
|
213
|
+
D as lockModalMountScroll,
|
|
214
|
+
m as readOverlayZIndex,
|
|
215
|
+
G as resolveModalTarget,
|
|
216
|
+
V as resumeOverlayByUid,
|
|
217
|
+
S as suspendOverlayByUid,
|
|
218
|
+
k as unlockModalMountScroll,
|
|
219
|
+
z as watchOverlayThenSuspend
|
|
187
220
|
};
|