@qynpm/ui 1.0.43 → 1.0.45

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 (185) hide show
  1. package/README.md +2 -0
  2. package/dist/index.cjs +12 -12
  3. package/dist/index.mjs +13 -13
  4. package/dist/qy-action-bar/index.cjs +1 -1
  5. package/dist/qy-action-bar/index.mjs +1 -1
  6. package/dist/qy-autocomplete/index.cjs +1 -1
  7. package/dist/qy-autocomplete/index.mjs +1 -1
  8. package/dist/qy-checkbox/index.cjs +1 -1
  9. package/dist/qy-checkbox/index.mjs +1 -1
  10. package/dist/qy-checkbox-group/index.cjs +1 -1
  11. package/dist/qy-checkbox-group/index.mjs +1 -1
  12. package/dist/qy-color-picker/index.cjs +1 -1
  13. package/dist/qy-color-picker/index.mjs +1 -1
  14. package/dist/qy-date-picker/index.cjs +1 -1
  15. package/dist/qy-date-picker/index.mjs +1 -1
  16. package/dist/qy-dialog/index.cjs +1 -1
  17. package/dist/qy-dialog/index.mjs +1 -1
  18. package/dist/qy-dropdown/index.cjs +2 -2
  19. package/dist/qy-dropdown/index.mjs +2 -2
  20. package/dist/qy-file-picker/index.cjs +1 -1
  21. package/dist/qy-file-picker/index.mjs +1 -1
  22. package/dist/qy-form-section/index.cjs +1 -1
  23. package/dist/qy-form-section/index.mjs +1 -1
  24. package/dist/qy-image/index.cjs +1 -1
  25. package/dist/qy-image/index.mjs +1 -1
  26. package/dist/qy-image-preview/index.cjs +1 -1
  27. package/dist/qy-image-preview/index.mjs +2 -2
  28. package/dist/qy-image-upload/index.cjs +1 -1
  29. package/dist/qy-image-upload/index.mjs +1 -1
  30. package/dist/qy-input-tag/index.cjs +1 -1
  31. package/dist/qy-input-tag/index.mjs +1 -1
  32. package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
  33. package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
  34. package/dist/qy-menu-actions/index.cjs +1 -1
  35. package/dist/qy-menu-actions/index.mjs +1 -1
  36. package/dist/qy-money-input/index.cjs +1 -1
  37. package/dist/qy-money-input/index.mjs +1 -1
  38. package/dist/qy-pagination/index.cjs +1 -1
  39. package/dist/qy-pagination/index.mjs +1 -1
  40. package/dist/qy-popconfirm/index.cjs +1 -1
  41. package/dist/qy-popconfirm/index.mjs +1 -1
  42. package/dist/qy-popover/index.cjs +1 -1
  43. package/dist/qy-popover/index.mjs +1 -1
  44. package/dist/qy-radio/index.cjs +1 -1
  45. package/dist/qy-radio/index.mjs +1 -1
  46. package/dist/qy-radio-group/index.cjs +1 -1
  47. package/dist/qy-radio-group/index.mjs +1 -1
  48. package/dist/qy-record-quote-search/index.cjs +1 -1
  49. package/dist/qy-record-quote-search/index.mjs +1 -1
  50. package/dist/qy-remark-image/index.cjs +1 -1
  51. package/dist/qy-remark-image/index.mjs +1 -1
  52. package/dist/qy-remote-select/index.cjs +1 -1
  53. package/dist/qy-remote-select/index.mjs +1 -1
  54. package/dist/qy-search-input/index.cjs +1 -1
  55. package/dist/qy-search-input/index.mjs +1 -1
  56. package/dist/qy-select/index.cjs +1 -1
  57. package/dist/qy-select/index.mjs +1 -1
  58. package/dist/qy-selection-dialog/index.cjs +1 -1
  59. package/dist/qy-selection-dialog/index.mjs +1 -1
  60. package/dist/qy-switch/index.cjs +1 -1
  61. package/dist/qy-switch/index.mjs +1 -1
  62. package/dist/qy-table-column-settings/index.cjs +1 -1
  63. package/dist/qy-table-column-settings/index.mjs +1 -1
  64. package/dist/qy-tooltip/index.cjs +1 -1
  65. package/dist/qy-tooltip/index.mjs +1 -1
  66. package/dist/qy-tree-select/index.cjs +1 -1
  67. package/dist/qy-tree-select/index.mjs +1 -1
  68. package/dist/qy-upload/index.cjs +1 -1
  69. package/dist/qy-upload/index.mjs +1 -1
  70. package/dist/shared/{index-BNssRW4d.mjs → index-9G8dxxVx.mjs} +13 -13
  71. package/dist/shared/{index-DRIoLeFE.mjs → index-B1gnVI8Y.mjs} +44 -45
  72. package/dist/shared/{index-CiE6qJCJ.mjs → index-BcDt1tKY.mjs} +151 -143
  73. package/dist/shared/index-BfA7ZJnJ.cjs +1 -0
  74. package/dist/shared/index-BfXhDFFn.cjs +1 -0
  75. package/dist/shared/index-Bfmf0msc.mjs +71 -0
  76. package/dist/shared/index-BhpomD_C.cjs +1 -0
  77. package/dist/shared/index-BvXyRAhX.cjs +1 -0
  78. package/dist/shared/index-Bz9WjKdL.cjs +1 -0
  79. package/dist/shared/{index-Co84fsS5.mjs → index-C5hzCMaD.mjs} +88 -80
  80. package/dist/shared/index-CPW3gKgP.mjs +2429 -0
  81. package/dist/shared/index-CUwUz-Le.cjs +1 -0
  82. package/dist/shared/index-CjImIyvI.mjs +124 -0
  83. package/dist/shared/{index-gMrQlV5n.cjs → index-CsfcDlq4.cjs} +1 -1
  84. package/dist/shared/{index-DAztNKSp.cjs → index-D359jZg_.cjs} +1 -1
  85. package/dist/shared/{index-DvFMgAcu.mjs → index-DEoy2IfN.mjs} +1 -1
  86. package/dist/shared/{index-BjqJCq-6.mjs → index-DM0zanTb.mjs} +3 -3
  87. package/dist/shared/index-DOpfxPDq.cjs +1 -0
  88. package/dist/shared/index-DPqFEuPp.mjs +798 -0
  89. package/dist/shared/index-DWBkjY5O.cjs +1 -0
  90. package/dist/shared/index-DaUdmOjn.cjs +1 -0
  91. package/dist/shared/index-MEzLM_rM.cjs +1 -0
  92. package/dist/shared/index-MyPNS-OR.cjs +1 -0
  93. package/dist/shared/{index-C4F8hXzQ.mjs → index-XSV-GmR2.mjs} +90 -81
  94. package/dist/shared/index-_e-HwHF0.mjs +79 -0
  95. package/dist/shared/{index-DXZ6Y6wd.mjs → index-uMEKxoXj.mjs} +1 -1
  96. package/dist/shared/index.vue_vue_type_script_setup_true_lang-B38X3tvf.cjs +1 -0
  97. package/dist/shared/index.vue_vue_type_script_setup_true_lang-BNKC9382.cjs +1 -0
  98. package/dist/shared/{index.vue_vue_type_script_setup_true_lang-DIWWHODS.mjs → index.vue_vue_type_script_setup_true_lang-BtMkNw_I.mjs} +49 -47
  99. package/dist/shared/index.vue_vue_type_script_setup_true_lang-Byp7e--Y.mjs +63 -0
  100. package/dist/shared/{index.vue_vue_type_script_setup_true_lang-Dn29lZTs.mjs → index.vue_vue_type_script_setup_true_lang-Bypkl4Ty.mjs} +20 -18
  101. package/dist/shared/index.vue_vue_type_script_setup_true_lang-CPm8gzId.cjs +1 -0
  102. package/dist/shared/index.vue_vue_type_script_setup_true_lang-CYaK3oDY.cjs +1 -0
  103. package/dist/shared/index.vue_vue_type_script_setup_true_lang-CeVvm5Ph.cjs +1 -0
  104. package/dist/shared/index.vue_vue_type_script_setup_true_lang-Cn0JqB5r.cjs +1 -0
  105. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DMHhx9lY.mjs +133 -0
  106. package/dist/shared/{index.vue_vue_type_script_setup_true_lang-DwFGEW4B.mjs → index.vue_vue_type_script_setup_true_lang-DkMm40Ac.mjs} +50 -42
  107. package/dist/shared/index.vue_vue_type_script_setup_true_lang-qXBKqHCs.mjs +40 -0
  108. package/dist/shared/index.vue_vue_type_style_index_0_lang-BI4abIsm.mjs +219 -0
  109. package/dist/shared/index.vue_vue_type_style_index_0_lang-BNBJu1Mq.cjs +1 -0
  110. package/dist/shared/index.vue_vue_type_style_index_0_lang-BZZ8vhEf.cjs +1 -0
  111. package/dist/shared/{index.vue_vue_type_style_index_0_lang-DSur831A.mjs → index.vue_vue_type_style_index_0_lang-Bpe6LkvL.mjs} +24 -18
  112. package/dist/shared/index.vue_vue_type_style_index_0_lang-CYIUfOy9.cjs +1 -0
  113. package/dist/shared/index.vue_vue_type_style_index_0_lang-D2iiEHqM.mjs +413 -0
  114. package/dist/shared/index.vue_vue_type_style_index_0_lang-Dt19xolk.cjs +1 -0
  115. package/dist/shared/index.vue_vue_type_style_index_0_lang-DzvboHR2.mjs +176 -0
  116. package/dist/shared/index.vue_vue_type_style_index_0_lang-E92uiH6Q.cjs +1 -0
  117. package/dist/shared/index.vue_vue_type_style_index_0_lang-W44zpeKW.cjs +1 -0
  118. package/dist/shared/{index.vue_vue_type_style_index_0_lang-CcVf5MXE.mjs → index.vue_vue_type_style_index_0_lang-shJS7iXC.mjs} +59 -57
  119. package/dist/shared/index.vue_vue_type_style_index_0_lang-z2Unl0WQ.mjs +142 -0
  120. package/dist/shared/overlay-stack-CFFRngnU.mjs +34 -0
  121. package/dist/shared/overlay-stack-DeKq7jZu.cjs +1 -0
  122. package/dist/shared/{utils-DoyI5oM8.mjs → utils-CUXINmHY.mjs} +63 -49
  123. package/dist/shared/utils-DpkN3Zat.cjs +1 -0
  124. package/index.d.ts +44 -12
  125. package/package.json +2 -3
  126. package/qy-action-bar/index.d.ts +16 -4
  127. package/qy-autocomplete/index.d.ts +43 -2
  128. package/qy-checkbox/index.d.ts +1 -0
  129. package/qy-checkbox-group/index.d.ts +1 -0
  130. package/qy-date-picker/index.d.ts +1 -0
  131. package/qy-dialog/index.d.ts +4 -0
  132. package/qy-form-section/index.d.ts +22 -4
  133. package/qy-image/index.d.ts +1 -0
  134. package/qy-image-preview/index.d.ts +8 -4
  135. package/qy-menu-actions/index.d.ts +21 -2
  136. package/qy-money-input/index.d.ts +1 -0
  137. package/qy-pagination/index.d.ts +4 -0
  138. package/qy-popover/index.d.ts +4 -0
  139. package/qy-radio-group/index.d.ts +1 -0
  140. package/qy-record-quote-search/index.d.ts +53 -4
  141. package/qy-remark-image/index.d.ts +44 -4
  142. package/qy-remote-select/index.d.ts +53 -2
  143. package/qy-search-input/index.d.ts +66 -4
  144. package/qy-select/index.d.ts +4 -0
  145. package/qy-selection-dialog/index.d.ts +63 -2
  146. package/qy-switch/index.d.ts +1 -0
  147. package/qy-table-column-settings/index.d.ts +19 -2
  148. package/qy-tooltip/index.d.ts +5 -0
  149. package/qy-tree-select/index.d.ts +1 -0
  150. package/dist/shared/index-7MG12FbD.mjs +0 -2362
  151. package/dist/shared/index-BEcS8y8g.mjs +0 -68
  152. package/dist/shared/index-BSTMCPDj.mjs +0 -72
  153. package/dist/shared/index-BhvOSOfi.mjs +0 -766
  154. package/dist/shared/index-CGq7Q_hV.mjs +0 -119
  155. package/dist/shared/index-CVYNG8Fc.cjs +0 -1
  156. package/dist/shared/index-CbNd9JEx.cjs +0 -1
  157. package/dist/shared/index-CmgTSaFS.cjs +0 -1
  158. package/dist/shared/index-CnVhquq5.cjs +0 -1
  159. package/dist/shared/index-D27mwR57.cjs +0 -1
  160. package/dist/shared/index-DKw-seoh.cjs +0 -1
  161. package/dist/shared/index-DRugp8x0.cjs +0 -1
  162. package/dist/shared/index-DTbGlDqr.cjs +0 -1
  163. package/dist/shared/index-MyDDX-zj.cjs +0 -1
  164. package/dist/shared/index-d76Z3yrB.cjs +0 -1
  165. package/dist/shared/index-rSrDnOpu.cjs +0 -1
  166. package/dist/shared/index.vue_vue_type_script_setup_true_lang-BiIgNax-.cjs +0 -1
  167. package/dist/shared/index.vue_vue_type_script_setup_true_lang-CKp87br2.cjs +0 -1
  168. package/dist/shared/index.vue_vue_type_script_setup_true_lang-CqSJ_8hG.cjs +0 -1
  169. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DbLp1kvW.cjs +0 -1
  170. package/dist/shared/index.vue_vue_type_script_setup_true_lang-EiHoQBXt.mjs +0 -94
  171. package/dist/shared/index.vue_vue_type_script_setup_true_lang-IyZesuKm.mjs +0 -48
  172. package/dist/shared/index.vue_vue_type_script_setup_true_lang-UBQQ6Z03.cjs +0 -1
  173. package/dist/shared/index.vue_vue_type_script_setup_true_lang-ccFLNRry.cjs +0 -1
  174. package/dist/shared/index.vue_vue_type_script_setup_true_lang-r7iyZzDS.mjs +0 -61
  175. package/dist/shared/index.vue_vue_type_style_index_0_lang-1cTut9Ql.cjs +0 -1
  176. package/dist/shared/index.vue_vue_type_style_index_0_lang-B2thgQml.cjs +0 -1
  177. package/dist/shared/index.vue_vue_type_style_index_0_lang-BMZqMPZb.mjs +0 -215
  178. package/dist/shared/index.vue_vue_type_style_index_0_lang-Bb3L64L8.mjs +0 -406
  179. package/dist/shared/index.vue_vue_type_style_index_0_lang-BoaO6MKl.cjs +0 -1
  180. package/dist/shared/index.vue_vue_type_style_index_0_lang-C4Yk-UdJ.mjs +0 -172
  181. package/dist/shared/index.vue_vue_type_style_index_0_lang-D9-2GN18.cjs +0 -1
  182. package/dist/shared/index.vue_vue_type_style_index_0_lang-DHK86rdP.cjs +0 -1
  183. package/dist/shared/index.vue_vue_type_style_index_0_lang-DsOg_Rum.mjs +0 -128
  184. package/dist/shared/index.vue_vue_type_style_index_0_lang-RiwA2WPO.cjs +0 -1
  185. package/dist/shared/utils-BjEXwY3L.cjs +0 -1
