@dazhicheng/ui 1.6.20 → 1.6.22

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 (29) hide show
  1. package/dist/components/tt-modal/index.d.ts +1 -0
  2. package/dist/components/tt-modal/index.js +8 -3
  3. package/dist/components/tt-modal/src/RenderModal.vue.js +224 -210
  4. package/dist/components/tt-modal/src/hooks/useModalRender.js +66 -67
  5. package/dist/components/tt-modal/src/index.js +9 -7
  6. package/dist/components/tt-modal/src/utils/modal-api.d.ts +9 -3
  7. package/dist/components/tt-modal/src/utils/modal-api.js +42 -36
  8. package/dist/components/tt-modal/src/utils/modal-close-transition.d.ts +13 -0
  9. package/dist/components/tt-modal/src/utils/modal-close-transition.js +13 -0
  10. package/dist/components/tt-modal/src/utils/modal-host-app.d.ts +5 -0
  11. package/dist/components/tt-modal/src/utils/modal-host-app.js +12 -0
  12. package/dist/components/tt-modal/src/utils/modal-scope.d.ts +21 -0
  13. package/dist/components/tt-modal/src/utils/modal-scope.js +20 -0
  14. package/dist/components/tt-modal/src/utils/modal-service.d.ts +23 -0
  15. package/dist/components/tt-modal/src/utils/modal-service.js +51 -0
  16. package/dist/components/tt-modal/src/utils/modal-stack.d.ts +14 -13
  17. package/dist/components/tt-modal/src/utils/modal-stack.js +20 -9
  18. package/dist/components/tt-modal/src/utils/modal-z-index.d.ts +15 -0
  19. package/dist/components/tt-modal/src/utils/modal-z-index.js +24 -0
  20. package/dist/components/tt-modal/src/utils/resolve-modal-target.d.ts +14 -0
  21. package/dist/components/tt-modal/src/utils/resolve-modal-target.js +83 -47
  22. package/dist/components/tt-upload/index.d.ts +15 -0
  23. package/dist/components/tt-upload/src/TtUpload.vue.d.ts +9 -0
  24. package/dist/components/tt-upload/src/TtUpload.vue.js +22 -22
  25. package/dist/components/tt-upload/src/typing.d.ts +10 -0
  26. package/dist/components/tt-upload/src/typing.js +10 -0
  27. package/dist/index.js +132 -127
  28. package/dist/style.css +1 -1
  29. package/package.json +1 -1
@@ -1,28 +1,39 @@
1
+ import { getModalScopeKey as i } from "./modal-scope.js";
1
2
  const n = [];
3
+ function a() {
4
+ const e = i();
5
+ return n.filter((t) => t.scope === e).map((t) => t.uid);
6
+ }
2
7
  let r = !1;
