@qynpm/ui 1.0.42 → 1.0.44

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 (44) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.mjs +2 -2
  4. package/dist/qy-action-bar/index.cjs +1 -1
  5. package/dist/qy-action-bar/index.mjs +1 -1
  6. package/dist/qy-dialog/index.cjs +1 -1
  7. package/dist/qy-dialog/index.mjs +1 -1
  8. package/dist/qy-file-picker/index.cjs +1 -1
  9. package/dist/qy-file-picker/index.mjs +1 -1
  10. package/dist/qy-form-section/index.cjs +1 -1
  11. package/dist/qy-form-section/index.mjs +1 -1
  12. package/dist/qy-image-upload/index.cjs +1 -1
  13. package/dist/qy-image-upload/index.mjs +1 -1
  14. package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
  15. package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
  16. package/dist/qy-pagination/index.cjs +1 -1
  17. package/dist/qy-pagination/index.mjs +1 -1
  18. package/dist/qy-record-quote-search/index.cjs +1 -1
  19. package/dist/qy-record-quote-search/index.mjs +1 -1
  20. package/dist/qy-remark-image/index.cjs +1 -1
  21. package/dist/qy-remark-image/index.mjs +1 -1
  22. package/dist/qy-remote-select/index.cjs +1 -1
  23. package/dist/qy-remote-select/index.mjs +1 -1
  24. package/dist/qy-search-input/index.cjs +1 -1
  25. package/dist/qy-search-input/index.mjs +1 -1
  26. package/dist/qy-selection-dialog/index.cjs +1 -1
  27. package/dist/qy-selection-dialog/index.mjs +1 -1
  28. package/dist/qy-upload/index.cjs +1 -1
  29. package/dist/qy-upload/index.mjs +1 -1
  30. package/dist/shared/{index-BPnHycGa.cjs → index-5dxbpQb_.cjs} +1 -1
  31. package/dist/shared/{index-BhvOSOfi.mjs → index-Bh9hxVFh.mjs} +2 -2
  32. package/dist/shared/{index-DAztNKSp.cjs → index-BweLwi2_.cjs} +1 -1
  33. package/dist/shared/index-C4F8hXzQ.mjs +338 -0
  34. package/dist/shared/index-CmgTSaFS.cjs +1 -0
  35. package/dist/shared/{index-DXZ6Y6wd.mjs → index-DNnWRAFl.mjs} +1 -1
  36. package/dist/shared/index-afOuq3YX.cjs +1 -0
  37. package/dist/shared/{index-QewoB6N4.mjs → index-rjciSHaR.mjs} +4 -4
  38. package/dist/shared/{index.vue_vue_type_style_index_0_lang-BXAUYDO7.mjs → index.vue_vue_type_style_index_0_lang-Bb3L64L8.mjs} +62 -60
  39. package/dist/shared/index.vue_vue_type_style_index_0_lang-D9-2GN18.cjs +1 -0
  40. package/package.json +2 -3
  41. package/dist/shared/index-DuP-b_eY.cjs +0 -1
  42. package/dist/shared/index-d76Z3yrB.cjs +0 -1
  43. package/dist/shared/index-zo5J-y0C.mjs +0 -157
  44. package/dist/shared/index.vue_vue_type_style_index_0_lang-Da67JRFL.cjs +0 -1
@@ -1,5 +1,5 @@
1
1
  import { ElDialog as he, ElIcon as xe } from "element-plus/es";
2
- import { defineComponent as we, useSlots as be, ref as d, computed as C, createVNode as z, watchEffect as ke, watch as te, h as le, onMounted as _e, nextTick as ne, onUnmounted as Ce, openBlock as i, createElementBlock as c, normalizeClass as I, createSlots as ze, withCtx as q, createElementVNode as l, normalizeStyle as A, unref as L, createCommentVNode as v, renderSlot as M, toDisplayString as ae, withModifiers as u, createBlock as ie, withDirectives as qe, vShow as Me } from "vue";
2
+ import { defineComponent as we, useSlots as be, ref as d, computed as C, createVNode as z, watchEffect as ke, watch as le, h as ne, nextTick as A, onMounted as _e, onUnmounted as Ce, openBlock as i, createElementBlock as c, normalizeClass as I, createSlots as ze, withCtx as q, createElementVNode as l, normalizeStyle as N, unref as L, createCommentVNode as v, renderSlot as M, toDisplayString as ae, withModifiers as u, createBlock as ie, withDirectives as qe, vShow as Me } from "vue";
3
3
  import Se from "clsx";
4
4
  import { ElButton as se } from "element-plus";
5
5
  import { Close as Be } from "@element-plus/icons-vue";