@@ -1,766 +0,0 @@
1
- import { ElUpload as Ge, ElIcon as Ye, ElPopover as Ze, ElInput as Ee, ElImageViewer as et, ElDialog as tt } from "element-plus/es";
2
- import { ref as m, onMounted as lt, computed as h, watch as le, toRaw as Ue, nextTick as nt, onBeforeUnmount as at, openBlock as w, createElementBlock as V, normalizeStyle as it, normalizeClass as ne, createElementVNode as b, createVNode as F, createSlots as ot, withCtx as j, withModifiers as v, unref as ke, Fragment as ae, toDisplayString as P, createCommentVNode as B, renderSlot as st, createBlock as ut, createTextVNode as W } from "vue";
3
- import { Plus as rt, InfoFilled as dt } from "@element-plus/icons-vue";
4
- import { ElMessage as U, ElLoading as ct } from "element-plus";
5
- import { _ as pt } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
6
- /*! js-cookie v3.0.8 | MIT */
7
- function H(o) {
8
- for (var R = 1; R < arguments.length; R++) {
9
- var S = arguments[R];
10
- for (var n in S)
11
- n !== "__proto__" && (o[n] = S[n]);
12
- }
13
- return o;
14
- }
15
- var ft = {
16
- read: function(o) {
17
- return o[0] === '"' && (o = o.slice(1, -1)), o.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
18
- },
19
- write: function(o) {
20
- return encodeURIComponent(o).replace(
21
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
22
- decodeURIComponent
23
- );
24
- }
25
- };
26
- function ie(o, R) {
27
- function S(u, C, p) {
28
- if (!(typeof document > "u")) {
29
- p = H({}, R, p), typeof p.expires == "number" && (p.expires = new Date(Date.now() + p.expires * 864e5)), p.expires && (p.expires = p.expires.toUTCString()), u = encodeURIComponent(u).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
30
- var y = "";
31
- for (var s in p)
32
- p[s] && (y += "; " + s, p[s] !== !0 && (y += "=" + p[s].split(";")[0]));
33
- return document.cookie = u + "=" + o.write(C, u) + y;
34
- }
35
- }
36
- function n(u) {
37
- if (!(typeof document > "u" || arguments.length && !u)) {
38
- for (var C = document.cookie ? document.cookie.split("; ") : [], p = {}, y = 0; y < C.length; y++) {
39
- var s = C[y].split("="), _ = s.slice(1).join("=");
40
- try {
41
- var D = decodeURIComponent(s[0]);
42
- if (D in p || (p[D] = o.read(_, D)), u === D)
43
- break;
44
- } catch {
45
- }
46
- }
47
- return u ? p[u] : p;
48
- }
49
- }
50
- return Object.create(
51
- {
52
- set: S,
53
- get: n,
54
- remove: function(u, C) {
55
- S(
56
- u,
57
- "",
58
- H({}, C, {
59
- expires: -1
60
- })
61
- );
62
- },
63
- withAttributes: function(u) {
64
- return ie(this.converter, H({}, this.attributes, u));
65
- },
66
- withConverter: function(u) {
67
- return ie(H({}, this.converter, u), this.attributes);
68
- }
69
- },
70
- {
71
- attributes: { value: Object.freeze(R) },
72
- converter: { value: Object.freeze(o) }
73
- }
74
- );
75
- }
76
- var mt = ie(ft, { path: "/" });
77
- const vt = "Admin-Token";
78
- function gt(o = vt) {
79
- return mt.get(o);
80
- }
81
- const yt = ["accept", "multiple", "disabled"], xt = ["disabled"], ht = { class: "qy-upload__hint" }, wt = ["placeholder", "disabled"], bt = ["src"], Ut = {
82
- key: 1,
83
- class: "qy-upload__tip"
84
- }, kt = { class: "error" }, Vt = { class: "error" }, Rt = /* @__PURE__ */ Object.assign({
85
- name: "QyUpload"
86
- }, {
87
- __name: "index",
88
- props: {
89
- /**
90
- * 受控值。valueFormat 为 object 时结构为 { files, text },
91
- * array 时为 string[],string 时为逗号分隔 URL。
92
- */
93
- modelValue: { type: [Object, Array, String], default: void 0 },
94
- /** 已选择的浏览器本地文件,不与上传完成后的远程值混用。 */
95
- selectedFiles: { type: Array, default: () => [] },
96
- /** 是否在选择后立即上传;false 时只维护 selectedFiles。 */
97
- autoUpload: { type: Boolean, default: !0 },
98
- /** Qy 展示模式:media-card | file-list。 */
99
- variant: { type: String, default: "media-card" },
100
- /**
101
- * 初始值,结构为 { files: '逗号分隔的URL', text: '文字内容' }
102
- * 非受控模式,仅初始化时读取一次
103
- */
104
- defaultValue: { type: Object, default: () => ({ files: "", text: "" }) },
105
- /** v-model 输出格式:object | array | string */
106
- valueFormat: { type: String, default: "object" },
107
- /** 是否显示底部文字备注区 */
108
- showText: { type: Boolean, default: !0 },
109
- /** 是否显示纯粘贴输入条,不保存文字,仅用于承接 Ctrl+V 图片 */
110
- showPasteInput: { type: Boolean, default: !1 },
111
- /** 文字区占位文案,也用于凭证上传的粘贴提示 */
112
- pastePlaceholder: { type: String, default: "输入文字" },
113
- /** 是否多选 */
114
- multiple: { type: Boolean, default: !0 },
115
- /** 是否禁用 */
116
- disabled: { type: Boolean, default: !1 },
117
- /** 允许的文件类型后缀(如 ['jpg', 'mp4']) */
118
- fileType: { type: Array, default: () => [] },
119
- /** 单个文件大小限制(MB) */
120
- fileSize: { type: Number, default: 10 },
121
- /** 文件数量限制 */
122
- limit: { type: Number, default: 9 },
123
- /** 是否显示格式/大小提示 */
124
- isShowTip: { type: Boolean, default: !1 },
125
- /** 接口路径 */
126
- api: { type: String, default: "/permission-api/common/uploads" },
127
- /** FormData 中文件字段名 */
128
- name: { type: String, default: "file" },
129
- /** token 读取 key,对应 utils/auth 中的存储字段 */
130
- tokenKey: { type: String, default: "Admin-Token" },
131
- /** 是否支持视频模式(强制 limit=1) */
132
- supportVideo: { type: Boolean, default: !1 },
133
- /**
134
- * 卡片尺寸
135
- * 预设:'large'(160px) | 'default'(140px) | 'small'(80px)
136
- * 自定义:任意 CSS 单位,如 '60px'、'8vw'
137
- */
138
- size: { type: String, default: "default" },
139
- /** 禁用拖拽(默认在触发区开启) */
140
- disableDrag: { type: Boolean, default: !1 },
141
- /** 成功回调(用于复杂业务联动) */
142
- callBack: { type: Function, default: null },
143
- /** 上传时附加的额外 FormData 字段 */
144
- extraData: { type: Object, default: () => ({}) },
145
- /** 自定义上传请求,用于接入宿主项目 request / 鉴权 / baseURL。 */
146
- uploadRequest: { type: Function, default: null }
147
- },
148
- emits: [
149
- "update:modelValue",
150
- "update:selectedFiles",
151
- "selectedFilesChange",
152
- "change",
153
- "success",
154
- "error",
155
- "remove",
156
- "invalid"
157
- ],
158
- setup(o, { expose: R, emit: S }) {
159
- const n = o, u = S, C = m(null), p = m(null), y = m(null), s = m([]), _ = m(null), D = m(null), T = [], oe = /* @__PURE__ */ new WeakMap();
160
- let X = Date.now(), J = !1;
161
- const Q = m(!1), G = m([]), se = m(0), q = m(!1), ue = m(""), re = m(""), O = /* @__PURE__ */ new Set(), M = m(!1), x = m(""), Y = m(!1);
162
- lt(() => {
163
- n.modelValue !== void 0 || !n.autoUpload || pe(n.defaultValue);
164
- });
165
- const Ve = h(() => ({ large: "160px", default: "140px", small: "80px" })[n.size] ?? n.size), $ = h(() => n.disabled), Re = h(
166
- () => s.value.some((e) => e.status === "uploading")
167
- ), Ce = h(
168
- () => n.variant === "file-list" || n.supportVideo ? "text" : "picture-card"
169
- ), Fe = h(() => n.supportVideo ? 1 : !n.autoUpload && !n.multiple ? 2 : n.limit), Be = h(
170
- () => {
171
- var e;
172
- return n.isShowTip && (n.fileSize || ((e = k.value) == null ? void 0 : e.length));
173
- }
174
- ), k = h(() => {
175
- var e;
176
- return (e = n.fileType) != null && e.length ? n.fileType.map((t) => String(t).trim().replace(/^\./, "").toLowerCase()).filter(Boolean) : n.variant === "file-list" ? [] : n.supportVideo ? ["mp4", "mov", "avi"] : ["jpg", "jpeg", "png", "gif", "webp"];
177
- }), N = h(() => {
178
- if (!n.autoUpload && !n.multiple) return !1;
179
- const e = n.supportVideo ? 1 : n.limit;
180
- return s.value.length >= e;
181
- }), de = h(
182
- () => k.value.map((e) => `.${e}`).join(",")
183
- ), Se = h(() => ({
184
- "qy-upload--reached-limit": N.value,
185
- "qy-upload--disabled": n.disabled,
186
- "qy-upload--video": n.supportVideo,
187
- "qy-upload--without-text": !n.showText && !n.showPasteInput
188
- }));
189
- le(x, () => {
190
- J || L();
191
- }), le(
192
- () => n.modelValue,
193
- (e) => {
194
- n.autoUpload && e !== void 0 && pe(e);
195
- },
196
- { immediate: !0, deep: !0 }
197
- ), le(
198
- () => [n.autoUpload, n.selectedFiles],
199
- ([e, t]) => {
200
- e || (s.value = z(t));
201
- },
202
- { immediate: !0, deep: !0 }
203
- );
204
- function ce(e) {
205
- return Array.isArray(e) ? e.filter(Boolean) : e ? String(e).split(",").filter(Boolean) : [];
206
- }
207
- function je(e) {
208
- return Array.isArray(e) ? { files: e, text: "" } : typeof e == "string" ? { files: ce(e), text: "" } : e && typeof e == "object" ? {
209
- files: ce(e.files),
210
- text: e.text ?? ""
211
- } : { files: [], text: "" };
212
- }
213
- function De(e = []) {
214
- return e.map((t, l) => ({
215
- name: String(t).split("/").pop() || `file-${l}`,
216
- url: t,
217
- status: "success",
218
- uid: Date.now() + l
219
- }));
220
- }
221
- function z(e = []) {
222
- return e.filter(Boolean).map((t, l) => {
223
- const a = Ue(t);
224
- return {
225
- name: a.name,
226
- raw: a,
227
- status: "ready",
228
- uid: Te(a, l)
229
- };
230
- });
231
- }
232
- function Te(e, t) {
233
- if (e.uid != null) return e.uid;
234
- const l = oe.get(e);
235
- return l ?? (X += t + 1, oe.set(e, X), X);
236
- }
237
- function Z(e = s.value) {
238
- return e.map((t) => {
239
- const l = t.raw ?? (t instanceof File ? t : null);
240
- return l ? Ue(l) : null;
241
- }).filter(Boolean);
242
- }
243
- function K(e) {
244
- u("update:selectedFiles", e), u("selectedFilesChange", e);
245
- }
246
- function qe(e, t) {
247
- if (n.autoUpload) return;
248
- const l = e == null ? void 0 : e.raw;
249
- if (l && !E(l)) {
250
- s.value = z(n.selectedFiles);
251
- return;
252
- }
253
- const a = Z(t);
254
- l && !a.includes(l) && a.push(l);
255
- const i = n.multiple ? a : a.slice(-1);
256
- s.value = z(i), K(i);
257
- }
258
- function ze(e) {
259
- const t = new Set(e.map((a) => a.url)), l = s.value.filter(
260
- (a) => a.status === "uploading" && !t.has(a.url)
261
- );
262
- return [...e, ...l];
263
- }
264
- function pe(e) {
265
- const t = je(e);
266
- J = !0, x.value = t.text, s.value = ze(De(t.files)), nt(() => {
267
- J = !1;
268
- });
269
- }
270
- function fe(e) {
271
- return n.valueFormat === "array" ? e.files : n.valueFormat === "string" ? e.files.join(",") : e;
272
- }
273
- function Le() {
274
- var e;
275
- (e = _.value) == null || e.focus();
276
- }
277
- function Ie(e) {
278
- e.target.value = "";
279
- }
280
- function L(e) {
281
- const a = { files: (e ?? s.value).filter((i) => i.status === "success" && i.url).map((i) => i.url), text: x.value };
282
- u("update:modelValue", fe(a)), u("change", a), n.callBack && n.callBack(a);
283
- }
284
- function Ae(e, t) {
285
- if (!n.autoUpload) {
286
- const l = Z(t);
287
- s.value = z(l), K(l), u("remove", e, t);
288
- return;
289
- }
290
- L(t), u("remove", e, t);
291
- }
292
- function me(e) {
293
- var l;
294
- const t = (e == null ? void 0 : e.name) || "";
295
- return t.includes(".") && ((l = t.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
296
- }
297
- function ve(e) {
298
- var i, r, c;
299
- const t = ((r = (i = e == null ? void 0 : e.type) == null ? void 0 : i.toLowerCase) == null ? void 0 : r.call(i)) || "", l = {
300
- "image/jpeg": ["jpg", "jpeg"],
301
- "image/png": ["png"],
302
- "image/gif": ["gif"],
303
- "image/bmp": ["bmp"],
304
- "image/webp": ["webp"],
305
- "video/mp4": ["mp4"],
306
- "video/quicktime": ["mov"],
307
- "video/x-msvideo": ["avi"],
308
- "video/webm": ["webm"]
309
- };
310
- if (l[t]) return l[t];
311
- const a = (c = t.split("/")[1]) == null ? void 0 : c.split("+")[0];
312
- return a ? [a] : [];
313
- }
314
- function Pe(e) {
315
- if (!k.value.length) return !0;
316
- const t = me(e), l = ve(e);
317
- return [t, ...l].some(
318
- (a) => k.value.includes(a)
319
- );
320
- }
321
- function E(e) {
322
- if (n.fileSize > 0 && e.size > n.fileSize * 1024 * 1024) {
323
- const l = {
324
- code: "size",
325
- file: e,
326
- message: `文件大小不能超过${n.fileSize}M`
327
- };
328
- return U.warning(l.message), u("invalid", l), !1;
329
- }
330
- if (!Pe(e)) {
331
- const l = {
332
- code: "extension",
333
- file: e,
334
- message: `格式不支持,仅允许: ${k.value.join("/")}`
335
- };
336
- return U.warning(l.message), u("invalid", l), !1;
337
- }
338
- return !0;
339
- }
340
- async function _e(e, t, l, a) {
341
- const i = ge(e);
342
- try {
343
- const r = await n.uploadRequest({
344
- file: e,
345
- formData: i,
346
- api: n.api,
347
- name: n.name,
348
- tokenKey: n.tokenKey,
349
- extraData: n.extraData
350
- }), c = Oe(r);
351
- if (!c) {
352
- const d = new Error("上传失败,未返回文件地址");
353
- U.error(d.message), u("error", d), l == null || l(d);
354
- return;
355
- }
356
- U.success("上传成功"), t == null || t({ ...typeof r == "object" && r ? r : {}, url: c });
357
- } catch (r) {
358
- U.error("上传失败"), u("error", r), l == null || l(r);
359
- } finally {
360
- a.close();
361
- }
362
- }
363
- function ge(e) {
364
- const t = new FormData();
365
- return t.append(n.name, e), n.extraData && Object.entries(n.extraData).forEach(([l, a]) => t.append(l, a)), t;
366
- }
367
- function Oe(e) {
368
- var a, i;
369
- if (typeof e == "string") return e;
370
- const t = e || {}, l = t.urls ?? t.url ?? ((a = t.data) == null ? void 0 : a.urls) ?? ((i = t.data) == null ? void 0 : i.url) ?? "";
371
- return Array.isArray(l) ? l[0] || "" : l || "";
372
- }
373
- function ye(e, t, l, a) {
374
- const i = ct.service({
375
- target: p.value,
376
- text: "上传中",
377
- background: "rgba(255,255,255,0.7)"
378
- });
379
- if (n.uploadRequest) {
380
- _e(e, l, a, i);
381
- return;
382
- }
383
- const r = n.api.startsWith("http") ? n.api : window.location.origin + n.api.replace(/^([^/])/, "/$1"), c = ge(e), d = new XMLHttpRequest();
384
- T.push(d);
385
- const A = () => {
386
- const f = T.indexOf(d);
387
- f !== -1 && T.splice(f, 1), i.close();
388
- };
389
- d.open("POST", r);
390
- const g = gt(n.tokenKey);
391
- g && d.setRequestHeader("Authorization", `Bearer ${g}`), d.upload.onprogress = (f) => {
392
- f.total > 0 && (t == null || t({ percent: f.loaded / f.total * 100 }));
393
- }, d.onload = () => {
394
- if (A(), d.status < 200 || d.status >= 300) {
395
- const f = `上传失败 (HTTP ${d.status})`;
396
- U.error(f), u("error", { msg: f, status: d.status }), a == null || a(new Error(f));
397
- return;
398
- }
399
- try {
400
- const f = JSON.parse(d.responseText);
401
- f.code === 200 && f.urls ? (U.success("上传成功"), l == null || l({ ...f, url: f.urls })) : (U.error(f.msg || "上传失败"), u("error", f), a == null || a(f));
402
- } catch {
403
- U.error("上传失败,响应格式错误"), u("error", new Error("Response parse error")), a == null || a(new Error("Response parse error"));
404
- }
405
- }, d.onerror = () => {
406
- A(), U.error("上传失败,网络异常"), u("error", new Error("Network error")), a == null || a(new Error("Network error"));
407
- }, d.send(c);
408
- }
409
- function xe(e) {
410
- return n.disabled ? !1 : E(e);
411
- }
412
- function Me(e, t) {
413
- const l = s.value.find(
414
- (a) => {
415
- var i;
416
- return a.uid === (e == null ? void 0 : e.uid) || ((i = a.raw) == null ? void 0 : i.uid) === (e == null ? void 0 : e.uid);
417
- }
418
- );
419
- l && (l.url = t, l.status = "success");
420
- }
421
- function $e(e) {
422
- ye(
423
- e.file,
424
- e.onProgress,
425
- (t) => {
426
- Me(e.file, t.url), e.onSuccess(t), L(), u("success", t);
427
- },
428
- (t) => e.onError(t)
429
- );
430
- }
431
- function Ne(e) {
432
- var a;
433
- if (!e.url) return;
434
- const t = ((a = e.url.split(".").pop()) == null ? void 0 : a.toLowerCase()) || "";
435
- if (["mp4", "mov", "avi", "webm"].includes(t)) {
436
- ue.value = e.url, re.value = e.name || "视频预览", q.value = !0;
437
- return;
438
- }
439
- const l = s.value.filter(
440
- (i) => {
441
- var r;
442
- return i.status === "success" && i.url && !["mp4", "mov", "avi", "webm"].includes(
443
- (r = i.url.split(".").pop()) == null ? void 0 : r.toLowerCase()
444
- );
445
- }
446
- );
447
- G.value = l.map((i) => i.url), se.value = l.findIndex((i) => i.uid === e.uid) || 0, Q.value = !0;
448
- }
449
- function Ke() {
450
- Q.value = !1, G.value = [];
451
- }
452
- function We(e, t) {
453
- if (e.name && me(e)) return e;
454
- const l = ve(e).find(
455
- (a) => k.value.includes(a)
456
- );
457
- return l ? new File([e], `paste-${Date.now() + t}.${l}`, {
458
- type: e.type,
459
- lastModified: e.lastModified
460
- }) : e;
461
- }
462
- function ee(e) {
463
- if (!n.autoUpload) {
464
- const t = Z(), l = e.filter((i) => E(i));
465
- if (!l.length) return;
466
- const a = n.multiple ? [...t, ...l].slice(0, n.limit) : l.slice(-1);
467
- s.value = z(a), K(a);
468
- return;
469
- }
470
- for (let t = 0; t < e.length; t++) {
471
- const l = We(e[t], t);
472
- if (!xe(l)) continue;
473
- const a = Date.now() + t, i = URL.createObjectURL(l);
474
- O.add(i), s.value.push({
475
- uid: a,
476
- name: l.name || `file-${a}`,
477
- status: "uploading",
478
- percentage: 0,
479
- url: i
480
- }), ye(
481
- l,
482
- (r) => {
483
- const c = s.value.find((d) => d.uid === a);
484
- c && (c.percentage = r.percent);
485
- },
486
- (r) => {
487
- const c = s.value.find((d) => d.uid === a);
488
- c && (c.status = "success", c.url = r.url, L(), u("success", r));
489
- },
490
- () => Je(a)
491
- );
492
- }
493
- }
494
- function He(e) {
495
- const t = e.target, l = Array.from(t.files || []);
496
- if (t.value = "", n.disabled || !l.length) return;
497
- const a = n.supportVideo || !n.multiple ? l.slice(0, 1) : l;
498
- ee(a);
499
- }
500
- function Xe(e) {
501
- const t = Array.from((e == null ? void 0 : e.files) || []).filter(
502
- (r) => {
503
- var c;
504
- return (c = r.type) == null ? void 0 : c.startsWith("image/");
505
- }
506
- );
507
- if (t.length) return t;
508
- const l = e == null ? void 0 : e.items;
509
- if (!l) return [];
510
- const a = [], i = /* @__PURE__ */ new Set();
511
- for (let r = 0; r < l.length; r++) {
512
- const c = l[r];
513
- if (c.kind === "file" && c.type.startsWith("image/")) {
514
- const d = c.getAsFile();
515
- d && !i.has(d) && (i.add(d), a.push(d));
516
- }
517
- }
518
- return a;
519
- }
520
- function I(e) {
521
- if (n.disabled) return;
522
- const t = Xe(e.clipboardData);
523
- t.length && (e.preventDefault(), ee(t));
524
- }
525
- function he() {
526
- n.disabled || n.disableDrag || (M.value = !0);
527
- }
528
- function we() {
529
- M.value = !1;
530
- }
531
- function be(e) {
532
- var l;
533
- if (M.value = !1, n.disabled || n.disableDrag || N.value) return;
534
- const t = Array.from(((l = e.dataTransfer) == null ? void 0 : l.files) || []);
535
- t.length && ee(t);
536
- }
537
- function Je(e) {
538
- var l;
539
- const t = s.value.findIndex((a) => a.uid === e);
540
- t !== -1 && ((l = s.value[t].url) != null && l.startsWith("blob:") && (URL.revokeObjectURL(s.value[t].url), O.delete(s.value[t].url)), s.value.splice(t, 1));
541
- }
542
- at(() => {
543
- T.forEach((e) => e.abort()), T.length = 0, O.forEach((e) => URL.revokeObjectURL(e)), O.clear();
544
- });
545
- function te() {
546
- var e;
547
- n.disabled || N.value || (e = y.value) == null || e.click();
548
- }
549
- function Qe() {
550
- s.value = [], x.value = "", K([]), n.autoUpload && L();
551
- }
552
- return R({
553
- /** 主动打开文件选择框,供表单或快捷操作调用 */
554
- openFileDialog: te,
555
- /** 获取已上传成功的文件 URL 列表 */
556
- getPathList: () => s.value.filter((e) => e.status === "success").map((e) => e.url),
557
- /** 清空文件和文字,并同步 change 事件 */
558
- clearFiles: Qe,
559
- /** 获取完整值,结构与 change 事件保持一致 */
560
- getValue: () => ({
561
- files: s.value.filter((e) => e.status === "success" && e.url).map((e) => e.url),
562
- text: x.value
563
- }),
564
- /** 获取按 valueFormat 输出的值,便于外部不走 v-model 时读取 */
565
- getModelValue: () => fe({
566
- files: s.value.filter((e) => e.status === "success" && e.url).map((e) => e.url),
567
- text: x.value
568
- })
569
- }), (e, t) => {
570
- var A;
571
- const l = Ye, a = Ee, i = Ze, r = Ge, c = et, d = tt;
572
- return w(), V("div", {
573
- ref_key: "rootRef",
574
- ref: p,
575
- class: ne(["qy-upload", Se.value]),
576
- style: it({ "--qy-upload-size": Ve.value })
577
- }, [
578
- b("input", {
579
- ref_key: "nativeInputRef",
580
- ref: y,
581
- class: "qy-upload__native-input",
582
- type: "file",
583
- accept: de.value,
584
- multiple: o.supportVideo ? !1 : o.multiple,
585
- disabled: $.value,
586
- onChange: He
587
- }, null, 40, yt),
588
- F(r, {
589
- ref_key: "uploadRef",
590
- ref: C,
591
- "file-list": s.value,
592
- "onUpdate:fileList": t[7] || (t[7] = (g) => s.value = g),
593
- action: "#",
594
- multiple: o.supportVideo ? !1 : o.multiple,
595
- limit: Fe.value,
596
- "auto-upload": o.autoUpload,
597
- "list-type": Ce.value,
598
- accept: de.value,
599
- disabled: $.value,
600
- "http-request": $e,
601
- "before-upload": xe,
602
- "on-change": qe,
603
- "on-preview": Ne,
604
- "on-remove": Ae
605
- }, ot({
606
- default: j(() => [
607
- o.variant !== "file-list" && !N.value ? (w(), V("div", {
608
- key: 0,
609
- class: ne(["qy-upload__trigger", { "is-dragover": M.value }]),
610
- onPaste: I,
611
- onDragover: v(he, ["prevent"]),
612
- onDragleave: v(we, ["prevent"]),
613
- onDrop: v(be, ["prevent"])
614
- }, [
615
- F(l, { class: "qy-upload__icon" }, {
616
- default: j(() => [
617
- F(ke(rt))
618
- ]),
619
- _: 1
620
- }),
621
- o.supportVideo ? (w(), V(ae, { key: 0 }, [
622
- t[10] || (t[10] = b("span", { class: "qy-upload__label" }, "点击上传视频", -1)),
623
- b("span", ht, "支持 " + P(k.value.join(" / ")) + ",不超过 " + P(o.fileSize) + "MB", 1)
624
- ], 64)) : B("", !0),
625
- o.showText ? (w(), V("div", {
626
- key: 1,
627
- class: "qy-upload__text",
628
- onClick: t[4] || (t[4] = v(() => {
629
- }, ["stop"])),
630
- onPaste: v(I, ["stop"])
631
- }, [
632
- F(i, {
633
- visible: Y.value,
634
- "onUpdate:visible": t[3] || (t[3] = (g) => Y.value = g),
635
- placement: "bottom-start",
636
- width: 220,
637
- trigger: "click",
638
- "popper-class": "qy-upload__text-popover",
639
- onAfterEnter: Le
640
- }, {
641
- reference: j(() => [
642
- b("div", {
643
- class: ne(["qy-upload__text-preview", { "is-placeholder": !x.value }])
644
- }, P(x.value || o.pastePlaceholder), 3)
645
- ]),
646
- default: j(() => [
647
- F(a, {
648
- ref_key: "inputRef",
649
- ref: _,
650
- modelValue: x.value,
651
- "onUpdate:modelValue": t[1] || (t[1] = (g) => x.value = g),
652
- type: "textarea",
653
- autosize: { minRows: 2, maxRows: 5 },
654
- placeholder: o.pastePlaceholder,
655
- disabled: o.disabled,
656
- onBlur: t[2] || (t[2] = (g) => Y.value = !1),
657
- onPaste: v(I, ["stop"])
658
- }, null, 8, ["modelValue", "placeholder", "disabled"])
659
- ]),
660
- _: 1
661
- }, 8, ["visible"])
662
- ], 32)) : o.showPasteInput ? (w(), V("div", {
663
- key: 2,
664
- class: "qy-upload__text",
665
- onClick: t[6] || (t[6] = v(() => {
666
- }, ["stop"])),
667
- onPaste: v(I, ["stop"])
668
- }, [
669
- b("input", {
670
- ref_key: "pasteInputRef",
671
- ref: D,
672
- class: "qy-upload__paste-input",
673
- placeholder: o.pastePlaceholder,
674
- disabled: o.disabled,
675
- onPaste: v(I, ["stop"]),
676
- onInput: Ie,
677
- onClick: t[5] || (t[5] = v(() => {
678
- }, ["stop"]))
679
- }, null, 40, wt)
680
- ], 32)) : B("", !0)
681
- ], 34)) : B("", !0)
682
- ]),
683
- _: 2
684
- }, [
685
- o.variant === "file-list" ? {
686
- name: "trigger",
687
- fn: j(() => [
688
- b("div", {
689
- class: "qy-upload__file-trigger",
690
- onClick: t[0] || (t[0] = v(() => {
691
- }, ["stop"])),
692
- onDragover: v(he, ["prevent"]),
693
- onDragleave: v(we, ["prevent"]),
694
- onDrop: v(be, ["prevent"])
695
- }, [
696
- st(e.$slots, "trigger", {
697
- open: te,
698
- disabled: $.value,
699
- uploading: Re.value
700
- }, () => [
701
- b("button", {
702
- class: "qy-upload__file-button",
703
- type: "button",
704
- disabled: $.value,
705
- onClick: te
706
- }, " 选择文件 ", 8, xt)
707
- ], !0)
708
- ], 32)
709
- ]),
710
- key: "0"
711
- } : void 0
712
- ]), 1032, ["file-list", "multiple", "limit", "auto-upload", "list-type", "accept", "disabled"]),
713
- Q.value ? (w(), ut(c, {
714
- key: 0,
715
- "url-list": G.value,
716
- "initial-index": se.value,
717
- onClose: Ke
718
- }, null, 8, ["url-list", "initial-index"])) : B("", !0),
719
- F(d, {
720
- modelValue: q.value,
721
- "onUpdate:modelValue": t[8] || (t[8] = (g) => q.value = g),
722
- title: re.value,
723
- width: "640px",
724
- "append-to-body": "",
725
- "destroy-on-close": "",
726
- onClose: t[9] || (t[9] = (g) => q.value = !1)
727
- }, {
728
- default: j(() => [
729
- q.value ? (w(), V("video", {
730
- key: 0,
731
- src: ue.value,
732
- controls: "",
733
- autoplay: "",
734
- style: { width: "100%", "max-height": "400px", "border-radius": "4px" }
735
- }, null, 8, bt)) : B("", !0)
736
- ]),
737
- _: 1
738
- }, 8, ["modelValue", "title"]),
739
- Be.value ? (w(), V("div", Ut, [
740
- F(l, null, {
741
- default: j(() => [
742
- F(ke(dt))
743
- ]),
744
- _: 1
745
- }),
746
- b("span", null, [
747
- t[13] || (t[13] = W(" 请上传 ", -1)),
748
- o.fileSize ? (w(), V(ae, { key: 0 }, [
749
- t[11] || (t[11] = W("大小不超过 ", -1)),
750
- b("b", kt, P(o.fileSize) + "MB", 1)
751
- ], 64)) : B("", !0),
752
- (A = k.value) != null && A.length ? (w(), V(ae, { key: 1 }, [
753
- t[12] || (t[12] = W(",格式为 ", -1)),
754
- b("b", Vt, P(k.value.join("/")), 1)
755
- ], 64)) : B("", !0),
756
- t[14] || (t[14] = W(" 的文件。 ", -1))
757
- ])
758
- ])) : B("", !0)
759
- ], 6);
760
- };
761
- }
762
- }), Dt = /* @__PURE__ */ pt(Rt, [["__scopeId", "data-v-a8b769c6"]]);
763
- export {
764
- Dt as U,
765
- mt as a
766
- };