@qynpm/ui 1.0.42 → 1.0.43

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 (35) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.mjs +1 -1
  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-form-section/index.cjs +1 -1
  9. package/dist/qy-form-section/index.mjs +1 -1
  10. package/dist/qy-image-upload/index.cjs +1 -1
  11. package/dist/qy-image-upload/index.mjs +1 -1
  12. package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
  13. package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
  14. package/dist/qy-pagination/index.cjs +1 -1
  15. package/dist/qy-pagination/index.mjs +1 -1
  16. package/dist/qy-record-quote-search/index.cjs +1 -1
  17. package/dist/qy-record-quote-search/index.mjs +1 -1
  18. package/dist/qy-remark-image/index.cjs +1 -1
  19. package/dist/qy-remark-image/index.mjs +1 -1
  20. package/dist/qy-remote-select/index.cjs +1 -1
  21. package/dist/qy-remote-select/index.mjs +1 -1
  22. package/dist/qy-search-input/index.cjs +1 -1
  23. package/dist/qy-search-input/index.mjs +1 -1
  24. package/dist/qy-selection-dialog/index.cjs +1 -1
  25. package/dist/qy-selection-dialog/index.mjs +1 -1
  26. package/dist/shared/{index-QewoB6N4.mjs → index-7MG12FbD.mjs} +2 -2
  27. package/dist/shared/index-C4F8hXzQ.mjs +338 -0
  28. package/dist/shared/{index-BPnHycGa.cjs → index-CbNd9JEx.cjs} +1 -1
  29. package/dist/shared/index-CmgTSaFS.cjs +1 -0
  30. 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
  31. package/dist/shared/index.vue_vue_type_style_index_0_lang-D9-2GN18.cjs +1 -0
  32. package/package.json +1 -1
  33. package/dist/shared/index-DuP-b_eY.cjs +0 -1
  34. package/dist/shared/index-zo5J-y0C.mjs +0 -157
  35. 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.43",
4
4
  "description": "起印公共 UI 组件包。",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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,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;