@@ -17,7 +17,7 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
17
17
  }, Ze = {
18
18
  key: 0,
19
19
  class: "fixed -right-12 top-2 h-9 w-9 hover:bg-gray-600/80 transition-all"
20
- }, He = { class: "flex justify-between h-[var(--footer-height)] px-[var(--content-padding)] items-center" }, Ae = { class: "flex items-center justify-between w-full pl-1 pr-4 h-full ml-2" }, Ne = { class: "flex items-center gap-2" }, Fe = { class: "text-sm text-gray-700 truncate max-w-[200px]" }, je = { class: "flex items-center gap-2" }, re = 5, N = 2e3, Je = /* @__PURE__ */ we({
20
+ }, He = { class: "flex justify-between h-[var(--footer-height)] px-[var(--content-padding)] items-center" }, Ae = { class: "flex items-center justify-between w-full pl-1 pr-4 h-full ml-2" }, Ne = { class: "flex items-center gap-2" }, Fe = { class: "text-sm text-gray-700 truncate max-w-[200px]" }, je = { class: "flex items-center gap-2" }, re = 5, F = 2e3, Je = /* @__PURE__ */ we({
21
21
  inheritAttrs: !1,
22
22
  __name: "index",
23
23
  props: {
@@ -47,7 +47,7 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
47
47
  emits: ["update:open", "open-change", "confirm", "cancel", "close", "opened", "closed"],
48
48
  setup(de, { expose: ce, emit: ue }) {
49
49
  let m = 0;
50
- const t = de, D = be(), F = d(!0), O = d(!1), j = d(N), R = d(null), fe = Ee({
50
+ const t = de, D = be(), j = d(!0), O = d(!1), R = d(F), V = d(null), fe = Ee({
51
51
  mobile: 0,
52
52
  tablet: 640,
53
53
  laptop: 1024,
@@ -55,43 +55,43 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
55
55
  }).isSmaller("tablet"), $ = C(() => {
56
56
  const e = [];
57
57
  return t.showCancel && e.push("cancel"), t.showConfirm && e.push("confirm"), e;
58
- }), V = C(() => ({
59
- CancelButton: z(J),
60
- ConfirmButton: z(G)
61
- })), U = C(() => !!(D.footer || t.showFooter)), h = d(!1), b = d(!1);
62
- let T = !1, x = document.activeElement instanceof HTMLElement ? document.activeElement : null;
58
+ }), U = C(() => ({
59
+ CancelButton: z(P),
60
+ ConfirmButton: z(J)
61
+ })), W = C(() => !!(D.footer || t.showFooter)), h = d(!1), x = d(!1);
62
+ let T = !1, w = document.activeElement instanceof HTMLElement ? document.activeElement : null;
63
63
  const k = d(
64
64
  t.showFullscreen && fe ? !0 : t.fullscreen
65
- ), s = ue, W = C(() => t.open);
65
+ ), s = ue, X = C(() => t.open);
66
66
  ke(() => {
67
- W.value && (h.value = !1);
68
- }), te(
67
+ X.value && (h.value = !1);
68
+ }), le(
69
69
  () => t.open,
70
70
  (e, o) => {
71
71
  if (e) {
72
- h.value = !1, b.value = !1, x = document.activeElement instanceof HTMLElement ? document.activeElement : x, o === !1 && s("open-change", !0);
72
+ h.value = !1, x.value = !1, w = document.activeElement instanceof HTMLElement ? document.activeElement : w, o === !1 && s("open-change", !0);
73
73
  return;
74
74
  }
75
75
  o && !h.value && (h.value = !0, s("open-change", !1), s("close", "external"));
76
76
  }
77
- ), te(
77
+ ), le(
78
78
  () => t.confirmLoading,
79
79
  (e) => {
80
- e ? T = !0 : T && (T = !1, b.value = !1);
80
+ e ? T = !0 : T && (T = !1, x.value = !1);
81
81
  }
82
82
  ), ce({
83
83
  handleMinimize: H
84
84
  });
85
- const p = `qy-dialog-${Math.random().toString(36).slice(2, 11)}`, w = d(!1);
85
+ const p = `qy-dialog-${Math.random().toString(36).slice(2, 11)}`, b = d(!1);
86
86
  let _ = !1;
87
- const S = d(null), { x: X, y: Z } = Ie(S, {
87
+ const S = d(null), { x: K, y: Z } = Ie(S, {
88
88
  initialValue: {
89
89
  x: 5,
90
90
  y: window.innerHeight - 100 - m * 60
91
91
  },
92
92
  onMove(e) {
93
93
  var o;
94
- (o = S.value) == null || o.classList.add("dragging"), document.body.classList.add("qy-dialog--dragging"), X.value = Math.max(
94
+ (o = S.value) == null || o.classList.add("dragging"), document.body.classList.add("qy-dialog--dragging"), K.value = Math.max(
95
95
  0,
96
96
  Math.min(window.innerWidth - 300, e.x)
97
97
  ), Z.value = Math.max(
@@ -104,58 +104,60 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
104
104
  (e = S.value) == null || e.classList.remove("dragging"), document.body.classList.remove("qy-dialog--dragging");
105
105
  }
106
106
  }), me = C(() => ({
107
- transform: `translate(${X.value}px, ${Z.value}px)`,
107
+ transform: `translate(${K.value}px, ${Z.value}px)`,
108
108
  willChange: "transform"
109
109
  }));
110
- function K(e) {
110
+ function Y(e) {
111
111
  const o = e.target, { scrollTop: n, scrollHeight: r, clientHeight: f } = o;
112
- F.value = n <= re, O.value = r - (n + f) <= re;
112
+ j.value = n <= re, O.value = r - (n + f) <= re;
113
113
  }
114
114
  function pe() {
115
115
  const e = document.querySelector(`.${p}.el-dialog`);
116
- e && (R.value = e, e.addEventListener("scroll", K)), B(), s("opened");
116
+ e && (V.value = e, e.addEventListener("scroll", Y)), B(), s("opened");
117
117
  }
118
- function Y() {
118
+ function G() {
119
119
  k.value = !k.value, B();
120
120
  }
121
121
  function g(e) {
122
- t.confirmLoading && e !== "external" || h.value || (h.value = !0, oe(), s("update:open", !1), s("open-change", !1), (e === "cancel" || e === "header") && s("cancel"), s("close", e));
122
+ t.confirmLoading && e !== "external" || h.value || (h.value = !0, te(), s("update:open", !1), s("open-change", !1), (e === "cancel" || e === "header") && s("cancel"), s("close", e));
123
123
  }
124
124
  function ge() {
125
- s("closed"), ne(() => {
126
- x != null && x.isConnected && x.focus();
125
+ s("closed"), A(() => {
126
+ w != null && w.isConnected && w.focus();
127
127
  });
128
128
  }
129
129
  function ye(e) {
130
- t.showFullscreen && e.detail >= 2 && Y();
130
+ t.showFullscreen && e.detail >= 2 && G();
131
131
  }
132
- function G() {
133
- return le(
132
+ function J() {
133
+ return ne(
134
134
  se,
135
135
  {
136
136
  type: "primary",
137
137
  class: "dialog__footerBtn",
138
138
  loading: t.confirmLoading,
139
- disabled: t.confirmDisabled || t.confirmLoading || b.value,
139
+ disabled: t.confirmDisabled || t.confirmLoading || x.value,
140
140
  onClick: ve
141
141
  },
142
142
  () => t.confirmText
143
143
  );
144
144
  }
145
145
  function ve() {
146
- b.value || t.confirmLoading || t.confirmDisabled || (b.value = !0, s("confirm"), t.closeOnConfirm && g("confirm"));
146
+ x.value || t.confirmLoading || t.confirmDisabled || (x.value = !0, s("confirm"), A(() => {
147
+ t.confirmLoading || (x.value = !1);
148
+ }), t.closeOnConfirm && g("confirm"));
147
149
  }
148
- function J() {
149
- return le(
150
+ function P() {
151
+ return ne(
150
152
  se,
151
153
  { class: "dialog__footerBtn", onClick: () => g("cancel") },
152
154
  () => t.cancelText
153
155
  );
154
156
  }
155
157
  _e(() => {
156
- typeof window.qyDialogMaxZIndex > "u" && (window.qyDialogMaxZIndex = N), B(), document.addEventListener("keydown", Q), document.addEventListener("mousedown", ee, !0);
158
+ typeof window.qyDialogMaxZIndex > "u" && (window.qyDialogMaxZIndex = F), B(), document.addEventListener("keydown", ee), document.addEventListener("mousedown", oe, !0);
157
159
  });
158
- function P() {
160
+ function Q() {
159
161
  var r, f;
160
162
  const e = (r = document.querySelector(`.${p}`)) == null ? void 0 : r.closest(".el-overlay");
161
163
  if (!e) return !1;
@@ -173,11 +175,11 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
173
175
  (a, y) => a.zIndex - y.zIndex || a.order - y.order
174
176
  ), ((f = n.at(-1)) == null ? void 0 : f.overlay) === e;
175
177
  }
176
- function Q(e) {
177
- e.key !== "Escape" || !t.open || !t.closeOnEscape || t.confirmLoading || !P() || (e.preventDefault(), g("escape"));
178
- }
179
178
  function ee(e) {
180
- if (!t.open || !t.closeOnOverlay || t.confirmLoading || !P() || !(e.target instanceof Node))
179
+ e.key !== "Escape" || !t.open || !t.closeOnEscape || t.confirmLoading || !Q() || (e.preventDefault(), g("escape"));
180
+ }
181
+ function oe(e) {
182
+ if (!t.open || !t.closeOnOverlay || t.confirmLoading || !Q() || !(e.target instanceof Node))
181
183
  return;
182
184
  const o = document.querySelector(`.${p}.el-dialog`), n = o == null ? void 0 : o.closest(".el-overlay");
183
185
  !o || !n || !n.contains(e.target) || o.contains(e.target) || g("overlay");
@@ -190,7 +192,7 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
190
192
  `.${p}.el-dialog`
191
193
  );
192
194
  if (!o || !n) return;
193
- const r = N;
195
+ const r = F;
194
196
  window.qyDialogMaxZIndex = window.qyDialogMaxZIndex || r;
195
197
  const a = Math.max(
196
198
  window.qyDialogMaxZIndex,
@@ -198,25 +200,25 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
198
200
  (E) => parseInt(window.getComputedStyle(E).zIndex || r.toString())
199
201
  )
200
202
  ) + 2;
201
- window.qyDialogMaxZIndex = a, ne(() => {
202
- o.style.zIndex = a.toString(), n.style.zIndex = (a + 1).toString(), j.value = a + 1;
203
+ window.qyDialogMaxZIndex = a, A(() => {
204
+ o.style.zIndex = a.toString(), n.style.zIndex = (a + 1).toString(), R.value = a + 1;
203
205
  });
204
206
  }
205
207
  Ce(() => {
206
208
  var e;
207
- document.removeEventListener("keydown", Q), document.removeEventListener("mousedown", ee, !0), (e = R.value) == null || e.removeEventListener("scroll", K), oe();
209
+ document.removeEventListener("keydown", ee), document.removeEventListener("mousedown", oe, !0), (e = V.value) == null || e.removeEventListener("scroll", Y), te();
208
210
  });
209
- function oe() {
211
+ function te() {
210
212
  if (!_) {
211
- w.value = !1;
213
+ b.value = !1;
212
214
  return;
213
215
  }
214
- _ = !1, m = Math.max(0, m - 1), w.value = !1;
216
+ _ = !1, m = Math.max(0, m - 1), b.value = !1;
215
217
  }
216
218
  function H() {
217
219
  var o;
218
220
  const e = (o = document.querySelector(`.${p}`)) == null ? void 0 : o.closest(".el-overlay");
219
- !e || !t.open || (w.value ? (w.value = !1, e.style.display = "block", _ && (_ = !1, m = Math.max(0, m - 1)), B()) : (w.value = !0, e.style.display = "none", _ = !0, m += 1, Z.value = window.innerHeight - 50 - m * 60));
221
+ !e || !t.open || (b.value ? (b.value = !1, e.style.display = "block", _ && (_ = !1, m = Math.max(0, m - 1)), B()) : (b.value = !0, e.style.display = "none", _ = !0, m += 1, Z.value = window.innerHeight - 50 - m * 60));
220
222
  }
221
223
  return (e, o) => {
222
224
  const n = xe, r = he;
@@ -227,7 +229,7 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
227
229
  t.size === "small" && "[&_.el-dialog__header]:!hidden",
228
230
  p
229
231
  ]]),
230
- "model-value": W.value,
232
+ "model-value": X.value,
231
233
  title: t.title,
232
234
  width: t.width,
233
235
  top: t.top,
@@ -242,7 +244,7 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
242
244
  "close-on-press-escape": !1,
243
245
  "close-on-click-modal": !1,
244
246
  fullscreen: k.value,
245
- "z-index": j.value,
247
+ "z-index": R.value,
246
248
  onClosed: ge,
247
249
  onOpened: pe,
248
250
  draggable: t.draggable
@@ -250,9 +252,9 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
250
252
  header: q(() => [
251
253
  t.size === "default" ? (i(), c("div", {
252
254
  key: 0,
253
- style: A({
255
+ style: N({
254
256
  borderBottom: "1px solid",
255
- borderColor: F.value ? "transparent" : "var(--block-outline-color)",
257
+ borderColor: j.value ? "transparent" : "var(--block-outline-color)",
256
258
  transition: "border-color .2s linear"
257
259
  }),
258
260
  class: "flex justify-between h-[var(--header-height)]",
@@ -284,7 +286,7 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
284
286
  t.showFullscreen ? (i(), c("div", {
285
287
  key: 1,
286
288
  class: "qy-dialog__btn qy-dialog__btn--default",
287
- onClick: u(Y, ["stop"]),
289
+ onClick: u(G, ["stop"]),
288
290
  onMousedown: o[1] || (o[1] = u(() => {
289
291
  }, ["stop"]))
290
292
  }, [
@@ -308,8 +310,8 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
308
310
  default: q(() => [
309
311
  l("div", {
310
312
  class: I(["qy-dialog__wrapper", L(Se)(k.value && "qy-dialog__wrapper--fullscreen")]),
311
- style: A({
312
- maxHeight: U.value ? "calc(100vh - var(--header-height) - var(--footer-height) - var(--sides-gap))" : "calc(100vh - var(--header-height) - var(--sides-gap))",
313
+ style: N({
314
+ maxHeight: W.value ? "calc(100vh - var(--header-height) - var(--footer-height) - var(--sides-gap))" : "calc(100vh - var(--header-height) - var(--sides-gap))",
313
315
  padding: t.size === "small" ? "var(--small-content-padding)" : "var(--content-padding)"
314
316
  })
315
317
  }, [
@@ -342,14 +344,14 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
342
344
  "qy-dialog__footer--outline": O.value
343
345
  }, "qy-dialog__footer flex items-center justify-end"])
344
346
  }, [
345
- $.value.includes("cancel") ? (i(), ie(J, { key: 0 })) : v("", !0),
346
- $.value.includes("confirm") ? (i(), ie(G, { key: 1 })) : v("", !0),
347
+ $.value.includes("cancel") ? (i(), ie(P, { key: 0 })) : v("", !0),
348
+ $.value.includes("confirm") ? (i(), ie(J, { key: 1 })) : v("", !0),
347
349
  M(e.$slots, "footer-append")
348
350
  ], 2)
349
351
  ])
350
352
  ]),
351
353
  key: "0"
352
- } : U.value ? {
354
+ } : W.value ? {
353
355
  name: "footer",
354
356
  fn: q(() => [
355
357
  l("div", {
@@ -358,8 +360,8 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
358
360
  }, "qy-dialog__footer px-[var(--content-padding)] min-h-[var(--footer-height)] flex items-center justify-end"])
359
361
  }, [
360
362
  M(e.$slots, "footer", {
361
- layouts: V.value,
362
- layoutsNode: Object.values(V.value)
363
+ layouts: U.value,
364
+ layoutsNode: Object.values(U.value)
363
365
  })
364
366
  ], 2)
365
367
  ]),
@@ -370,7 +372,7 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
370
372
  ref_key: "minimizedRef",
371
373
  ref: S,
372
374
  class: "fixed left-0 top-0 bg-white rounded shadow-lg cursor-pointer z-[9999] hover:bg-gray-50",
373
- style: A([me.value, { width: "300px", height: "50px", "will-change": "transform" }])
375
+ style: N([me.value, { width: "300px", height: "50px", "will-change": "transform" }])
374
376
  }, [
375
377
  l("div", Ae, [
376
378
  l("div", Ne, [
@@ -393,7 +395,7 @@ const Le = { class: "text-lg flex items-center pt-2 pl-[var(--content-padding)]"
393
395
  ])
394
396
  ])
395
397
  ], 4), [
396
- [Me, w.value]
398
+ [Me, b.value]
397
399
  ])
398
400
  ]);
399
401
  };
@@ -0,0 +1 @@
1
+ "use strict";const R=require("element-plus"),e=require("vue"),le=require("clsx"),U=require("element-plus"),ne=require("@element-plus/icons-vue"),W=require("@vueuse/core"),ae={class:"text-lg flex items-center pt-2 pl-[var(--content-padding)]"},re={key:0},ie={key:1},se={key:0,class:"icon-[material-symbols--square-outline-rounded]",role:"img","aria-hidden":"true"},de={key:1,class:"icon-[tdesign--fullscreen-exit-1]",role:"img","aria-hidden":"true"},ce={key:0,class:"fixed -right-12 top-2 h-9 w-9 hover:bg-gray-600/80 transition-all"},ue={class:"flex justify-between h-[var(--footer-height)] px-[var(--content-padding)] items-center"},fe={class:"flex items-center justify-between w-full pl-1 pr-4 h-full ml-2"},me={class:"flex items-center gap-2"},pe={class:"text-sm text-gray-700 truncate max-w-[200px]"},ge={class:"flex items-center gap-2"},X=5,M=2e3,ye=e.defineComponent({inheritAttrs:!1,__name:"index",props:{open:{type:Boolean,default:!1},title:{default:""},width:{default:"50%"},showFooter:{type:Boolean,default:!0},showConfirm:{type:Boolean,default:!0},showCancel:{type:Boolean,default:!0},confirmText:{default:"确 认"},cancelText:{default:"取 消"},confirmLoading:{type:Boolean,default:!1},confirmDisabled:{type:Boolean,default:!1},closeOnConfirm:{type:Boolean,default:!1},closeOnEscape:{type:Boolean,default:!0},closeOnOverlay:{type:Boolean,default:!0},minimizable:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},top:{default:"15vh"},fullscreen:{type:Boolean,default:!1},showFullscreen:{type:Boolean,default:!1},size:{default:"default"},zIndex:{default:2e3}},emits:["update:open","open-change","confirm","cancel","close","opened","closed"],setup(K,{expose:P,emit:Y}){let d=0;const l=K,E=e.useSlots(),S=e.ref(!0),C=e.ref(!1),q=e.ref(M),N=e.ref(null),G=W.useBreakpoints({mobile:0,tablet:640,laptop:1024,desktop:1280}).isSmaller("tablet"),B=e.computed(()=>{const t=[];return l.showCancel&&t.push("cancel"),l.showConfirm&&t.push("confirm"),t}),V=e.computed(()=>({CancelButton:e.createVNode(Z),ConfirmButton:e.createVNode(T)})),I=e.computed(()=>!!(E.footer||l.showFooter)),m=e.ref(!1),p=e.ref(!1);let b=!1,g=document.activeElement instanceof HTMLElement?document.activeElement:null;const v=e.ref(l.showFullscreen&&G?!0:l.fullscreen),r=Y,L=e.computed(()=>l.open);e.watchEffect(()=>{L.value&&(m.value=!1)}),e.watch(()=>l.open,(t,o)=>{if(t){m.value=!1,p.value=!1,g=document.activeElement instanceof HTMLElement?document.activeElement:g,o===!1&&r("open-change",!0);return}o&&!m.value&&(m.value=!0,r("open-change",!1),r("close","external"))}),e.watch(()=>l.confirmLoading,t=>{t?b=!0:b&&(b=!1,p.value=!1)}),P({handleMinimize:z});const c=`qy-dialog-${Math.random().toString(36).slice(2,11)}`,y=e.ref(!1);let h=!1;const w=e.ref(null),{x:D,y:_}=W.useDraggable(w,{initialValue:{x:5,y:window.innerHeight-100-d*60},onMove(t){var o;(o=w.value)==null||o.classList.add("dragging"),document.body.classList.add("qy-dialog--dragging"),D.value=Math.max(0,Math.min(window.innerWidth-300,t.x)),_.value=Math.max(0,Math.min(window.innerHeight-50,t.y))},onEnd(){var t;(t=w.value)==null||t.classList.remove("dragging"),document.body.classList.remove("qy-dialog--dragging")}}),J=e.computed(()=>({transform:`translate(${D.value}px, ${_.value}px)`,willChange:"transform"}));function O(t){const o=t.target,{scrollTop:n,scrollHeight:i,clientHeight:s}=o;S.value=n<=X,C.value=i-(n+s)<=X}function Q(){const t=document.querySelector(`.${c}.el-dialog`);t&&(N.value=t,t.addEventListener("scroll",O)),x(),r("opened")}function $(){v.value=!v.value,x()}function u(t){l.confirmLoading&&t!=="external"||m.value||(m.value=!0,j(),r("update:open",!1),r("open-change",!1),(t==="cancel"||t==="header")&&r("cancel"),r("close",t))}function ee(){r("closed"),e.nextTick(()=>{g!=null&&g.isConnected&&g.focus()})}function te(t){l.showFullscreen&&t.detail>=2&&$()}function T(){return e.h(U.ElButton,{type:"primary",class:"dialog__footerBtn",loading:l.confirmLoading,disabled:l.confirmDisabled||l.confirmLoading||p.value,onClick:oe},()=>l.confirmText)}function oe(){p.value||l.confirmLoading||l.confirmDisabled||(p.value=!0,r("confirm"),e.nextTick(()=>{l.confirmLoading||(p.value=!1)}),l.closeOnConfirm&&u("confirm"))}function Z(){return e.h(U.ElButton,{class:"dialog__footerBtn",onClick:()=>u("cancel")},()=>l.cancelText)}e.onMounted(()=>{typeof window.qyDialogMaxZIndex>"u"&&(window.qyDialogMaxZIndex=M),x(),document.addEventListener("keydown",A),document.addEventListener("mousedown",F,!0)});function H(){var i,s;const t=(i=document.querySelector(`.${c}`))==null?void 0:i.closest(".el-overlay");if(!t)return!1;const n=Array.from(document.querySelectorAll(".el-overlay")).filter(a=>window.getComputedStyle(a).display!=="none").map((a,f)=>({overlay:a,order:f,zIndex:Number.parseInt(window.getComputedStyle(a).zIndex||"0",10)}));return n.sort((a,f)=>a.zIndex-f.zIndex||a.order-f.order),((s=n.at(-1))==null?void 0:s.overlay)===t}function A(t){t.key!=="Escape"||!l.open||!l.closeOnEscape||l.confirmLoading||!H()||(t.preventDefault(),u("escape"))}function F(t){if(!l.open||!l.closeOnOverlay||l.confirmLoading||!H()||!(t.target instanceof Node))return;const o=document.querySelector(`.${c}.el-dialog`),n=o==null?void 0:o.closest(".el-overlay");!o||!n||!n.contains(t.target)||o.contains(t.target)||u("overlay")}function x(){var f;const t=Array.from(document.querySelectorAll(".el-overlay")).filter(k=>window.getComputedStyle(k).display!=="none"&&!k.classList.contains("is-message")),o=(f=document.querySelector(`.${c}`))==null?void 0:f.closest(".el-overlay"),n=document.querySelector(`.${c}.el-dialog`);if(!o||!n)return;const i=M;window.qyDialogMaxZIndex=window.qyDialogMaxZIndex||i;const a=Math.max(window.qyDialogMaxZIndex,...t.map(k=>parseInt(window.getComputedStyle(k).zIndex||i.toString())))+2;window.qyDialogMaxZIndex=a,e.nextTick(()=>{o.style.zIndex=a.toString(),n.style.zIndex=(a+1).toString(),q.value=a+1})}e.onUnmounted(()=>{var t;document.removeEventListener("keydown",A),document.removeEventListener("mousedown",F,!0),(t=N.value)==null||t.removeEventListener("scroll",O),j()});function j(){if(!h){y.value=!1;return}h=!1,d=Math.max(0,d-1),y.value=!1}function z(){var o;const t=(o=document.querySelector(`.${c}`))==null?void 0:o.closest(".el-overlay");!t||!l.open||(y.value?(y.value=!1,t.style.display="block",h&&(h=!1,d=Math.max(0,d-1)),x()):(y.value=!0,t.style.display="none",h=!0,d+=1,_.value=window.innerHeight-50-d*60))}return(t,o)=>{const n=R.ElIcon,i=R.ElDialog;return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(i,{ref:"dialogRef",class:e.normalizeClass(["qy-dialog",[l.size==="small"&&"[&_.el-dialog__header]:!hidden",c]]),"model-value":L.value,title:l.title,width:l.width,top:l.top,"align-center":"","append-to-body":"","destroy-on-close":l.destroyOnClose,"lock-scroll":l.lockScroll,style:{"--el-dialog-padding-primary":0},"show-close":!1,"close-on-press-escape":!1,"close-on-click-modal":!1,fullscreen:v.value,"z-index":q.value,onClosed:ee,onOpened:Q,draggable:l.draggable},e.createSlots({header:e.withCtx(()=>[l.size==="default"?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({borderBottom:"1px solid",borderColor:S.value?"transparent":"var(--block-outline-color)",transition:"border-color .2s linear"}),class:"flex justify-between h-[var(--header-height)]",onDblclick:te},[e.createElementVNode("div",ae,[e.unref(E).header?e.unref(E).header?(e.openBlock(),e.createElementBlock("div",ie,[e.renderSlot(t.$slots,"header")])):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",re,e.toDisplayString(l.title),1))]),e.createElementVNode("div",{class:"flex",onMousedown:o[4]||(o[4]=e.withModifiers(()=>{},["stop"]))},[l.size==="default"&&l.minimizable?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qy-dialog__btn qy-dialog__btn--default",onClick:e.withModifiers(z,["stop"]),onMousedown:o[0]||(o[0]=e.withModifiers(()=>{},["stop"]))},[...o[7]||(o[7]=[e.createElementVNode("span",{class:"icon-[material-symbols--minimize] text-xl mb-3",role:"img","aria-hidden":"true"},null,-1)])],32)):e.createCommentVNode("",!0),l.showFullscreen?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qy-dialog__btn qy-dialog__btn--default",onClick:e.withModifiers($,["stop"]),onMousedown:o[1]||(o[1]=e.withModifiers(()=>{},["stop"]))},[v.value?(e.openBlock(),e.createElementBlock("span",de)):(e.openBlock(),e.createElementBlock("span",se))],32)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"qy-dialog__btn qy-dialog__btn--danger",onClick:o[2]||(o[2]=e.withModifiers(s=>u("header"),["stop"])),onMousedown:o[3]||(o[3]=e.withModifiers(()=>{},["stop"]))},[...o[8]||(o[8]=[e.createElementVNode("span",{class:"icon-[ri--close-line] text-xl",role:"img","aria-hidden":"true"},null,-1)])],32)],32)],36)):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["qy-dialog__wrapper",e.unref(le)(v.value&&"qy-dialog__wrapper--fullscreen")]),style:e.normalizeStyle({maxHeight:I.value?"calc(100vh - var(--header-height) - var(--footer-height) - var(--sides-gap))":"calc(100vh - var(--header-height) - var(--sides-gap))",padding:l.size==="small"?"var(--small-content-padding)":"var(--content-padding)"})},[l.size==="small"?(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(n,{size:36,class:"cursor-pointer text-gray-100 active:scale-75 rounded-sm transition-all",onClick:o[5]||(o[5]=s=>u("header"))},{default:e.withCtx(()=>[e.createVNode(e.unref(ne.Close))]),_:1})])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default")],6)]),_:2},[l.showFooter&&!t.$slots.footer&&Array.isArray(B.value)?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",null,[e.renderSlot(t.$slots,"footer-left")]),e.createElementVNode("div",{class:e.normalizeClass([{"qy-dialog__footer--outline":C.value},"qy-dialog__footer flex items-center justify-end"])},[B.value.includes("cancel")?(e.openBlock(),e.createBlock(Z,{key:0})):e.createCommentVNode("",!0),B.value.includes("confirm")?(e.openBlock(),e.createBlock(T,{key:1})):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"footer-append")],2)])]),key:"0"}:I.value?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([{"qy-dialog__footer--outline":C.value},"qy-dialog__footer px-[var(--content-padding)] min-h-[var(--footer-height)] flex items-center justify-end"])},[e.renderSlot(t.$slots,"footer",{layouts:V.value,layoutsNode:Object.values(V.value)})],2)]),key:"1"}:void 0]),1032,["class","model-value","title","width","top","destroy-on-close","lock-scroll","fullscreen","z-index","draggable"]),e.withDirectives(e.createElementVNode("div",{ref_key:"minimizedRef",ref:w,class:"fixed left-0 top-0 bg-white rounded shadow-lg cursor-pointer z-[9999] hover:bg-gray-50",style:e.normalizeStyle([J.value,{width:"300px",height:"50px","will-change":"transform"}])},[e.createElementVNode("div",fe,[e.createElementVNode("div",me,[o[9]||(o[9]=e.createElementVNode("div",{class:"icon-[mdi--window-restore] text-gray-600"},null,-1)),e.createElementVNode("span",pe,e.toDisplayString(l.title),1)]),e.createElementVNode("div",ge,[e.createElementVNode("div",{class:"p-1 hover:bg-gray-200 rounded",onClick:e.withModifiers(z,["stop"])},[...o[10]||(o[10]=[e.createElementVNode("div",{class:"icon-[mdi--window-maximize] text-gray-600"},null,-1)])]),e.createElementVNode("div",{class:"p-1 hover:bg-red-100 rounded",onClick:o[6]||(o[6]=e.withModifiers(s=>u("header"),["stop"]))},[...o[11]||(o[11]=[e.createElementVNode("div",{class:"icon-[mdi--close] text-red-600"},null,-1)])])])])],4),[[e.vShow,y.value]])])}}});exports._sfc_main=ye;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qynpm/ui",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "description": "起印公共 UI 组件包。",
5
5
  "repository": {
6
6
  "type": "git",
@@ -462,8 +462,7 @@
462
462
  "dev": "vite",
463
463
  "build": "vite build",
464
464
  "test": "vitest run --config vitest.config.ts --maxWorkers=1",
465
- "preview": "vite preview",
466
- "release": "node scripts/publish.js"
465
+ "preview": "vite preview"
467
466
  },
468
467
  "peerDependencies": {
469
468
  "vue": "^3.4.0",
@@ -1 +0,0 @@
1
- "use strict";const e=require("vue"),_=require("element-plus"),S=require("element-plus/es/locale/lang/zh-cn"),z=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),N=e.defineComponent({__name:"ElementPaginationRenderer",props:{total:{},currentPage:{},pageSize:{},pageSizes:{},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["page-change","page-size-change"],setup(r,{emit:b}){const n=r,p=b,c=e.computed(()=>n.disabled||n.loading),d=e.computed(()=>n.pageSizes.length>1?"sizes, prev, pager, next":"prev, pager, next"),l=e.ref(null),v=e.ref(null);let s=0;function g(){var i,u;(u=(i=v.value)==null?void 0:i.querySelector('.el-pagination__sizes [role="combobox"]'))==null||u.setAttribute("aria-label","每页条数")}e.onMounted(g),e.onUpdated(g);function f(i){if(!c.value){if(l.value!==null){l.value=null;return}i!==n.currentPage&&p("page-change",i)}}function m(i){if(c.value)return;l.value=i;const u=++s;Promise.resolve().then(()=>{s===u&&(l.value=null)}),p("page-size-change",i)}return(i,u)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rendererRef",ref:v,class:"qy-pagination-element-renderer","data-testid":"qy-pagination-element-renderer"},[e.createVNode(e.unref(_.ElConfigProvider),{locale:e.unref(S)},{default:e.withCtx(()=>[e.createVNode(e.unref(_.ElPagination),{layout:d.value,total:r.total,"current-page":r.currentPage,"page-size":r.pageSize,"page-sizes":[...r.pageSizes],"pager-count":7,disabled:c.value,teleported:!1,"onUpdate:currentPage":f,"onUpdate:pageSize":m},null,8,["layout","total","current-page","page-size","page-sizes","disabled"])]),_:1},8,["locale"])],512))}}),q=z._export_sfc(N,[["__scopeId","data-v-a27b6aaa"]]),x=["aria-busy"],C={class:"qy-pagination__info"},B={class:"qy-pagination__total"},I={class:"qy-pagination__summary"},E={class:"qy-pagination__controls"},V=e.defineComponent({__name:"index",props:{total:{},page:{},pageSize:{},pageSizeOptions:{default:()=>[10,20,50]},hideOnSinglePage:{type:Boolean,default:!1},disabled:{type:Boolean},loading:{type:Boolean},binding:{}},emits:["page-change","page-size-change"],setup(r,{emit:b}){const n=r,p=b;function c(a,t){const o=Number(a);return Number.isInteger(o)&&o>0?o:t}const d=e.computed(()=>{var t;const a=Number(n.total??((t=n.binding)==null?void 0:t.total)??0);return Number.isFinite(a)&&a>=0?a:0}),l=e.computed(()=>{var a;return c(n.pageSize??((a=n.binding)==null?void 0:a.pageSize),10)}),v=e.computed(()=>{const t=(Array.isArray(n.pageSizeOptions)?n.pageSizeOptions:[]).map(o=>Number(o)).filter(o=>Number.isInteger(o)&&o>0);return[...new Set([...t,l.value])].sort((o,P)=>o-P)}),s=e.computed(()=>Math.max(1,Math.ceil(d.value/l.value))),g=e.computed(()=>{var a;return Math.min(Math.max(1,c(n.page??((a=n.binding)==null?void 0:a.page),1)),s.value)}),f=e.computed(()=>{var a;return!!(n.disabled??((a=n.binding)==null?void 0:a.disabled))}),m=e.computed(()=>{var a;return!!(n.loading??((a=n.binding)==null?void 0:a.loading))}),i=e.computed(()=>f.value||m.value),u=e.computed(()=>d.value>0&&(!n.hideOnSinglePage||s.value>1));function h(a){var t;i.value||!Number.isInteger(a)||a<1||a>s.value||a===g.value||((t=n.binding)==null||t.setPage(a),p("page-change",a))}function y(a){var t;i.value||!Number.isInteger(a)||a<=0||a===l.value||((t=n.binding)==null||t.setPageSize(a),p("page-size-change",a))}return(a,t)=>u.value?(e.openBlock(),e.createElementBlock("nav",{key:0,class:"qy-pagination","data-testid":"qy-pagination","aria-label":"分页","aria-busy":m.value?"true":void 0},[e.createElementVNode("div",C,[e.createElementVNode("span",B,"共 "+e.toDisplayString(d.value)+" 条",1),e.createElementVNode("span",I," 第 "+e.toDisplayString(g.value)+" / "+e.toDisplayString(s.value)+" 页 ",1)]),e.createElementVNode("div",E,[e.createVNode(q,{total:d.value,"current-page":g.value,"page-size":l.value,"page-sizes":v.value,disabled:f.value,loading:m.value,onPageChange:h,onPageSizeChange:y},null,8,["total","current-page","page-size","page-sizes","disabled","loading"])])],8,x)):e.createCommentVNode("",!0)}}),k=z._export_sfc(V,[["__scopeId","data-v-b58990f5"]]);exports.Pagination=k;
@@ -1 +0,0 @@
1
- "use strict";const C=require("element-plus"),l=require("vue"),de=require("@element-plus/icons-vue"),g=require("element-plus"),Le=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");/*! js-cookie v3.0.8 | MIT */function E(r){for(var x=1;x<arguments.length;x++){var k=arguments[x];for(var a in k)a!=="__proto__"&&(r[a]=k[a])}return r}var Ie={read:function(r){return r[0]==='"'&&(r=r.slice(1,-1)),r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(r){return encodeURIComponent(r).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function H(r,x){function k(u,V,f){if(!(typeof document>"u")){f=E({},x,f),typeof f.expires=="number"&&(f.expires=new Date(Date.now()+f.expires*864e5)),f.expires&&(f.expires=f.expires.toUTCString()),u=encodeURIComponent(u).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var y="";for(var s in f)f[s]&&(y+="; "+s,f[s]!==!0&&(y+="="+f[s].split(";")[0]));return document.cookie=u+"="+r.write(V,u)+y}}function a(u){if(!(typeof document>"u"||arguments.length&&!u)){for(var V=document.cookie?document.cookie.split("; "):[],f={},y=0;y<V.length;y++){var s=V[y].split("="),S=s.slice(1).join("=");try{var b=decodeURIComponent(s[0]);if(b in f||(f[b]=r.read(S,b)),u===b)break}catch{}}return u?f[u]:f}}return Object.create({set:k,get:a,remove:function(u,V){k(u,"",E({},V,{expires:-1}))},withAttributes:function(u){return H(this.converter,E({},this.attributes,u))},withConverter:function(u){return H(E({},this.converter,u),this.attributes)}},{attributes:{value:Object.freeze(x)},converter:{value:Object.freeze(r)}})}var ce=H(Ie,{path:"/"});const Ae="Admin-Token";function Pe(r=Ae){return ce.get(r)}const _e=["accept","multiple","disabled"],Oe=["disabled"],$e={class:"qy-upload__hint"},Ke=["placeholder","disabled"],We=["src"],He={key:1,class:"qy-upload__tip"},Xe={class:"error"},Je={class:"error"},Qe=Object.assign({name:"QyUpload"},{__name:"index",props:{modelValue:{type:[Object,Array,String],default:void 0},selectedFiles:{type:Array,default:()=>[]},autoUpload:{type:Boolean,default:!0},variant:{type:String,default:"media-card"},defaultValue:{type:Object,default:()=>({files:"",text:""})},valueFormat:{type:String,default:"object"},showText:{type:Boolean,default:!0},showPasteInput:{type:Boolean,default:!1},pastePlaceholder:{type:String,default:"输入文字"},multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},fileType:{type:Array,default:()=>[]},fileSize:{type:Number,default:10},limit:{type:Number,default:9},isShowTip:{type:Boolean,default:!1},api:{type:String,default:"/permission-api/common/uploads"},name:{type:String,default:"file"},tokenKey:{type:String,default:"Admin-Token"},supportVideo:{type:Boolean,default:!1},size:{type:String,default:"default"},disableDrag:{type:Boolean,default:!1},callBack:{type:Function,default:null},extraData:{type:Object,default:()=>({})},uploadRequest:{type:Function,default:null}},emits:["update:modelValue","update:selectedFiles","selectedFilesChange","change","success","error","remove","invalid"],setup(r,{expose:x,emit:k}){const a=r,u=k,V=l.ref(null),f=l.ref(null),y=l.ref(null),s=l.ref([]),S=l.ref(null),b=l.ref(null),U=[],X=new WeakMap;let L=Date.now(),I=!1;const A=l.ref(!1),P=l.ref([]),J=l.ref(0),B=l.ref(!1),Q=l.ref(""),G=l.ref(""),q=new Set,D=l.ref(!1),h=l.ref(""),_=l.ref(!1);l.onMounted(()=>{a.modelValue!==void 0||!a.autoUpload||ee(a.defaultValue)});const pe=l.computed(()=>({large:"160px",default:"140px",small:"80px"})[a.size]??a.size),T=l.computed(()=>a.disabled),fe=l.computed(()=>s.value.some(e=>e.status==="uploading")),me=l.computed(()=>a.variant==="file-list"||a.supportVideo?"text":"picture-card"),ve=l.computed(()=>a.supportVideo?1:!a.autoUpload&&!a.multiple?2:a.limit),ge=l.computed(()=>{var e;return a.isShowTip&&(a.fileSize||((e=w.value)==null?void 0:e.length))}),w=l.computed(()=>{var e;return(e=a.fileType)!=null&&e.length?a.fileType.map(t=>String(t).trim().replace(/^\./,"").toLowerCase()).filter(Boolean):a.variant==="file-list"?[]:a.supportVideo?["mp4","mov","avi"]:["jpg","jpeg","png","gif","webp"]}),j=l.computed(()=>{if(!a.autoUpload&&!a.multiple)return!1;const e=a.supportVideo?1:a.limit;return s.value.length>=e}),Y=l.computed(()=>w.value.map(e=>`.${e}`).join(",")),ye=l.computed(()=>({"qy-upload--reached-limit":j.value,"qy-upload--disabled":a.disabled,"qy-upload--video":a.supportVideo,"qy-upload--without-text":!a.showText&&!a.showPasteInput}));l.watch(h,()=>{I||F()}),l.watch(()=>a.modelValue,e=>{a.autoUpload&&e!==void 0&&ee(e)},{immediate:!0,deep:!0}),l.watch(()=>[a.autoUpload,a.selectedFiles],([e,t])=>{e||(s.value=R(t))},{immediate:!0,deep:!0});function Z(e){return Array.isArray(e)?e.filter(Boolean):e?String(e).split(",").filter(Boolean):[]}function he(e){return Array.isArray(e)?{files:e,text:""}:typeof e=="string"?{files:Z(e),text:""}:e&&typeof e=="object"?{files:Z(e.files),text:e.text??""}:{files:[],text:""}}function we(e=[]){return e.map((t,n)=>({name:String(t).split("/").pop()||`file-${n}`,url:t,status:"success",uid:Date.now()+n}))}function R(e=[]){return e.filter(Boolean).map((t,n)=>{const i=l.toRaw(t);return{name:i.name,raw:i,status:"ready",uid:xe(i,n)}})}function xe(e,t){if(e.uid!=null)return e.uid;const n=X.get(e);return n??(L+=t+1,X.set(e,L),L)}function O(e=s.value){return e.map(t=>{const n=t.raw??(t instanceof File?t:null);return n?l.toRaw(n):null}).filter(Boolean)}function z(e){u("update:selectedFiles",e),u("selectedFilesChange",e)}function Ve(e,t){if(a.autoUpload)return;const n=e==null?void 0:e.raw;if(n&&!$(n)){s.value=R(a.selectedFiles);return}const i=O(t);n&&!i.includes(n)&&i.push(n);const o=a.multiple?i:i.slice(-1);s.value=R(o),z(o)}function ke(e){const t=new Set(e.map(i=>i.url)),n=s.value.filter(i=>i.status==="uploading"&&!t.has(i.url));return[...e,...n]}function ee(e){const t=he(e);I=!0,h.value=t.text,s.value=ke(we(t.files)),l.nextTick(()=>{I=!1})}function te(e){return a.valueFormat==="array"?e.files:a.valueFormat==="string"?e.files.join(","):e}function be(){var e;(e=S.value)==null||e.focus()}function Ue(e){e.target.value=""}function F(e){const i={files:(e??s.value).filter(o=>o.status==="success"&&o.url).map(o=>o.url),text:h.value};u("update:modelValue",te(i)),u("change",i),a.callBack&&a.callBack(i)}function Ce(e,t){if(!a.autoUpload){const n=O(t);s.value=R(n),z(n),u("remove",e,t);return}F(t),u("remove",e,t)}function le(e){var n;const t=(e==null?void 0:e.name)||"";return t.includes(".")&&((n=t.split(".").pop())==null?void 0:n.toLowerCase())||""}function ne(e){var o,d,p;const t=((d=(o=e==null?void 0:e.type)==null?void 0:o.toLowerCase)==null?void 0:d.call(o))||"",n={"image/jpeg":["jpg","jpeg"],"image/png":["png"],"image/gif":["gif"],"image/bmp":["bmp"],"image/webp":["webp"],"video/mp4":["mp4"],"video/quicktime":["mov"],"video/x-msvideo":["avi"],"video/webm":["webm"]};if(n[t])return n[t];const i=(p=t.split("/")[1])==null?void 0:p.split("+")[0];return i?[i]:[]}function Be(e){if(!w.value.length)return!0;const t=le(e),n=ne(e);return[t,...n].some(i=>w.value.includes(i))}function $(e){if(a.fileSize>0&&e.size>a.fileSize*1024*1024){const n={code:"size",file:e,message:`文件大小不能超过${a.fileSize}M`};return g.ElMessage.warning(n.message),u("invalid",n),!1}if(!Be(e)){const n={code:"extension",file:e,message:`格式不支持,仅允许: ${w.value.join("/")}`};return g.ElMessage.warning(n.message),u("invalid",n),!1}return!0}async function Re(e,t,n,i){const o=ae(e);try{const d=await a.uploadRequest({file:e,formData:o,api:a.api,name:a.name,tokenKey:a.tokenKey,extraData:a.extraData}),p=Fe(d);if(!p){const c=new Error("上传失败,未返回文件地址");g.ElMessage.error(c.message),u("error",c),n==null||n(c);return}g.ElMessage.success("上传成功"),t==null||t({...typeof d=="object"&&d?d:{},url:p})}catch(d){g.ElMessage.error("上传失败"),u("error",d),n==null||n(d)}finally{i.close()}}function ae(e){const t=new FormData;return t.append(a.name,e),a.extraData&&Object.entries(a.extraData).forEach(([n,i])=>t.append(n,i)),t}function Fe(e){var i,o;if(typeof e=="string")return e;const t=e||{},n=t.urls??t.url??((i=t.data)==null?void 0:i.urls)??((o=t.data)==null?void 0:o.url)??"";return Array.isArray(n)?n[0]||"":n||""}function ie(e,t,n,i){const o=g.ElLoading.service({target:f.value,text:"上传中",background:"rgba(255,255,255,0.7)"});if(a.uploadRequest){Re(e,n,i,o);return}const d=a.api.startsWith("http")?a.api:window.location.origin+a.api.replace(/^([^/])/,"/$1"),p=ae(e),c=new XMLHttpRequest;U.push(c);const N=()=>{const m=U.indexOf(c);m!==-1&&U.splice(m,1),o.close()};c.open("POST",d);const v=Pe(a.tokenKey);v&&c.setRequestHeader("Authorization",`Bearer ${v}`),c.upload.onprogress=m=>{m.total>0&&(t==null||t({percent:m.loaded/m.total*100}))},c.onload=()=>{if(N(),c.status<200||c.status>=300){const m=`上传失败 (HTTP ${c.status})`;g.ElMessage.error(m),u("error",{msg:m,status:c.status}),i==null||i(new Error(m));return}try{const m=JSON.parse(c.responseText);m.code===200&&m.urls?(g.ElMessage.success("上传成功"),n==null||n({...m,url:m.urls})):(g.ElMessage.error(m.msg||"上传失败"),u("error",m),i==null||i(m))}catch{g.ElMessage.error("上传失败,响应格式错误"),u("error",new Error("Response parse error")),i==null||i(new Error("Response parse error"))}},c.onerror=()=>{N(),g.ElMessage.error("上传失败,网络异常"),u("error",new Error("Network error")),i==null||i(new Error("Network error"))},c.send(p)}function oe(e){return a.disabled?!1:$(e)}function Me(e,t){const n=s.value.find(i=>{var o;return i.uid===(e==null?void 0:e.uid)||((o=i.raw)==null?void 0:o.uid)===(e==null?void 0:e.uid)});n&&(n.url=t,n.status="success")}function Ne(e){ie(e.file,e.onProgress,t=>{Me(e.file,t.url),e.onSuccess(t),F(),u("success",t)},t=>e.onError(t))}function Se(e){var i;if(!e.url)return;const t=((i=e.url.split(".").pop())==null?void 0:i.toLowerCase())||"";if(["mp4","mov","avi","webm"].includes(t)){Q.value=e.url,G.value=e.name||"视频预览",B.value=!0;return}const n=s.value.filter(o=>{var d;return o.status==="success"&&o.url&&!["mp4","mov","avi","webm"].includes((d=o.url.split(".").pop())==null?void 0:d.toLowerCase())});P.value=n.map(o=>o.url),J.value=n.findIndex(o=>o.uid===e.uid)||0,A.value=!0}function qe(){A.value=!1,P.value=[]}function De(e,t){if(e.name&&le(e))return e;const n=ne(e).find(i=>w.value.includes(i));return n?new File([e],`paste-${Date.now()+t}.${n}`,{type:e.type,lastModified:e.lastModified}):e}function K(e){if(!a.autoUpload){const t=O(),n=e.filter(o=>$(o));if(!n.length)return;const i=a.multiple?[...t,...n].slice(0,a.limit):n.slice(-1);s.value=R(i),z(i);return}for(let t=0;t<e.length;t++){const n=De(e[t],t);if(!oe(n))continue;const i=Date.now()+t,o=URL.createObjectURL(n);q.add(o),s.value.push({uid:i,name:n.name||`file-${i}`,status:"uploading",percentage:0,url:o}),ie(n,d=>{const p=s.value.find(c=>c.uid===i);p&&(p.percentage=d.percent)},d=>{const p=s.value.find(c=>c.uid===i);p&&(p.status="success",p.url=d.url,F(),u("success",d))},()=>ze(i))}}function Te(e){const t=e.target,n=Array.from(t.files||[]);if(t.value="",a.disabled||!n.length)return;const i=a.supportVideo||!a.multiple?n.slice(0,1):n;K(i)}function je(e){const t=Array.from((e==null?void 0:e.files)||[]).filter(d=>{var p;return(p=d.type)==null?void 0:p.startsWith("image/")});if(t.length)return t;const n=e==null?void 0:e.items;if(!n)return[];const i=[],o=new Set;for(let d=0;d<n.length;d++){const p=n[d];if(p.kind==="file"&&p.type.startsWith("image/")){const c=p.getAsFile();c&&!o.has(c)&&(o.add(c),i.push(c))}}return i}function M(e){if(a.disabled)return;const t=je(e.clipboardData);t.length&&(e.preventDefault(),K(t))}function re(){a.disabled||a.disableDrag||(D.value=!0)}function se(){D.value=!1}function ue(e){var n;if(D.value=!1,a.disabled||a.disableDrag||j.value)return;const t=Array.from(((n=e.dataTransfer)==null?void 0:n.files)||[]);t.length&&K(t)}function ze(e){var n;const t=s.value.findIndex(i=>i.uid===e);t!==-1&&((n=s.value[t].url)!=null&&n.startsWith("blob:")&&(URL.revokeObjectURL(s.value[t].url),q.delete(s.value[t].url)),s.value.splice(t,1))}l.onBeforeUnmount(()=>{U.forEach(e=>e.abort()),U.length=0,q.forEach(e=>URL.revokeObjectURL(e)),q.clear()});function W(){var e;a.disabled||j.value||(e=y.value)==null||e.click()}function Ee(){s.value=[],h.value="",z([]),a.autoUpload&&F()}return x({openFileDialog:W,getPathList:()=>s.value.filter(e=>e.status==="success").map(e=>e.url),clearFiles:Ee,getValue:()=>({files:s.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:h.value}),getModelValue:()=>te({files:s.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:h.value})}),(e,t)=>{var N;const n=C.ElIcon,i=C.ElInput,o=C.ElPopover,d=C.ElUpload,p=C.ElImageViewer,c=C.ElDialog;return l.openBlock(),l.createElementBlock("div",{ref_key:"rootRef",ref:f,class:l.normalizeClass(["qy-upload",ye.value]),style:l.normalizeStyle({"--qy-upload-size":pe.value})},[l.createElementVNode("input",{ref_key:"nativeInputRef",ref:y,class:"qy-upload__native-input",type:"file",accept:Y.value,multiple:r.supportVideo?!1:r.multiple,disabled:T.value,onChange:Te},null,40,_e),l.createVNode(d,{ref_key:"uploadRef",ref:V,"file-list":s.value,"onUpdate:fileList":t[7]||(t[7]=v=>s.value=v),action:"#",multiple:r.supportVideo?!1:r.multiple,limit:ve.value,"auto-upload":r.autoUpload,"list-type":me.value,accept:Y.value,disabled:T.value,"http-request":Ne,"before-upload":oe,"on-change":Ve,"on-preview":Se,"on-remove":Ce},l.createSlots({default:l.withCtx(()=>[r.variant!=="file-list"&&!j.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["qy-upload__trigger",{"is-dragover":D.value}]),onPaste:M,onDragover:l.withModifiers(re,["prevent"]),onDragleave:l.withModifiers(se,["prevent"]),onDrop:l.withModifiers(ue,["prevent"])},[l.createVNode(n,{class:"qy-upload__icon"},{default:l.withCtx(()=>[l.createVNode(l.unref(de.Plus))]),_:1}),r.supportVideo?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[t[10]||(t[10]=l.createElementVNode("span",{class:"qy-upload__label"},"点击上传视频",-1)),l.createElementVNode("span",$e,"支持 "+l.toDisplayString(w.value.join(" / "))+",不超过 "+l.toDisplayString(r.fileSize)+"MB",1)],64)):l.createCommentVNode("",!0),r.showText?(l.openBlock(),l.createElementBlock("div",{key:1,class:"qy-upload__text",onClick:t[4]||(t[4]=l.withModifiers(()=>{},["stop"])),onPaste:l.withModifiers(M,["stop"])},[l.createVNode(o,{visible:_.value,"onUpdate:visible":t[3]||(t[3]=v=>_.value=v),placement:"bottom-start",width:220,trigger:"click","popper-class":"qy-upload__text-popover",onAfterEnter:be},{reference:l.withCtx(()=>[l.createElementVNode("div",{class:l.normalizeClass(["qy-upload__text-preview",{"is-placeholder":!h.value}])},l.toDisplayString(h.value||r.pastePlaceholder),3)]),default:l.withCtx(()=>[l.createVNode(i,{ref_key:"inputRef",ref:S,modelValue:h.value,"onUpdate:modelValue":t[1]||(t[1]=v=>h.value=v),type:"textarea",autosize:{minRows:2,maxRows:5},placeholder:r.pastePlaceholder,disabled:r.disabled,onBlur:t[2]||(t[2]=v=>_.value=!1),onPaste:l.withModifiers(M,["stop"])},null,8,["modelValue","placeholder","disabled"])]),_:1},8,["visible"])],32)):r.showPasteInput?(l.openBlock(),l.createElementBlock("div",{key:2,class:"qy-upload__text",onClick:t[6]||(t[6]=l.withModifiers(()=>{},["stop"])),onPaste:l.withModifiers(M,["stop"])},[l.createElementVNode("input",{ref_key:"pasteInputRef",ref:b,class:"qy-upload__paste-input",placeholder:r.pastePlaceholder,disabled:r.disabled,onPaste:l.withModifiers(M,["stop"]),onInput:Ue,onClick:t[5]||(t[5]=l.withModifiers(()=>{},["stop"]))},null,40,Ke)],32)):l.createCommentVNode("",!0)],34)):l.createCommentVNode("",!0)]),_:2},[r.variant==="file-list"?{name:"trigger",fn:l.withCtx(()=>[l.createElementVNode("div",{class:"qy-upload__file-trigger",onClick:t[0]||(t[0]=l.withModifiers(()=>{},["stop"])),onDragover:l.withModifiers(re,["prevent"]),onDragleave:l.withModifiers(se,["prevent"]),onDrop:l.withModifiers(ue,["prevent"])},[l.renderSlot(e.$slots,"trigger",{open:W,disabled:T.value,uploading:fe.value},()=>[l.createElementVNode("button",{class:"qy-upload__file-button",type:"button",disabled:T.value,onClick:W}," 选择文件 ",8,Oe)],!0)],32)]),key:"0"}:void 0]),1032,["file-list","multiple","limit","auto-upload","list-type","accept","disabled"]),A.value?(l.openBlock(),l.createBlock(p,{key:0,"url-list":P.value,"initial-index":J.value,onClose:qe},null,8,["url-list","initial-index"])):l.createCommentVNode("",!0),l.createVNode(c,{modelValue:B.value,"onUpdate:modelValue":t[8]||(t[8]=v=>B.value=v),title:G.value,width:"640px","append-to-body":"","destroy-on-close":"",onClose:t[9]||(t[9]=v=>B.value=!1)},{default:l.withCtx(()=>[B.value?(l.openBlock(),l.createElementBlock("video",{key:0,src:Q.value,controls:"",autoplay:"",style:{width:"100%","max-height":"400px","border-radius":"4px"}},null,8,We)):l.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),ge.value?(l.openBlock(),l.createElementBlock("div",He,[l.createVNode(n,null,{default:l.withCtx(()=>[l.createVNode(l.unref(de.InfoFilled))]),_:1}),l.createElementVNode("span",null,[t[13]||(t[13]=l.createTextVNode(" 请上传 ",-1)),r.fileSize?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[t[11]||(t[11]=l.createTextVNode("大小不超过 ",-1)),l.createElementVNode("b",Xe,l.toDisplayString(r.fileSize)+"MB",1)],64)):l.createCommentVNode("",!0),(N=w.value)!=null&&N.length?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[t[12]||(t[12]=l.createTextVNode(",格式为 ",-1)),l.createElementVNode("b",Je,l.toDisplayString(w.value.join("/")),1)],64)):l.createCommentVNode("",!0),t[14]||(t[14]=l.createTextVNode(" 的文件。 ",-1))])])):l.createCommentVNode("",!0)],6)}}}),Ge=Le._export_sfc(Qe,[["__scopeId","data-v-a8b769c6"]]);exports.Upload=Ge;exports.api=ce;
@@ -1,157 +0,0 @@
1
- import { defineComponent as S, computed as i, ref as y, onMounted as k, onUpdated as E, openBlock as x, createElementBlock as C, createVNode as P, unref as h, withCtx as O, createElementVNode as b, toDisplayString as _, createCommentVNode as M } from "vue";
2
- import { ElConfigProvider as R, ElPagination as U } from "element-plus";
3
- import A from "element-plus/es/locale/lang/zh-cn";
4
- import { _ as I } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
5
- const V = /* @__PURE__ */ S({
6
- __name: "ElementPaginationRenderer",
7
- props: {
8
- total: {},
9
- currentPage: {},
10
- pageSize: {},
11
- pageSizes: {},
12
- disabled: { type: Boolean, default: !1 },
13
- loading: { type: Boolean, default: !1 }
14
- },
15
- emits: ["page-change", "page-size-change"],
16
- setup(s, { emit: z }) {
17
- const a = s, p = z, g = i(() => a.disabled || a.loading), d = i(
18
- () => a.pageSizes.length > 1 ? "sizes, prev, pager, next" : "prev, pager, next"
19
- ), l = y(null), v = y(null);
20
- let r = 0;
21
- function c() {
22
- var t, u;
23
- (u = (t = v.value) == null ? void 0 : t.querySelector('.el-pagination__sizes [role="combobox"]')) == null || u.setAttribute("aria-label", "每页条数");
24
- }
25
- k(c), E(c);
26
- function f(t) {
27
- if (!g.value) {
28
- if (l.value !== null) {
29
- l.value = null;
30
- return;
31
- }
32
- t !== a.currentPage && p("page-change", t);
33
- }
34
- }
35
- function m(t) {
36
- if (g.value)
37
- return;
38
- l.value = t;
39
- const u = ++r;
40
- Promise.resolve().then(() => {
41
- r === u && (l.value = null);
42
- }), p("page-size-change", t);
43
- }
44
- return (t, u) => (x(), C("div", {
45
- ref_key: "rendererRef",
46
- ref: v,
47
- class: "qy-pagination-element-renderer",
48
- "data-testid": "qy-pagination-element-renderer"
49
- }, [
50
- P(h(R), { locale: h(A) }, {
51
- default: O(() => [
52
- P(h(U), {
53
- layout: d.value,
54
- total: s.total,
55
- "current-page": s.currentPage,
56
- "page-size": s.pageSize,
57
- "page-sizes": [...s.pageSizes],
58
- "pager-count": 7,
59
- disabled: g.value,
60
- teleported: !1,
61
- "onUpdate:currentPage": f,
62
- "onUpdate:pageSize": m
63
- }, null, 8, ["layout", "total", "current-page", "page-size", "page-sizes", "disabled"])
64
- ]),
65
- _: 1
66
- }, 8, ["locale"])
67
- ], 512));
68
- }
69
- }), w = /* @__PURE__ */ I(V, [["__scopeId", "data-v-a27b6aaa"]]), D = ["aria-busy"], T = { class: "qy-pagination__info" }, F = { class: "qy-pagination__total" }, L = { class: "qy-pagination__summary" }, $ = { class: "qy-pagination__controls" }, j = /* @__PURE__ */ S({
70
- __name: "index",
71
- props: {
72
- total: {},
73
- page: {},
74
- pageSize: {},
75
- pageSizeOptions: { default: () => [10, 20, 50] },
76
- hideOnSinglePage: { type: Boolean, default: !1 },
77
- disabled: { type: Boolean },
78
- loading: { type: Boolean },
79
- binding: {}
80
- },
81
- emits: ["page-change", "page-size-change"],
82
- setup(s, { emit: z }) {
83
- const a = s, p = z;
84
- function g(e, n) {
85
- const o = Number(e);
86
- return Number.isInteger(o) && o > 0 ? o : n;
87
- }
88
- const d = i(() => {
89
- var n;
90
- const e = Number(a.total ?? ((n = a.binding) == null ? void 0 : n.total) ?? 0);
91
- return Number.isFinite(e) && e >= 0 ? e : 0;
92
- }), l = i(
93
- () => {
94
- var e;
95
- return g(a.pageSize ?? ((e = a.binding) == null ? void 0 : e.pageSize), 10);
96
- }
97
- ), v = i(() => {
98
- const n = (Array.isArray(a.pageSizeOptions) ? a.pageSizeOptions : []).map((o) => Number(o)).filter((o) => Number.isInteger(o) && o > 0);
99
- return [.../* @__PURE__ */ new Set([...n, l.value])].sort(
100
- (o, B) => o - B
101
- );
102
- }), r = i(
103
- () => Math.max(1, Math.ceil(d.value / l.value))
104
- ), c = i(
105
- () => {
106
- var e;
107
- return Math.min(
108
- Math.max(1, g(a.page ?? ((e = a.binding) == null ? void 0 : e.page), 1)),
109
- r.value
110
- );
111
- }
112
- ), f = i(() => {
113
- var e;
114
- return !!(a.disabled ?? ((e = a.binding) == null ? void 0 : e.disabled));
115
- }), m = i(() => {
116
- var e;
117
- return !!(a.loading ?? ((e = a.binding) == null ? void 0 : e.loading));
118
- }), t = i(() => f.value || m.value), u = i(
119
- () => d.value > 0 && (!a.hideOnSinglePage || r.value > 1)
120
- );
121
- function N(e) {
122
- var n;
123
- t.value || !Number.isInteger(e) || e < 1 || e > r.value || e === c.value || ((n = a.binding) == null || n.setPage(e), p("page-change", e));
124
- }
125
- function q(e) {
126
- var n;
127
- t.value || !Number.isInteger(e) || e <= 0 || e === l.value || ((n = a.binding) == null || n.setPageSize(e), p("page-size-change", e));
128
- }
129
- return (e, n) => u.value ? (x(), C("nav", {
130
- key: 0,
131
- class: "qy-pagination",
132
- "data-testid": "qy-pagination",
133
- "aria-label": "分页",
134
- "aria-busy": m.value ? "true" : void 0
135
- }, [
136
- b("div", T, [
137
- b("span", F, "共 " + _(d.value) + " 条", 1),
138
- b("span", L, " 第 " + _(c.value) + " / " + _(r.value) + " 页 ", 1)
139
- ]),
140
- b("div", $, [
141
- P(w, {
142
- total: d.value,
143
- "current-page": c.value,
144
- "page-size": l.value,
145
- "page-sizes": v.value,
146
- disabled: f.value,
147
- loading: m.value,
148
- onPageChange: N,
149
- onPageSizeChange: q
150
- }, null, 8, ["total", "current-page", "page-size", "page-sizes", "disabled", "loading"])
151
- ])
152
- ], 8, D)) : M("", !0);
153
- }
154
- }), Q = /* @__PURE__ */ I(j, [["__scopeId", "data-v-b58990f5"]]);
155
- export {
156
- Q as P
157
- };
@@ -1 +0,0 @@
1
- "use strict";const R=require("element-plus"),e=require("vue"),le=require("clsx"),U=require("element-plus"),ne=require("@element-plus/icons-vue"),W=require("@vueuse/core"),ae={class:"text-lg flex items-center pt-2 pl-[var(--content-padding)]"},re={key:0},ie={key:1},se={key:0,class:"icon-[material-symbols--square-outline-rounded]",role:"img","aria-hidden":"true"},de={key:1,class:"icon-[tdesign--fullscreen-exit-1]",role:"img","aria-hidden":"true"},ce={key:0,class:"fixed -right-12 top-2 h-9 w-9 hover:bg-gray-600/80 transition-all"},ue={class:"flex justify-between h-[var(--footer-height)] px-[var(--content-padding)] items-center"},fe={class:"flex items-center justify-between w-full pl-1 pr-4 h-full ml-2"},me={class:"flex items-center gap-2"},pe={class:"text-sm text-gray-700 truncate max-w-[200px]"},ye={class:"flex items-center gap-2"},X=5,M=2e3,ge=e.defineComponent({inheritAttrs:!1,__name:"index",props:{open:{type:Boolean,default:!1},title:{default:""},width:{default:"50%"},showFooter:{type:Boolean,default:!0},showConfirm:{type:Boolean,default:!0},showCancel:{type:Boolean,default:!0},confirmText:{default:"确 认"},cancelText:{default:"取 消"},confirmLoading:{type:Boolean,default:!1},confirmDisabled:{type:Boolean,default:!1},closeOnConfirm:{type:Boolean,default:!1},closeOnEscape:{type:Boolean,default:!0},closeOnOverlay:{type:Boolean,default:!0},minimizable:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},top:{default:"15vh"},fullscreen:{type:Boolean,default:!1},showFullscreen:{type:Boolean,default:!1},size:{default:"default"},zIndex:{default:2e3}},emits:["update:open","open-change","confirm","cancel","close","opened","closed"],setup(K,{expose:P,emit:Y}){let d=0;const l=K,E=e.useSlots(),S=e.ref(!0),C=e.ref(!1),q=e.ref(M),N=e.ref(null),G=W.useBreakpoints({mobile:0,tablet:640,laptop:1024,desktop:1280}).isSmaller("tablet"),B=e.computed(()=>{const t=[];return l.showCancel&&t.push("cancel"),l.showConfirm&&t.push("confirm"),t}),V=e.computed(()=>({CancelButton:e.createVNode(Z),ConfirmButton:e.createVNode(T)})),I=e.computed(()=>!!(E.footer||l.showFooter)),m=e.ref(!1),g=e.ref(!1);let b=!1,p=document.activeElement instanceof HTMLElement?document.activeElement:null;const v=e.ref(l.showFullscreen&&G?!0:l.fullscreen),r=Y,D=e.computed(()=>l.open);e.watchEffect(()=>{D.value&&(m.value=!1)}),e.watch(()=>l.open,(t,o)=>{if(t){m.value=!1,g.value=!1,p=document.activeElement instanceof HTMLElement?document.activeElement:p,o===!1&&r("open-change",!0);return}o&&!m.value&&(m.value=!0,r("open-change",!1),r("close","external"))}),e.watch(()=>l.confirmLoading,t=>{t?b=!0:b&&(b=!1,g.value=!1)}),P({handleMinimize:z});const c=`qy-dialog-${Math.random().toString(36).slice(2,11)}`,y=e.ref(!1);let h=!1;const w=e.ref(null),{x:L,y:_}=W.useDraggable(w,{initialValue:{x:5,y:window.innerHeight-100-d*60},onMove(t){var o;(o=w.value)==null||o.classList.add("dragging"),document.body.classList.add("qy-dialog--dragging"),L.value=Math.max(0,Math.min(window.innerWidth-300,t.x)),_.value=Math.max(0,Math.min(window.innerHeight-50,t.y))},onEnd(){var t;(t=w.value)==null||t.classList.remove("dragging"),document.body.classList.remove("qy-dialog--dragging")}}),J=e.computed(()=>({transform:`translate(${L.value}px, ${_.value}px)`,willChange:"transform"}));function O(t){const o=t.target,{scrollTop:n,scrollHeight:i,clientHeight:s}=o;S.value=n<=X,C.value=i-(n+s)<=X}function Q(){const t=document.querySelector(`.${c}.el-dialog`);t&&(N.value=t,t.addEventListener("scroll",O)),x(),r("opened")}function $(){v.value=!v.value,x()}function u(t){l.confirmLoading&&t!=="external"||m.value||(m.value=!0,j(),r("update:open",!1),r("open-change",!1),(t==="cancel"||t==="header")&&r("cancel"),r("close",t))}function ee(){r("closed"),e.nextTick(()=>{p!=null&&p.isConnected&&p.focus()})}function te(t){l.showFullscreen&&t.detail>=2&&$()}function T(){return e.h(U.ElButton,{type:"primary",class:"dialog__footerBtn",loading:l.confirmLoading,disabled:l.confirmDisabled||l.confirmLoading||g.value,onClick:oe},()=>l.confirmText)}function oe(){g.value||l.confirmLoading||l.confirmDisabled||(g.value=!0,r("confirm"),l.closeOnConfirm&&u("confirm"))}function Z(){return e.h(U.ElButton,{class:"dialog__footerBtn",onClick:()=>u("cancel")},()=>l.cancelText)}e.onMounted(()=>{typeof window.qyDialogMaxZIndex>"u"&&(window.qyDialogMaxZIndex=M),x(),document.addEventListener("keydown",A),document.addEventListener("mousedown",F,!0)});function H(){var i,s;const t=(i=document.querySelector(`.${c}`))==null?void 0:i.closest(".el-overlay");if(!t)return!1;const n=Array.from(document.querySelectorAll(".el-overlay")).filter(a=>window.getComputedStyle(a).display!=="none").map((a,f)=>({overlay:a,order:f,zIndex:Number.parseInt(window.getComputedStyle(a).zIndex||"0",10)}));return n.sort((a,f)=>a.zIndex-f.zIndex||a.order-f.order),((s=n.at(-1))==null?void 0:s.overlay)===t}function A(t){t.key!=="Escape"||!l.open||!l.closeOnEscape||l.confirmLoading||!H()||(t.preventDefault(),u("escape"))}function F(t){if(!l.open||!l.closeOnOverlay||l.confirmLoading||!H()||!(t.target instanceof Node))return;const o=document.querySelector(`.${c}.el-dialog`),n=o==null?void 0:o.closest(".el-overlay");!o||!n||!n.contains(t.target)||o.contains(t.target)||u("overlay")}function x(){var f;const t=Array.from(document.querySelectorAll(".el-overlay")).filter(k=>window.getComputedStyle(k).display!=="none"&&!k.classList.contains("is-message")),o=(f=document.querySelector(`.${c}`))==null?void 0:f.closest(".el-overlay"),n=document.querySelector(`.${c}.el-dialog`);if(!o||!n)return;const i=M;window.qyDialogMaxZIndex=window.qyDialogMaxZIndex||i;const a=Math.max(window.qyDialogMaxZIndex,...t.map(k=>parseInt(window.getComputedStyle(k).zIndex||i.toString())))+2;window.qyDialogMaxZIndex=a,e.nextTick(()=>{o.style.zIndex=a.toString(),n.style.zIndex=(a+1).toString(),q.value=a+1})}e.onUnmounted(()=>{var t;document.removeEventListener("keydown",A),document.removeEventListener("mousedown",F,!0),(t=N.value)==null||t.removeEventListener("scroll",O),j()});function j(){if(!h){y.value=!1;return}h=!1,d=Math.max(0,d-1),y.value=!1}function z(){var o;const t=(o=document.querySelector(`.${c}`))==null?void 0:o.closest(".el-overlay");!t||!l.open||(y.value?(y.value=!1,t.style.display="block",h&&(h=!1,d=Math.max(0,d-1)),x()):(y.value=!0,t.style.display="none",h=!0,d+=1,_.value=window.innerHeight-50-d*60))}return(t,o)=>{const n=R.ElIcon,i=R.ElDialog;return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(i,{ref:"dialogRef",class:e.normalizeClass(["qy-dialog",[l.size==="small"&&"[&_.el-dialog__header]:!hidden",c]]),"model-value":D.value,title:l.title,width:l.width,top:l.top,"align-center":"","append-to-body":"","destroy-on-close":l.destroyOnClose,"lock-scroll":l.lockScroll,style:{"--el-dialog-padding-primary":0},"show-close":!1,"close-on-press-escape":!1,"close-on-click-modal":!1,fullscreen:v.value,"z-index":q.value,onClosed:ee,onOpened:Q,draggable:l.draggable},e.createSlots({header:e.withCtx(()=>[l.size==="default"?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({borderBottom:"1px solid",borderColor:S.value?"transparent":"var(--block-outline-color)",transition:"border-color .2s linear"}),class:"flex justify-between h-[var(--header-height)]",onDblclick:te},[e.createElementVNode("div",ae,[e.unref(E).header?e.unref(E).header?(e.openBlock(),e.createElementBlock("div",ie,[e.renderSlot(t.$slots,"header")])):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",re,e.toDisplayString(l.title),1))]),e.createElementVNode("div",{class:"flex",onMousedown:o[4]||(o[4]=e.withModifiers(()=>{},["stop"]))},[l.size==="default"&&l.minimizable?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qy-dialog__btn qy-dialog__btn--default",onClick:e.withModifiers(z,["stop"]),onMousedown:o[0]||(o[0]=e.withModifiers(()=>{},["stop"]))},[...o[7]||(o[7]=[e.createElementVNode("span",{class:"icon-[material-symbols--minimize] text-xl mb-3",role:"img","aria-hidden":"true"},null,-1)])],32)):e.createCommentVNode("",!0),l.showFullscreen?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qy-dialog__btn qy-dialog__btn--default",onClick:e.withModifiers($,["stop"]),onMousedown:o[1]||(o[1]=e.withModifiers(()=>{},["stop"]))},[v.value?(e.openBlock(),e.createElementBlock("span",de)):(e.openBlock(),e.createElementBlock("span",se))],32)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"qy-dialog__btn qy-dialog__btn--danger",onClick:o[2]||(o[2]=e.withModifiers(s=>u("header"),["stop"])),onMousedown:o[3]||(o[3]=e.withModifiers(()=>{},["stop"]))},[...o[8]||(o[8]=[e.createElementVNode("span",{class:"icon-[ri--close-line] text-xl",role:"img","aria-hidden":"true"},null,-1)])],32)],32)],36)):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["qy-dialog__wrapper",e.unref(le)(v.value&&"qy-dialog__wrapper--fullscreen")]),style:e.normalizeStyle({maxHeight:I.value?"calc(100vh - var(--header-height) - var(--footer-height) - var(--sides-gap))":"calc(100vh - var(--header-height) - var(--sides-gap))",padding:l.size==="small"?"var(--small-content-padding)":"var(--content-padding)"})},[l.size==="small"?(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(n,{size:36,class:"cursor-pointer text-gray-100 active:scale-75 rounded-sm transition-all",onClick:o[5]||(o[5]=s=>u("header"))},{default:e.withCtx(()=>[e.createVNode(e.unref(ne.Close))]),_:1})])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default")],6)]),_:2},[l.showFooter&&!t.$slots.footer&&Array.isArray(B.value)?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",null,[e.renderSlot(t.$slots,"footer-left")]),e.createElementVNode("div",{class:e.normalizeClass([{"qy-dialog__footer--outline":C.value},"qy-dialog__footer flex items-center justify-end"])},[B.value.includes("cancel")?(e.openBlock(),e.createBlock(Z,{key:0})):e.createCommentVNode("",!0),B.value.includes("confirm")?(e.openBlock(),e.createBlock(T,{key:1})):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"footer-append")],2)])]),key:"0"}:I.value?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([{"qy-dialog__footer--outline":C.value},"qy-dialog__footer px-[var(--content-padding)] min-h-[var(--footer-height)] flex items-center justify-end"])},[e.renderSlot(t.$slots,"footer",{layouts:V.value,layoutsNode:Object.values(V.value)})],2)]),key:"1"}:void 0]),1032,["class","model-value","title","width","top","destroy-on-close","lock-scroll","fullscreen","z-index","draggable"]),e.withDirectives(e.createElementVNode("div",{ref_key:"minimizedRef",ref:w,class:"fixed left-0 top-0 bg-white rounded shadow-lg cursor-pointer z-[9999] hover:bg-gray-50",style:e.normalizeStyle([J.value,{width:"300px",height:"50px","will-change":"transform"}])},[e.createElementVNode("div",fe,[e.createElementVNode("div",me,[o[9]||(o[9]=e.createElementVNode("div",{class:"icon-[mdi--window-restore] text-gray-600"},null,-1)),e.createElementVNode("span",pe,e.toDisplayString(l.title),1)]),e.createElementVNode("div",ye,[e.createElementVNode("div",{class:"p-1 hover:bg-gray-200 rounded",onClick:e.withModifiers(z,["stop"])},[...o[10]||(o[10]=[e.createElementVNode("div",{class:"icon-[mdi--window-maximize] text-gray-600"},null,-1)])]),e.createElementVNode("div",{class:"p-1 hover:bg-red-100 rounded",onClick:o[6]||(o[6]=e.withModifiers(s=>u("header"),["stop"]))},[...o[11]||(o[11]=[e.createElementVNode("div",{class:"icon-[mdi--close] text-red-600"},null,-1)])])])])],4),[[e.vShow,y.value]])])}}});exports._sfc_main=ge;