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