3
- function u(e) {
8
+ function s(e) {
4
9
  if (!e || !(e instanceof HTMLElement)) return !1;
5
10
  const t = e.tagName;
6
11
  return !!(t === "INPUT" || t === "TEXTAREA" || t === "SELECT" || e.isContentEditable || e.closest(
7
12
  ".el-select, .el-select-v2, .el-cascader, .el-date-editor, .el-time-picker, .el-color-picker, .el-input, .el-textarea, .el-autocomplete, .el-input-number, .el-mention"
8
13
  ));
9
14
  }
10
- function i(e) {
15
+ function c(e) {
11
16
  if (e.key !== "Escape" && e.key !== "Esc" || n.length === 0) return;
12
17
  const t = e.target ?? document.activeElement;
13
- if (u(t))
18
+ if (s(t))
14
19
  return;
15
20
  const o = n[n.length - 1];
16
21
  o && (e.stopPropagation(), o.close());
17
22
  }
18
- function l(e) {
19
- c(e.uid), n.push(e), !r && typeof document < "u" && (document.addEventListener("keydown", i), r = !0);
23
+ function d(e) {
24
+ l(e.uid), n.push({ ...e, scope: i() }), !r && typeof document < "u" && (document.addEventListener("keydown", c), r = !0);
20
25
  }
21
- function c(e) {
26
+ function f() {
27
+ const e = i();
28
+ n.filter((t) => t.scope === e).reverse().forEach((t) => t.close());
29
+ }
30
+ function l(e) {
22
31
  const t = n.findIndex((o) => o.uid === e);
23
- t !== -1 && n.splice(t, 1), n.length === 0 && r && typeof document < "u" && (document.removeEventListener("keydown", i), r = !1);
32
+ t !== -1 && n.splice(t, 1), n.length === 0 && r && typeof document < "u" && (document.removeEventListener("keydown", c), r = !1);
24
33
  }
25
34
  export {
26
- l as pushModal,
27
- c as removeModal
35
+ f as closeAllModals,
36
+ a as getOpenModalUids,
37
+ d as pushModal,
38
+ l as removeModal
28
39
  };
@@ -0,0 +1,15 @@
1
+ import { useZIndex } from 'element-plus';
2
+ /** element-plus 层级计数器句柄,必须由组件在 setup 里取才能继承 ElConfigProvider 的基准 */
3
+ export type ElementPlusZIndex = ReturnType<typeof useZIndex>;
4
+ /** 当前已打开弹窗里的最高层级 */
5
+ export declare function getOpenModalMaxZIndex(): number;
6
+ /**
7
+ * 申请一个高于当前所有已打开弹窗的层级。
8
+ *
9
+ * 起点取 element-plus 的 nextZIndex,保证 ElConfigProvider 配的基准仍生效;
10
+ * 但它是模块级计数器,微前端下多份 element-plus 各自起算会让后开的拿到更小的值,
11
+ * 所以再用页面上已打开遮罩的实际层级兜一层。
12
+ * @param elementPlusZIndex 计数器句柄
13
+ * @returns 本次弹窗应使用的 z-index
14
+ */
15
+ export declare function allocateModalZIndex(elementPlusZIndex: ElementPlusZIndex): number;
@@ -0,0 +1,24 @@
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
+ }
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;
12
+ }
13
+ function u(n) {
14
+ const e = Math.max(
15
+ n.nextZIndex(),
16
+ s() + a,
17
+ o + a
18
+ );
19
+ return o = e, I(n, e), e;
20
+ }
21
+ export {
22
+ u as allocateModalZIndex,
23
+ s as getOpenModalMaxZIndex
24
+ };
@@ -1,4 +1,6 @@
1
1
  export declare const MODAL_OVERLAY_CONTAINED_CLASS = "tt-modal-overlay--contained";
2
+ /** 遮罩的稳定标记类。modal 为 false 时 element-plus 不输出 el-overlay,故不能用它定位 */
3
+ export declare const MODAL_OVERLAY_CLASS = "tt-modal-overlay";
2
4
  /** 注入全局样式,避免仅依赖 Vue SFC / scopecss 导致 absolute 未生效 */
3
5
  export declare function ensureContainedOverlayStyle(doc?: Document): void;
4
6
  /** 用内联样式强制区域遮罩,压过 EP 的 position:fixed(含内部 overlay-dialog) */
@@ -12,6 +14,18 @@ export declare function suspendOverlayByUid(uid: string | number, doc?: Document
12
14
  export declare function watchOverlayThenSuspend(uid: string | number, doc?: Document, timeoutMs?: number): () => void;
13
15
  /** KeepAlive / 切回:恢复未关闭的弹窗遮罩 */
14
16
  export declare function resumeOverlayByUid(uid: string | number, doc?: Document): void;
17
+ /** 读取遮罩的层级数值,auto / 空值按 0 计 */
18
+ export declare function readOverlayZIndex(el: HTMLElement): number;
19
+ /** 页面上仍显示着的弹窗遮罩,切页挂起的不算;扫真实 document 以覆盖其它子应用 */
20
+ export declare function getOpenModalOverlays(doc?: Document): HTMLElement[];
21
+ /**
22
+ * 已打开弹窗中层级最高的那个遮罩所在的容器。
23
+ * 后开的弹窗挂到同一容器层级才可比——不同容器可能分属不同 stacking context。
24
+ * @param excludeUid 排除自身的组件 uid
25
+ * @param ownTarget 自身挂载目标,用于限制在同一子应用内
26
+ * @param doc 起点 document
27
+ */
28
+ export declare function findTopOpenModalOverlayHost(excludeUid?: number, ownTarget?: HTMLElement | null, doc?: Document): HTMLElement | null;
15
29
  /**
16
30
  * 解析弹窗 Teleport 目标。无可用节点时返回 null,由调用方回退 body。
17
31
  * 子应用只要处在 micro 环境,尽量返回内容区节点(含 micro-app-body),以便加 contained class。
@@ -1,5 +1,7 @@
1
- const a = "tt-modal-overlay--contained", u = "tt-modal-overlay-contained-style-v2";
2
- function y(t = document) {
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) {
3
5
  var r;
4
6
  if (typeof t > "u") return;
5
7
  const o = `
@@ -40,112 +42,146 @@ function y(t = document) {
40
42
  overflow: auto !important;
41
43
  }
42
44
  `.trim();
43
- let e = t.getElementById(u);
45
+ let e = t.getElementById(y);
44
46
  if (e) {
45
47
  e.textContent = o;
46
48
  return;
47
49
  }
48
- (r = t.getElementById("tt-modal-overlay-contained-style")) == null || r.remove(), e = t.createElement("style"), e.id = u, e.textContent = o;
50
+ (r = t.getElementById("tt-modal-overlay-contained-style")) == null || r.remove(), e = t.createElement("style"), e.id = y, e.textContent = o;
49
51
  const n = t.head || t.documentElement;
50
52
  n == null || n.appendChild(e);
51
53
  }
52
- function p(t) {
54
+ function f(t) {
53
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");
54
56
  }
55
- function f(t, o = document) {
57
+ function v(t) {
58
+ ["position", "top", "right", "bottom", "left", "height"].forEach((o) => t.style.removeProperty(o));
59
+ }
60
+ function w(t, o = document) {
56
61
  const e = o.querySelector(`.el-overlay.tt-id-${t}`);
57
62
  if (!e) return;
58
- const n = !!e.closest("micro-app-body");
59
- if (!e.classList.contains(a) && !n) return;
60
- p(e);
61
- const r = e.querySelector(".el-overlay-dialog");
62
- r && p(r);
63
+ const n = e.querySelector(".el-overlay-dialog"), r = !!e.closest("micro-app-body");
64
+ if (!e.classList.contains(a) && !r) {
65
+ v(e), n && v(n);
66
+ return;
67
+ }
68
+ f(e), n && f(n);
63
69
  }
64
- function m(t, o = document) {
70
+ function g(t, o = document) {
65
71
  const e = o.querySelector(`.el-overlay.tt-id-${t}`);
66
72
  return e ? (e.dataset.ttModalSuspended = "1", e.style.setProperty("display", "none", "important"), !0) : !1;
67
73
  }
68
- function b(t, o = document, e = 3e3) {
69
- if (m(t, o)) return () => {
74
+ function B(t, o = document, e = 3e3) {
75
+ if (g(t, o)) return () => {
70
76
  };
71
77
  const n = o.body || o.documentElement;
72
78
  if (!n) return () => {
73
79
  };
74
80
  let r = !1;
75
81
  const i = () => {
76
- r || (r = !0, s.disconnect(), clearTimeout(d));
82
+ r || (r = !0, s.disconnect(), clearTimeout(c));
77
83
  }, s = new MutationObserver(() => {
78
- m(t, o) && i();
84
+ g(t, o) && i();
79
85
  });
80
86
  s.observe(n, { childList: !0, subtree: !0 });
81
- const d = window.setTimeout(i, e);
87
+ const c = window.setTimeout(i, e);
82
88
  return i;
83
89
  }
84
- function C(t, o = document) {
90
+ function D(t, o = document) {
85
91
  const e = o.querySelector(`.el-overlay.tt-id-${t}`);
86
- !e || e.dataset.ttModalSuspended !== "1" || (delete e.dataset.ttModalSuspended, e.style.removeProperty("display"), f(t, o));
92
+ !e || e.dataset.ttModalSuspended !== "1" || (delete e.dataset.ttModalSuspended, e.style.removeProperty("display"), w(t, o));
87
93
  }
88
- function v(t) {
94
+ function h(t) {
95
+ const o = t.style.zIndex || getComputedStyle(t).zIndex, e = Number.parseInt(o, 10);
96
+ return Number.isNaN(e) ? 0 : e;
97
+ }
98
+ function I(t) {
99
+ const o = t ?? S();
100
+ return o ? Array.from(C(o).querySelectorAll(`.${E}`)).filter(
101
+ (e) => e.isConnected && e.dataset.ttModalSuspended !== "1" && e.style.display !== "none"
102
+ ) : [];
103
+ }
104
+ function H(t, o, e) {
105
+ const n = S(), r = o ?? (n == null ? void 0 : n.body);
106
+ if (!n || !r) return null;
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);
111
+ });
112
+ return s.length === 0 ? null : s.reduce((l, u) => h(u) >= h(l) ? u : l).parentElement;
113
+ }
114
+ function P(t) {
89
115
  return t.isConnected ? t.getClientRects().length > 0 : !1;
90
116
  }
91
- function g(t) {
92
- return t.isConnected ? (t.clientHeight || t.getBoundingClientRect().height) >= 48 : !1;
117
+ function T(t) {
118
+ return t.isConnected ? (t.clientHeight || t.getBoundingClientRect().height) >= A : !1;
93
119
  }
94
- function c(t) {
120
+ function x(t) {
121
+ const o = window.innerHeight || document.documentElement.clientHeight || 0;
122
+ if (o === 0) return !0;
123
+ const e = t.getBoundingClientRect();
124
+ return e.height > o + m ? !1 : e.top >= -m;
125
+ }
126
+ function p(t) {
95
127
  return !!t.closest("micro-app-body");
96
128
  }
97
- function l(t, o = !0) {
98
- return !t || !t.isConnected || o && !g(t) || o && !v(t) ? null : t;
129
+ function d(t, o = !0) {
130
+ return !t || !t.isConnected || o && !T(t) || o && !P(t) ? null : t;
99
131
  }
100
- function h(t) {
132
+ function N(t) {
101
133
  getComputedStyle(t).position === "static" && (t.style.position = "relative");
102
134
  }
103
- function _() {
135
+ function R() {
104
136
  const t = window.__MICRO_APP_NAME__;
105
137
  if (t) {
106
- const i = typeof CSS < "u" && CSS.escape ? CSS.escape(t) : t, s = document.querySelector(`micro-app[name="${i}"] micro-app-body #app`), d = l(s, !1);
107
- if (d) return d;
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;
108
140
  }
109
141
  const o = document.querySelector("#app");
110
142
  if (o) {
111
- const i = l(o, !1);
143
+ const i = d(o, !1);
112
144
  return i || o;
113
145
  }
114
146
  const e = document.querySelector("micro-app-body #app");
115
147
  if (e) {
116
- const i = l(e, !1);
148
+ const i = d(e, !1);
117
149
  if (i) return i;
118
150
  }
119
151
  const n = document.body;
120
- return n && (n.tagName === "MICRO-APP-BODY" || c(n)) ? n : document.querySelector("micro-app-body");
152
+ return n && (n.tagName === "MICRO-APP-BODY" || p(n)) ? n : document.querySelector("micro-app-body");
121
153
  }
122
- function S() {
154
+ function $() {
123
155
  const t = document.querySelector("#app-content");
124
- if (t && !c(t)) {
125
- const e = l(t, !0);
156
+ if (t && !p(t)) {
157
+ const e = d(t, !0);
126
158
  if (e) return e;
127
159
  }
128
160
  const o = document.querySelectorAll("#app");
129
161
  for (const e of Array.from(o)) {
130
162
  const n = e;
131
- if (c(n)) continue;
132
- const r = l(n, !0);
163
+ if (p(n)) continue;
164
+ const r = d(n, !0);
133
165
  if (r) return r;
134
166
  }
135
167
  return null;
136
168
  }
137
- function A() {
169
+ function V() {
138
170
  if (typeof document > "u") return null;
139
- y();
140
- const t = window.__MICRO_APP_ENVIRONMENT__ ? _() : S();
141
- return t && h(t), t;
171
+ M();
172
+ const t = window.__MICRO_APP_ENVIRONMENT__ ? R() : $();
173
+ return !t || !x(t) ? null : (N(t), t);
142
174
  }
143
175
  export {
176
+ E as MODAL_OVERLAY_CLASS,
144
177
  a as MODAL_OVERLAY_CONTAINED_CLASS,
145
- f as applyContainedOverlayInline,
146
- y as ensureContainedOverlayStyle,
147
- A as resolveModalTarget,
148
- C as resumeOverlayByUid,
149
- m as suspendOverlayByUid,
150
- b as watchOverlayThenSuspend
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
151
187
  };
@@ -55,6 +55,10 @@ export declare const TtUpload: import('../../../../utils/src').SFCWithInstall<{
55
55
  readonly type: import('vue').PropType<boolean>;
56
56
  readonly default: true;
57
57
  };
58
+ showUploadArea: {
59
+ readonly type: import('vue').PropType<boolean>;
60
+ readonly default: true;
61
+ };
58
62
  showTemplateDownload: {
59
63
  readonly type: import('vue').PropType<boolean>;
60
64
  readonly default: false;
@@ -241,6 +245,7 @@ export declare const TtUpload: import('../../../../utils/src').SFCWithInstall<{
241
245
  uploadTip: string;
242
246
  maxSize: number;
243
247
  showFileList: boolean;
248
+ showUploadArea: boolean;
244
249
  showTemplateDownload: boolean;
245
250
  templateText: string;
246
251
  showDownload: boolean;
@@ -322,6 +327,10 @@ export declare const TtUpload: import('../../../../utils/src').SFCWithInstall<{
322
327
  readonly type: import('vue').PropType<boolean>;
323
328
  readonly default: true;
324
329
  };
330
+ showUploadArea: {
331
+ readonly type: import('vue').PropType<boolean>;
332
+ readonly default: true;
333
+ };
325
334
  showTemplateDownload: {
326
335
  readonly type: import('vue').PropType<boolean>;
327
336
  readonly default: false;
@@ -498,6 +507,7 @@ export declare const TtUpload: import('../../../../utils/src').SFCWithInstall<{
498
507
  uploadTip: string;
499
508
  maxSize: number;
500
509
  showFileList: boolean;
510
+ showUploadArea: boolean;
501
511
  showTemplateDownload: boolean;
502
512
  templateText: string;
503
513
  showDownload: boolean;
@@ -576,6 +586,10 @@ export declare const TtUpload: import('../../../../utils/src').SFCWithInstall<{
576
586
  readonly type: import('vue').PropType<boolean>;
577
587
  readonly default: true;
578
588
  };
589
+ showUploadArea: {
590
+ readonly type: import('vue').PropType<boolean>;
591
+ readonly default: true;
592
+ };
579
593
  showTemplateDownload: {
580
594
  readonly type: import('vue').PropType<boolean>;
581
595
  readonly default: false;
@@ -762,6 +776,7 @@ export declare const TtUpload: import('../../../../utils/src').SFCWithInstall<{
762
776
  uploadTip: string;
763
777
  maxSize: number;
764
778
  showFileList: boolean;
779
+ showUploadArea: boolean;
765
780
  showTemplateDownload: boolean;
766
781
  templateText: string;
767
782
  showDownload: boolean;
@@ -96,6 +96,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
96
96
  readonly type: import('vue').PropType<boolean>;
97
97
  readonly default: true;
98
98
  };
99
+ showUploadArea: {
100
+ readonly type: import('vue').PropType<boolean>;
101
+ readonly default: true;
102
+ };
99
103
  showTemplateDownload: {
100
104
  readonly type: import('vue').PropType<boolean>;
101
105
  readonly default: false;
@@ -307,6 +311,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
307
311
  readonly type: import('vue').PropType<boolean>;
308
312
  readonly default: true;
309
313
  };
314
+ showUploadArea: {
315
+ readonly type: import('vue').PropType<boolean>;
316
+ readonly default: true;
317
+ };
310
318
  showTemplateDownload: {
311
319
  readonly type: import('vue').PropType<boolean>;
312
320
  readonly default: false;
@@ -478,6 +486,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
478
486
  uploadTip: string;
479
487
  maxSize: number;
480
488
  showFileList: boolean;
489
+ showUploadArea: boolean;
481
490
  showTemplateDownload: boolean;
482
491
  templateText: string;
483
492
  showDownload: boolean;
@@ -1,6 +1,6 @@
1
- import { defineComponent as de, mergeModels as z, useModel as ce, useSlots as pe, ref as b, computed as m, createBlock as fe, openBlock as me, createVNode as a, mergeProps as we, createTextVNode as w } from "vue";
1
+ import { defineComponent as de, mergeModels as M, useModel as ce, useSlots as pe, ref as b, computed as m, createBlock as fe, openBlock as me, createVNode as a, mergeProps as we, createTextVNode as w } from "vue";
2
2
  import ve from "../../../assets/svg/exportSvg.svg.js";
3
- import A from "../../../assets/svg/fileSvg.svg.js";
3
+ import z from "../../../assets/svg/fileSvg.svg.js";
4
4
  import { TtButton as $ } from "../../tt-button/index.js";
5
5
  import { TtIcon as S } from "../../tt-icon/index.js";
6
6
  import "../../tt-modal/index.js";
@@ -8,7 +8,7 @@ import "../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_
8
8
  import { useDesign as ge } from "../../../packages/hooks/src/useDesign.js";
9
9
  import "axios";
10
10
  import { ElMessage as p, ElImageViewer as _e, ElUpload as he } from "element-plus";
11
- import { isString as ye, isNumber as Ue } from "../../../packages/utils/src/is.js";
11
+ import { isString as Ue, isNumber as ye } from "../../../packages/utils/src/is.js";
12
12
  import "dayjs";
13
13
  import "numeral";
14
14
  import "xe-utils";
@@ -29,18 +29,18 @@ import { useModalRender as Se } from "../../tt-modal/src/hooks/useModalRender.js
29
29
  const Ze = /* @__PURE__ */ de({
30
30
  name: "TtUpload",
31
31
  __name: "TtUpload",
32
- props: /* @__PURE__ */ z($e, {
32
+ props: /* @__PURE__ */ M($e, {
33
33
  modelValue: {
34
34
  default: () => []
35
35
  },
36
36
  modelModifiers: {}
37
37
  }),
38
- emits: /* @__PURE__ */ z(["afterUpload", "preview", "download", "delete", "templateDownload", "ok", "close", "error"], ["update:modelValue"]),
38
+ emits: /* @__PURE__ */ M(["afterUpload", "preview", "download", "delete", "templateDownload", "ok", "close", "error"], ["update:modelValue"]),
39
39
  setup(C, {
40
40
  expose: N,
41
41
  emit: P
42
42
  }) {
43
- const D = ["modal", "modelValue", "uploadOssApi", "uploadTip", "maxSize", "showFileList", "showTemplateDownload", "templateText", "showPreview", "showDownload", "showDelete", "gridThreshold", "gridColumns", "showCount", "uploadOssViewApi", "beforeUpload", "onError"], I = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "webp", "bmp", "svg"]);
43
+ const D = ["modal", "modelValue", "uploadOssApi", "uploadTip", "maxSize", "showFileList", "showUploadArea", "showTemplateDownload", "templateText", "showPreview", "showDownload", "showDelete", "gridThreshold", "gridColumns", "showCount", "uploadOssViewApi", "beforeUpload", "onError"], I = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "webp", "bmp", "svg"]);
44
44
  function B(e) {
45
45
  var t;
46
46
  const o = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
@@ -54,7 +54,7 @@ const Ze = /* @__PURE__ */ de({
54
54
  }
55
55
  const i = C, c = P, s = ce(C, "modelValue"), d = pe(), {
56
56
  prefixCls: n
57
- } = ge("upload"), x = b(), y = b(!1), k = b([]), [j, v] = Se({
57
+ } = ge("upload"), x = b(), U = b(!1), k = b([]), [j, v] = Se({
58
58
  onOk() {
59
59
  c("ok", s.value);
60
60
  },
@@ -67,13 +67,13 @@ const Ze = /* @__PURE__ */ de({
67
67
  }
68
68
  N({
69
69
  openModal: () => {
70
- s.value = [], v.openModal();
70
+ i.showUploadArea && (s.value = []), v.openModal();
71
71
  },
72
72
  setModalProps: v.setModalProps,
73
73
  closeModal: v.closeModal,
74
74
  getFileList: W
75
75
  });
76
- const U = m(() => s.value.length > i.gridThreshold), g = m(() => i.limit ?? 0), _ = m(() => i.uploadOssApi ?? F.uploadOssApi), G = m(() => i.uploadOssViewApi ?? F.uploadOssViewApi);
76
+ const y = m(() => s.value.length > i.gridThreshold), g = m(() => i.limit ?? 0), _ = m(() => i.uploadOssApi ?? F.uploadOssApi), G = m(() => i.uploadOssViewApi ?? F.uploadOssViewApi);
77
77
  async function q(e, o) {
78
78
  const l = `${i.ossDir || o.dir || "notice"}/${Date.now()}_${e.name}`, r = new FormData();
79
79
  r.append("key", l), r.append("policy", o.policy), r.append("x-oss-signature-version", o.version), r.append("x-oss-signature", o.signature), r.append("x-oss-credential", o.x_oss_credential), r.append("x-oss-date", o.x_oss_date), r.append("x-oss-security-token", o.security_token), o.callback && r.append("callback", o.callback), r.append("success_action_status", "200"), r.append("file", e);
@@ -146,7 +146,7 @@ const Ze = /* @__PURE__ */ de({
146
146
  function Q(e) {
147
147
  if (!K(e.name, e.type, i.accept))
148
148
  return p.warning(`文件格式不支持,仅支持:${i.accept}`), !1;
149
- const o = s.value.map((t) => ye(t.fileSize) || Ue(t.fileSize) ? +t.fileSize : 0).reduce((t, l) => t + l, 0);
149
+ const o = s.value.map((t) => Ue(t.fileSize) || ye(t.fileSize) ? +t.fileSize : 0).reduce((t, l) => t + l, 0);
150
150
  return i.maxSize && (e.size + o) / 1024 / 1024 > i.maxSize ? (p.warning(`文件大小不能超过 ${i.maxSize}MB`), !1) : g.value > 0 && s.value.length >= g.value ? (p.warning("已超过上传数量"), !1) : R(i.beforeUpload) ? i.beforeUpload(e) : !0;
151
151
  }
152
152
  function Z() {
@@ -184,7 +184,7 @@ const Ze = /* @__PURE__ */ de({
184
184
  async function te(e) {
185
185
  c("preview", e);
186
186
  let o = await E(e);
187
- _.value || (o = URL.createObjectURL(e.file)), o && (B(e.fileName) ? (k.value = [o], y.value = !0) : window.open(o, "_blank"));
187
+ _.value || (o = URL.createObjectURL(e.file)), o && (B(e.fileName) ? (k.value = [o], U.value = !0) : window.open(o, "_blank"));
188
188
  }
189
189
  async function le(e) {
190
190
  let o = !1;
@@ -195,7 +195,7 @@ const Ze = /* @__PURE__ */ de({
195
195
  let t;
196
196
  _.value ? t = await E(e) : t = URL.createObjectURL(e.file), t && oe(t, e.fileName);
197
197
  }
198
- const ae = () => a("div", {
198
+ const ae = () => i.showUploadArea ? a("div", {
199
199
  class: `${n}-area`
200
200
  }, [a(he, we({
201
201
  ref: x
@@ -219,7 +219,7 @@ const Ze = /* @__PURE__ */ de({
219
219
  }
220
220
  }, [i.templateText])])];
221
221
  }
222
- })]), O = (e, o) => d.fileActions ? d.fileActions({
222
+ })]) : null, O = (e, o) => d.fileActions ? d.fileActions({
223
223
  file: e,
224
224
  index: o
225
225
  }) : a("div", {
@@ -250,7 +250,7 @@ const Ze = /* @__PURE__ */ de({
250
250
  }, [a("div", {
251
251
  class: `${n}-file__card-icon`
252
252
  }, [a(S, {
253
- icon: A,
253
+ icon: z,
254
254
  size: 28,
255
255
  isCustomSvg: !0
256
256
  }, null)]), a("div", {
@@ -267,7 +267,7 @@ const Ze = /* @__PURE__ */ de({
267
267
  }, [a("div", {
268
268
  class: `${n}-file__row-icon`
269
269
  }, [a(S, {
270
- icon: A,
270
+ icon: z,
271
271
  size: 28,
272
272
  isCustomSvg: !0
273
273
  }, null)]), a("div", {
@@ -281,9 +281,9 @@ const Ze = /* @__PURE__ */ de({
281
281
  }, [O(e, o)])]), ne = (e, o) => d.fileItem ? d.fileItem({
282
282
  file: e,
283
283
  index: o
284
- }) : U.value ? ie(e, o) : re(e, o), se = () => {
284
+ }) : y.value ? ie(e, o) : re(e, o), se = () => {
285
285
  if (!i.showFileList || s.value.length === 0) return null;
286
- const e = s.value.map((l, r) => ne(l, r)), o = U.value ? `${n}-filelist__grid` : `${n}-filelist__list`, t = U.value ? {
286
+ const e = s.value.map((l, r) => ne(l, r)), o = y.value ? `${n}-filelist__grid` : `${n}-filelist__list`, t = y.value ? {
287
287
  gridTemplateColumns: `repeat(${i.gridColumns}, 1fr)`
288
288
  } : void 0;
289
289
  return a("div", {
@@ -298,19 +298,19 @@ const Ze = /* @__PURE__ */ de({
298
298
  }, [s.value.length]), a("span", null, [w(" / ")]), a("span", {
299
299
  class: `${n}-filelist__count-total-number`
300
300
  }, [g.value])])]);
301
- }, M = () => {
301
+ }, A = () => {
302
302
  var e;
303
303
  return a("div", {
304
304
  class: n
305
- }, [ae(), se(), (e = d.footer) == null ? void 0 : e.call(d), y.value && a(_e, {
305
+ }, [ae(), se(), (e = d.footer) == null ? void 0 : e.call(d), U.value && a(_e, {
306
306
  urlList: k.value,
307
307
  hideOnClickModal: !0,
308
308
  teleported: !0,
309
- onClose: () => y.value = !1
309
+ onClose: () => U.value = !1
310
310
  }, null)]);
311
311
  }, ue = () => i.modal ? a(j, null, {
312
- default: () => M()
313
- }) : M();
312
+ default: () => A()
313
+ }) : A();
314
314
  return (e, o) => (me(), fe(ue));
315
315
  }
316
316
  });
@@ -106,6 +106,16 @@ export declare const ttUploadProps: {
106
106
  readonly type: PropType<boolean>;
107
107
  readonly default: true;
108
108
  };
109
+ /**
110
+ * 是否显示上传区域(拖拽框、上传提示、模板下载入口)。
111
+ *
112
+ * 传 `false` 时只保留已上传列表,用于纯查看场景;此时 `accept` / `limit` / `maxSize`
113
+ * 这些上传相关配置不再生效,列表上的查看、下载、删除按钮仍由各自的 `show*` 控制。
114
+ */
115
+ readonly showUploadArea: {
116
+ readonly type: PropType<boolean>;
117
+ readonly default: true;
118
+ };
109
119
  /** 是否显示模板下载链接 */
110
120
  readonly showTemplateDownload: {
111
121
  readonly type: PropType<boolean>;
@@ -53,6 +53,16 @@ const o = {
53
53
  type: Boolean,
54
54
  default: !0
55
55
  },
56
+ /**
57
+ * 是否显示上传区域(拖拽框、上传提示、模板下载入口)。
58
+ *
59
+ * 传 `false` 时只保留已上传列表,用于纯查看场景;此时 `accept` / `limit` / `maxSize`
60
+ * 这些上传相关配置不再生效,列表上的查看、下载、删除按钮仍由各自的 `show*` 控制。
61
+ */
62
+ showUploadArea: {
63
+ type: Boolean,
64
+ default: !0
65
+ },
56
66
  /** 是否显示模板下载链接 */
57
67
  showTemplateDownload: {
58
68
  type: Boolean,