@qynpm/ui 1.0.5 → 1.0.7
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 +228 -228
- package/dist/index.cjs +2 -1
- package/dist/index.mjs +18 -18
- package/dist/qy-action-bar/index.cjs +1 -1
- package/dist/qy-action-bar/index.mjs +2 -4
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +2 -5
- package/dist/qy-form-section/index.cjs +1 -1
- package/dist/qy-form-section/index.mjs +2 -4
- package/dist/qy-input/index.cjs +1 -1
- package/dist/qy-input/index.mjs +2 -4
- package/dist/qy-money-input/index.cjs +1 -1
- package/dist/qy-money-input/index.mjs +2 -4
- package/dist/qy-radio-group/index.cjs +1 -1
- package/dist/qy-radio-group/index.mjs +2 -4
- package/dist/qy-record-quote-search/index.cjs +1 -1
- package/dist/qy-record-quote-search/index.mjs +2 -4
- package/dist/qy-remark-image/index.cjs +1 -2
- package/dist/qy-remark-image/index.mjs +2 -5
- package/dist/qy-remote-select/index.cjs +1 -1
- package/dist/qy-remote-select/index.mjs +2 -4
- package/dist/qy-search-input/index.cjs +1 -1
- package/dist/qy-search-input/index.mjs +2 -4
- package/dist/qy-select/index.cjs +1 -1
- package/dist/qy-select/index.mjs +2 -4
- package/dist/qy-upload/index.cjs +1 -1
- package/dist/qy-upload/index.mjs +2 -4
- package/dist/qy-voucher-upload/index.cjs +1 -1
- package/dist/qy-voucher-upload/index.mjs +2 -4
- package/dist/shared/index-CbFvRxuh.mjs +2592 -0
- package/dist/shared/index-GDrnDY44.cjs +1 -0
- package/index.d.ts +20 -20
- package/package.json +1 -1
- package/qy-action-bar/index.js +1 -4
- package/qy-dialog/index.js +1 -4
- package/qy-form-section/index.js +1 -4
- package/qy-input/index.js +1 -4
- package/qy-money-input/index.d.ts +12 -12
- package/qy-money-input/index.js +1 -15
- package/qy-radio-group/index.d.ts +12 -12
- package/qy-radio-group/index.js +1 -15
- package/qy-record-quote-search/index.js +1 -4
- package/qy-remark-image/index.js +1 -4
- package/qy-remote-select/index.d.ts +12 -12
- package/qy-remote-select/index.js +1 -15
- package/qy-search-input/index.js +1 -4
- package/qy-select/index.js +1 -4
- package/qy-upload/index.js +1 -4
- package/qy-voucher-upload/index.d.ts +12 -12
- package/qy-voucher-upload/index.js +1 -15
- package/dist/_virtual/_plugin-vue_export-helper.cjs +0 -1
- package/dist/_virtual/_plugin-vue_export-helper.mjs +0 -9
- package/dist/lib/dialog/index.vue.cjs +0 -1
- package/dist/lib/dialog/index.vue.mjs +0 -325
- package/dist/lib/dialog/index.vue3.cjs +0 -1
- package/dist/lib/dialog/index.vue3.mjs +0 -5
- package/dist/lib/index.cjs +0 -1
- package/dist/lib/index.mjs +0 -53
- package/dist/lib/qy-action-bar/index.vue.cjs +0 -1
- package/dist/lib/qy-action-bar/index.vue.mjs +0 -7
- package/dist/lib/qy-action-bar/index.vue2.cjs +0 -1
- package/dist/lib/qy-action-bar/index.vue2.mjs +0 -55
- package/dist/lib/qy-form-section/index.vue.cjs +0 -1
- package/dist/lib/qy-form-section/index.vue.mjs +0 -7
- package/dist/lib/qy-form-section/index.vue2.cjs +0 -1
- package/dist/lib/qy-form-section/index.vue2.mjs +0 -87
- package/dist/lib/qy-input/index.vue.cjs +0 -1
- package/dist/lib/qy-input/index.vue.mjs +0 -143
- package/dist/lib/qy-input/index.vue2.cjs +0 -1
- package/dist/lib/qy-input/index.vue2.mjs +0 -4
- package/dist/lib/qy-money-input/index.vue.cjs +0 -1
- package/dist/lib/qy-money-input/index.vue.mjs +0 -171
- package/dist/lib/qy-money-input/index.vue2.cjs +0 -1
- package/dist/lib/qy-money-input/index.vue2.mjs +0 -4
- package/dist/lib/qy-radio-group/index.vue.cjs +0 -1
- package/dist/lib/qy-radio-group/index.vue.mjs +0 -90
- package/dist/lib/qy-radio-group/index.vue2.cjs +0 -1
- package/dist/lib/qy-radio-group/index.vue2.mjs +0 -4
- package/dist/lib/qy-record-quote-search/index.vue.cjs +0 -1
- package/dist/lib/qy-record-quote-search/index.vue.mjs +0 -7
- package/dist/lib/qy-record-quote-search/index.vue2.cjs +0 -1
- package/dist/lib/qy-record-quote-search/index.vue2.mjs +0 -204
- package/dist/lib/qy-remote-select/index.vue.cjs +0 -1
- package/dist/lib/qy-remote-select/index.vue.mjs +0 -214
- package/dist/lib/qy-remote-select/index.vue2.cjs +0 -1
- package/dist/lib/qy-remote-select/index.vue2.mjs +0 -4
- package/dist/lib/qy-search-input/index.vue.cjs +0 -1
- package/dist/lib/qy-search-input/index.vue.mjs +0 -7
- package/dist/lib/qy-search-input/index.vue2.cjs +0 -1
- package/dist/lib/qy-search-input/index.vue2.mjs +0 -276
- package/dist/lib/qy-select/index.vue.cjs +0 -1
- package/dist/lib/qy-select/index.vue.mjs +0 -162
- package/dist/lib/qy-select/index.vue2.cjs +0 -1
- package/dist/lib/qy-select/index.vue2.mjs +0 -4
- package/dist/lib/qy-voucher-upload/index.vue.cjs +0 -1
- package/dist/lib/qy-voucher-upload/index.vue.mjs +0 -123
- package/dist/lib/remark-image/index.vue.cjs +0 -1
- package/dist/lib/remark-image/index.vue.mjs +0 -7
- package/dist/lib/remark-image/index.vue2.cjs +0 -1
- package/dist/lib/remark-image/index.vue2.mjs +0 -197
- package/dist/lib/remark-image/utils.cjs +0 -1
- package/dist/lib/remark-image/utils.mjs +0 -22
- package/dist/lib/upload/index.vue.cjs +0 -1
- package/dist/lib/upload/index.vue.mjs +0 -482
- package/dist/lib/utils/auth.cjs +0 -1
- package/dist/lib/utils/auth.mjs +0 -8
- package/dist/lib/utils/install.cjs +0 -1
- package/dist/lib/utils/install.mjs +0 -8
- package/dist/node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.cjs +0 -1
- package/dist/node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs +0 -74
|
@@ -1,482 +0,0 @@
|
|
|
1
|
-
import { ElUpload as Le, ElIcon as Te, ElPopover as Re, ElInput as qe, ElImageViewer as je, ElDialog as Pe } from "element-plus/es";
|
|
2
|
-
import { ref as p, onMounted as ze, computed as V, watch as le, nextTick as Ce, onBeforeUnmount as Ie, createElementBlock as g, openBlock as m, normalizeStyle as Oe, normalizeClass as F, createVNode as b, createBlock as $e, createCommentVNode as h, withCtx as U, withModifiers as v, unref as ae, Fragment as N, createElementVNode as k, toDisplayString as R, createTextVNode as I } from "vue";
|
|
3
|
-
import { Plus as Ae, InfoFilled as Me } from "@element-plus/icons-vue";
|
|
4
|
-
import { ElMessage as S, ElLoading as Fe } from "element-plus";
|
|
5
|
-
import { getToken as Ne } from "../utils/auth.mjs";
|
|
6
|
-
/* empty css */
|
|
7
|
-
/* empty css */
|
|
8
|
-
import _e from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
9
|
-
const Ee = { class: "qy-upload__hint" }, He = ["placeholder", "disabled"], We = ["src"], Xe = {
|
|
10
|
-
key: 1,
|
|
11
|
-
class: "qy-upload__tip"
|
|
12
|
-
}, Ke = { class: "error" }, Qe = { class: "error" }, Je = /* @__PURE__ */ Object.assign({
|
|
13
|
-
name: "QyUpload"
|
|
14
|
-
}, {
|
|
15
|
-
__name: "index",
|
|
16
|
-
props: {
|
|
17
|
-
/**
|
|
18
|
-
* 受控值。valueFormat 为 object 时结构为 { files, text },
|
|
19
|
-
* array 时为 string[],string 时为逗号分隔 URL。
|
|
20
|
-
*/
|
|
21
|
-
modelValue: { type: [Object, Array, String], default: void 0 },
|
|
22
|
-
/**
|
|
23
|
-
* 初始值,结构为 { files: '逗号分隔的URL', text: '文字内容' }
|
|
24
|
-
* 非受控模式,仅初始化时读取一次
|
|
25
|
-
*/
|
|
26
|
-
defaultValue: { type: Object, default: () => ({ files: "", text: "" }) },
|
|
27
|
-
/** v-model 输出格式:object | array | string */
|
|
28
|
-
valueFormat: { type: String, default: "object" },
|
|
29
|
-
/** 是否显示底部文字备注区 */
|
|
30
|
-
showText: { type: Boolean, default: !0 },
|
|
31
|
-
/** 是否显示纯粘贴输入条,不保存文字,仅用于承接 Ctrl+V 图片 */
|
|
32
|
-
showPasteInput: { type: Boolean, default: !1 },
|
|
33
|
-
/** 文字区占位文案,也用于凭证上传的粘贴提示 */
|
|
34
|
-
pastePlaceholder: { type: String, default: "输入文字" },
|
|
35
|
-
/** 是否多选 */
|
|
36
|
-
multiple: { type: Boolean, default: !0 },
|
|
37
|
-
/** 是否禁用 */
|
|
38
|
-
disabled: { type: Boolean, default: !1 },
|
|
39
|
-
/** 允许的文件类型后缀(如 ['jpg', 'mp4']) */
|
|
40
|
-
fileType: { type: Array, default: () => [] },
|
|
41
|
-
/** 单个文件大小限制(MB) */
|
|
42
|
-
fileSize: { type: Number, default: 10 },
|
|
43
|
-
/** 文件数量限制 */
|
|
44
|
-
limit: { type: Number, default: 9 },
|
|
45
|
-
/** 是否显示格式/大小提示 */
|
|
46
|
-
isShowTip: { type: Boolean, default: !1 },
|
|
47
|
-
/** 接口路径 */
|
|
48
|
-
api: { type: String, default: "/permission-api/common/uploads" },
|
|
49
|
-
/** FormData 中文件字段名 */
|
|
50
|
-
name: { type: String, default: "file" },
|
|
51
|
-
/** token 读取 key,对应 utils/auth 中的存储字段 */
|
|
52
|
-
tokenKey: { type: String, default: "Admin-Token" },
|
|
53
|
-
/** 是否支持视频模式(强制 limit=1) */
|
|
54
|
-
supportVideo: { type: Boolean, default: !1 },
|
|
55
|
-
/**
|
|
56
|
-
* 卡片尺寸
|
|
57
|
-
* 预设:'large'(160px) | 'default'(140px) | 'small'(80px)
|
|
58
|
-
* 自定义:任意 CSS 单位,如 '60px'、'8vw'
|
|
59
|
-
*/
|
|
60
|
-
size: { type: String, default: "default" },
|
|
61
|
-
/** 禁用拖拽(默认在触发区开启) */
|
|
62
|
-
disableDrag: { type: Boolean, default: !1 },
|
|
63
|
-
/** 成功回调(用于复杂业务联动) */
|
|
64
|
-
callBack: { type: Function, default: null },
|
|
65
|
-
/** 上传时附加的额外 FormData 字段 */
|
|
66
|
-
extraData: { type: Object, default: () => ({}) }
|
|
67
|
-
},
|
|
68
|
-
emits: [
|
|
69
|
-
"update:modelValue",
|
|
70
|
-
"change",
|
|
71
|
-
"success",
|
|
72
|
-
"error",
|
|
73
|
-
"remove"
|
|
74
|
-
],
|
|
75
|
-
setup(r, { expose: ie, emit: oe }) {
|
|
76
|
-
const a = r, y = oe, q = p(null), n = p([]), _ = p(null), se = p(null), B = [];
|
|
77
|
-
let O = !1;
|
|
78
|
-
const $ = p(!1), A = p([]), E = p(0), D = p(!1), H = p(""), W = p(""), j = /* @__PURE__ */ new Set(), P = p(!1), c = p(""), M = p(!1);
|
|
79
|
-
ze(() => {
|
|
80
|
-
a.modelValue === void 0 && K(a.defaultValue);
|
|
81
|
-
});
|
|
82
|
-
const ne = V(() => ({ large: "160px", default: "140px", small: "80px" })[a.size] ?? a.size), ue = V(() => a.disabled), re = V(
|
|
83
|
-
() => {
|
|
84
|
-
var e;
|
|
85
|
-
return a.isShowTip && (a.fileSize || ((e = x.value) == null ? void 0 : e.length));
|
|
86
|
-
}
|
|
87
|
-
), x = V(() => {
|
|
88
|
-
var e;
|
|
89
|
-
return (e = a.fileType) != null && e.length ? a.fileType.map((t) => t.toLowerCase()) : a.supportVideo ? ["mp4", "mov", "avi"] : ["jpg", "jpeg", "png", "gif", "webp"];
|
|
90
|
-
}), z = V(() => {
|
|
91
|
-
const e = a.supportVideo ? 1 : a.limit;
|
|
92
|
-
return n.value.length >= e;
|
|
93
|
-
}), de = V(
|
|
94
|
-
() => x.value.map((e) => `.${e}`).join(",")
|
|
95
|
-
), pe = V(() => ({
|
|
96
|
-
"qy-upload--reached-limit": z.value,
|
|
97
|
-
"qy-upload--disabled": a.disabled,
|
|
98
|
-
"qy-upload--video": a.supportVideo,
|
|
99
|
-
"qy-upload--without-text": !a.showText && !a.showPasteInput
|
|
100
|
-
}));
|
|
101
|
-
le(c, () => {
|
|
102
|
-
O || L();
|
|
103
|
-
}), le(
|
|
104
|
-
() => a.modelValue,
|
|
105
|
-
(e) => {
|
|
106
|
-
e !== void 0 && K(e);
|
|
107
|
-
},
|
|
108
|
-
{ immediate: !0, deep: !0 }
|
|
109
|
-
);
|
|
110
|
-
function X(e) {
|
|
111
|
-
return Array.isArray(e) ? e.filter(Boolean) : e ? String(e).split(",").filter(Boolean) : [];
|
|
112
|
-
}
|
|
113
|
-
function fe(e) {
|
|
114
|
-
return Array.isArray(e) ? { files: e, text: "" } : typeof e == "string" ? { files: X(e), text: "" } : e && typeof e == "object" ? {
|
|
115
|
-
files: X(e.files),
|
|
116
|
-
text: e.text ?? ""
|
|
117
|
-
} : { files: [], text: "" };
|
|
118
|
-
}
|
|
119
|
-
function ce(e = []) {
|
|
120
|
-
return e.map((t, i) => ({
|
|
121
|
-
name: String(t).split("/").pop() || `file-${i}`,
|
|
122
|
-
url: t,
|
|
123
|
-
status: "success",
|
|
124
|
-
uid: Date.now() + i
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
127
|
-
function me(e) {
|
|
128
|
-
const t = new Set(e.map((l) => l.url)), i = n.value.filter(
|
|
129
|
-
(l) => l.status === "uploading" && !t.has(l.url)
|
|
130
|
-
);
|
|
131
|
-
return [...e, ...i];
|
|
132
|
-
}
|
|
133
|
-
function K(e) {
|
|
134
|
-
const t = fe(e);
|
|
135
|
-
O = !0, c.value = t.text, n.value = me(ce(t.files)), Ce(() => {
|
|
136
|
-
O = !1;
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
function Q(e) {
|
|
140
|
-
return a.valueFormat === "array" ? e.files : a.valueFormat === "string" ? e.files.join(",") : e;
|
|
141
|
-
}
|
|
142
|
-
function ve() {
|
|
143
|
-
var e;
|
|
144
|
-
(e = _.value) == null || e.focus();
|
|
145
|
-
}
|
|
146
|
-
function ye(e) {
|
|
147
|
-
e.target.value = "";
|
|
148
|
-
}
|
|
149
|
-
function L(e) {
|
|
150
|
-
const l = { files: (e ?? n.value).filter((o) => o.status === "success" && o.url).map((o) => o.url), text: c.value };
|
|
151
|
-
y("update:modelValue", Q(l)), y("change", l), a.callBack && a.callBack(l);
|
|
152
|
-
}
|
|
153
|
-
function ge(e, t) {
|
|
154
|
-
L(t), y("remove", e, t);
|
|
155
|
-
}
|
|
156
|
-
function xe(e) {
|
|
157
|
-
var l;
|
|
158
|
-
if (!(e.size / 1024 / 1024 < a.fileSize))
|
|
159
|
-
return S.warning(`文件大小不能超过${a.fileSize}M`), !1;
|
|
160
|
-
const i = ((l = e.name.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
|
|
161
|
-
return x.value.includes(i) ? !0 : (S.warning(
|
|
162
|
-
`格式不支持,仅允许: ${x.value.join("/")}`
|
|
163
|
-
), !1);
|
|
164
|
-
}
|
|
165
|
-
function J(e, t, i, l) {
|
|
166
|
-
var ee, te;
|
|
167
|
-
const o = a.api.startsWith("http") ? a.api : window.location.origin + a.api.replace(/^([^/])/, "/$1"), d = new FormData();
|
|
168
|
-
d.append(a.name, e), a.extraData && Object.entries(a.extraData).forEach(([u, De]) => d.append(u, De));
|
|
169
|
-
const s = new XMLHttpRequest();
|
|
170
|
-
B.push(s);
|
|
171
|
-
const w = ((ee = q.value) == null ? void 0 : ee.$el.querySelector(".el-upload--picture-card")) || ((te = q.value) == null ? void 0 : te.$el), C = Fe.service({
|
|
172
|
-
target: w,
|
|
173
|
-
text: "上传中",
|
|
174
|
-
background: "rgba(255,255,255,0.7)"
|
|
175
|
-
}), f = () => {
|
|
176
|
-
const u = B.indexOf(s);
|
|
177
|
-
u !== -1 && B.splice(u, 1), C.close();
|
|
178
|
-
};
|
|
179
|
-
s.open("POST", o);
|
|
180
|
-
const Z = Ne(a.tokenKey);
|
|
181
|
-
Z && s.setRequestHeader("Authorization", `Bearer ${Z}`), s.upload.onprogress = (u) => {
|
|
182
|
-
u.total > 0 && (t == null || t({ percent: u.loaded / u.total * 100 }));
|
|
183
|
-
}, s.onload = () => {
|
|
184
|
-
if (f(), s.status < 200 || s.status >= 300) {
|
|
185
|
-
const u = `上传失败 (HTTP ${s.status})`;
|
|
186
|
-
S.error(u), y("error", { msg: u, status: s.status }), l == null || l(new Error(u));
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
try {
|
|
190
|
-
const u = JSON.parse(s.responseText);
|
|
191
|
-
u.code === 200 && u.urls ? (S.success("上传成功"), i == null || i({ ...u, url: u.urls })) : (S.error(u.msg || "上传失败"), y("error", u), l == null || l(u));
|
|
192
|
-
} catch {
|
|
193
|
-
S.error("上传失败,响应格式错误"), y("error", new Error("Response parse error")), l == null || l(new Error("Response parse error"));
|
|
194
|
-
}
|
|
195
|
-
}, s.onerror = () => {
|
|
196
|
-
f(), S.error("上传失败,网络异常"), y("error", new Error("Network error")), l == null || l(new Error("Network error"));
|
|
197
|
-
}, s.send(d);
|
|
198
|
-
}
|
|
199
|
-
function G(e) {
|
|
200
|
-
return a.disabled ? !1 : xe(e);
|
|
201
|
-
}
|
|
202
|
-
function be(e, t) {
|
|
203
|
-
const i = n.value.find(
|
|
204
|
-
(l) => {
|
|
205
|
-
var o;
|
|
206
|
-
return l.uid === (e == null ? void 0 : e.uid) || ((o = l.raw) == null ? void 0 : o.uid) === (e == null ? void 0 : e.uid);
|
|
207
|
-
}
|
|
208
|
-
);
|
|
209
|
-
i && (i.url = t, i.status = "success");
|
|
210
|
-
}
|
|
211
|
-
function he(e) {
|
|
212
|
-
J(
|
|
213
|
-
e.file,
|
|
214
|
-
e.onProgress,
|
|
215
|
-
(t) => {
|
|
216
|
-
be(e.file, t.url), e.onSuccess(t), L(), y("success", t);
|
|
217
|
-
},
|
|
218
|
-
(t) => e.onError(t)
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
function we(e) {
|
|
222
|
-
var l;
|
|
223
|
-
if (!e.url) return;
|
|
224
|
-
const t = ((l = e.url.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
|
|
225
|
-
if (["mp4", "mov", "avi", "webm"].includes(t)) {
|
|
226
|
-
H.value = e.url, W.value = e.name || "视频预览", D.value = !0;
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
const i = n.value.filter(
|
|
230
|
-
(o) => {
|
|
231
|
-
var d;
|
|
232
|
-
return o.status === "success" && o.url && !["mp4", "mov", "avi", "webm"].includes(
|
|
233
|
-
(d = o.url.split(".").pop()) == null ? void 0 : d.toLowerCase()
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
);
|
|
237
|
-
A.value = i.map((o) => o.url), E.value = i.findIndex((o) => o.uid === e.uid) || 0, $.value = !0;
|
|
238
|
-
}
|
|
239
|
-
function Ve() {
|
|
240
|
-
$.value = !1, A.value = [];
|
|
241
|
-
}
|
|
242
|
-
function Y(e) {
|
|
243
|
-
for (let t = 0; t < e.length; t++) {
|
|
244
|
-
const i = e[t];
|
|
245
|
-
if (!G(i)) continue;
|
|
246
|
-
const l = Date.now() + t, o = URL.createObjectURL(i);
|
|
247
|
-
j.add(o), n.value.push({
|
|
248
|
-
uid: l,
|
|
249
|
-
name: i.name || `file-${l}`,
|
|
250
|
-
status: "uploading",
|
|
251
|
-
percentage: 0,
|
|
252
|
-
url: o
|
|
253
|
-
}), J(
|
|
254
|
-
i,
|
|
255
|
-
(d) => {
|
|
256
|
-
const s = n.value.find((w) => w.uid === l);
|
|
257
|
-
s && (s.percentage = d.percent);
|
|
258
|
-
},
|
|
259
|
-
(d) => {
|
|
260
|
-
const s = n.value.find((w) => w.uid === l);
|
|
261
|
-
s && (s.status = "success", s.url = d.url, L(), y("success", d));
|
|
262
|
-
},
|
|
263
|
-
() => Be(l)
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
function T(e) {
|
|
268
|
-
var l;
|
|
269
|
-
if (a.disabled) return;
|
|
270
|
-
const t = (l = e.clipboardData) == null ? void 0 : l.items;
|
|
271
|
-
if (!t) return;
|
|
272
|
-
const i = [];
|
|
273
|
-
for (let o = 0; o < t.length; o++) {
|
|
274
|
-
const d = t[o];
|
|
275
|
-
if (d.kind === "file" && d.type.startsWith("image/")) {
|
|
276
|
-
const s = d.getAsFile();
|
|
277
|
-
s && i.push(s);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
i.length && (e.preventDefault(), Y(i));
|
|
281
|
-
}
|
|
282
|
-
function ke() {
|
|
283
|
-
a.disabled || a.disableDrag || (P.value = !0);
|
|
284
|
-
}
|
|
285
|
-
function Se() {
|
|
286
|
-
P.value = !1;
|
|
287
|
-
}
|
|
288
|
-
function Ue(e) {
|
|
289
|
-
var i;
|
|
290
|
-
if (P.value = !1, a.disabled || a.disableDrag || z.value) return;
|
|
291
|
-
const t = Array.from(((i = e.dataTransfer) == null ? void 0 : i.files) || []).filter(
|
|
292
|
-
(l) => {
|
|
293
|
-
var o;
|
|
294
|
-
return x.value.includes((o = l.name.split(".").pop()) == null ? void 0 : o.toLowerCase());
|
|
295
|
-
}
|
|
296
|
-
);
|
|
297
|
-
t.length && Y(t);
|
|
298
|
-
}
|
|
299
|
-
function Be(e) {
|
|
300
|
-
var i;
|
|
301
|
-
const t = n.value.findIndex((l) => l.uid === e);
|
|
302
|
-
t !== -1 && ((i = n.value[t].url) != null && i.startsWith("blob:") && (URL.revokeObjectURL(n.value[t].url), j.delete(n.value[t].url)), n.value.splice(t, 1));
|
|
303
|
-
}
|
|
304
|
-
return Ie(() => {
|
|
305
|
-
B.forEach((e) => e.abort()), B.length = 0, j.forEach((e) => URL.revokeObjectURL(e)), j.clear();
|
|
306
|
-
}), ie({
|
|
307
|
-
/** 主动打开文件选择框,供表单或快捷操作调用 */
|
|
308
|
-
openFileDialog: () => {
|
|
309
|
-
var e, t;
|
|
310
|
-
a.disabled || z.value || (t = (e = q.value) == null ? void 0 : e.$el.querySelector('input[type="file"]')) == null || t.click();
|
|
311
|
-
},
|
|
312
|
-
/** 获取已上传成功的文件 URL 列表 */
|
|
313
|
-
getPathList: () => n.value.filter((e) => e.status === "success").map((e) => e.url),
|
|
314
|
-
/** 清空文件和文字,并同步 change 事件 */
|
|
315
|
-
clearFiles: () => {
|
|
316
|
-
n.value = [], c.value = "", L();
|
|
317
|
-
},
|
|
318
|
-
/** 获取完整值,结构与 change 事件保持一致 */
|
|
319
|
-
getValue: () => ({
|
|
320
|
-
files: n.value.filter((e) => e.status === "success" && e.url).map((e) => e.url),
|
|
321
|
-
text: c.value
|
|
322
|
-
}),
|
|
323
|
-
/** 获取按 valueFormat 输出的值,便于外部不走 v-model 时读取 */
|
|
324
|
-
getModelValue: () => Q({
|
|
325
|
-
files: n.value.filter((e) => e.status === "success" && e.url).map((e) => e.url),
|
|
326
|
-
text: c.value
|
|
327
|
-
})
|
|
328
|
-
}), (e, t) => {
|
|
329
|
-
var C;
|
|
330
|
-
const i = Te, l = qe, o = Re, d = Le, s = je, w = Pe;
|
|
331
|
-
return m(), g("div", {
|
|
332
|
-
class: F(["qy-upload", pe.value]),
|
|
333
|
-
style: Oe({ "--qy-upload-size": ne.value })
|
|
334
|
-
}, [
|
|
335
|
-
b(d, {
|
|
336
|
-
ref_key: "uploadRef",
|
|
337
|
-
ref: q,
|
|
338
|
-
"file-list": n.value,
|
|
339
|
-
"onUpdate:fileList": t[6] || (t[6] = (f) => n.value = f),
|
|
340
|
-
action: "#",
|
|
341
|
-
multiple: r.supportVideo ? !1 : r.multiple,
|
|
342
|
-
limit: r.supportVideo ? 1 : r.limit,
|
|
343
|
-
"list-type": r.supportVideo ? "text" : "picture-card",
|
|
344
|
-
accept: de.value,
|
|
345
|
-
disabled: ue.value,
|
|
346
|
-
"http-request": he,
|
|
347
|
-
"before-upload": G,
|
|
348
|
-
"on-preview": we,
|
|
349
|
-
"on-remove": ge
|
|
350
|
-
}, {
|
|
351
|
-
default: U(() => [
|
|
352
|
-
z.value ? h("", !0) : (m(), g("div", {
|
|
353
|
-
key: 0,
|
|
354
|
-
class: F(["qy-upload__trigger", { "is-dragover": P.value }]),
|
|
355
|
-
onPaste: T,
|
|
356
|
-
onDragover: v(ke, ["prevent"]),
|
|
357
|
-
onDragleave: v(Se, ["prevent"]),
|
|
358
|
-
onDrop: v(Ue, ["prevent"])
|
|
359
|
-
}, [
|
|
360
|
-
b(i, { class: "qy-upload__icon" }, {
|
|
361
|
-
default: U(() => [
|
|
362
|
-
b(ae(Ae))
|
|
363
|
-
]),
|
|
364
|
-
_: 1
|
|
365
|
-
}),
|
|
366
|
-
r.supportVideo ? (m(), g(N, { key: 0 }, [
|
|
367
|
-
t[9] || (t[9] = k("span", { class: "qy-upload__label" }, "点击上传视频", -1)),
|
|
368
|
-
k("span", Ee, "支持 " + R(x.value.join(" / ")) + ",不超过 " + R(r.fileSize) + "MB", 1)
|
|
369
|
-
], 64)) : h("", !0),
|
|
370
|
-
r.showText ? (m(), g("div", {
|
|
371
|
-
key: 1,
|
|
372
|
-
class: "qy-upload__text",
|
|
373
|
-
onClick: t[3] || (t[3] = v(() => {
|
|
374
|
-
}, ["stop"])),
|
|
375
|
-
onPaste: v(T, ["stop"])
|
|
376
|
-
}, [
|
|
377
|
-
b(o, {
|
|
378
|
-
visible: M.value,
|
|
379
|
-
"onUpdate:visible": t[2] || (t[2] = (f) => M.value = f),
|
|
380
|
-
placement: "bottom-start",
|
|
381
|
-
width: 220,
|
|
382
|
-
trigger: "click",
|
|
383
|
-
"popper-class": "qy-upload__text-popover",
|
|
384
|
-
onAfterEnter: ve
|
|
385
|
-
}, {
|
|
386
|
-
reference: U(() => [
|
|
387
|
-
k("div", {
|
|
388
|
-
class: F(["qy-upload__text-preview", { "is-placeholder": !c.value }])
|
|
389
|
-
}, R(c.value || r.pastePlaceholder), 3)
|
|
390
|
-
]),
|
|
391
|
-
default: U(() => [
|
|
392
|
-
b(l, {
|
|
393
|
-
ref_key: "inputRef",
|
|
394
|
-
ref: _,
|
|
395
|
-
modelValue: c.value,
|
|
396
|
-
"onUpdate:modelValue": t[0] || (t[0] = (f) => c.value = f),
|
|
397
|
-
type: "textarea",
|
|
398
|
-
autosize: { minRows: 2, maxRows: 5 },
|
|
399
|
-
placeholder: r.pastePlaceholder,
|
|
400
|
-
disabled: r.disabled,
|
|
401
|
-
onBlur: t[1] || (t[1] = (f) => M.value = !1),
|
|
402
|
-
onPaste: v(T, ["stop"])
|
|
403
|
-
}, null, 8, ["modelValue", "placeholder", "disabled"])
|
|
404
|
-
]),
|
|
405
|
-
_: 1
|
|
406
|
-
}, 8, ["visible"])
|
|
407
|
-
], 32)) : r.showPasteInput ? (m(), g("div", {
|
|
408
|
-
key: 2,
|
|
409
|
-
class: "qy-upload__text",
|
|
410
|
-
onClick: t[5] || (t[5] = v(() => {
|
|
411
|
-
}, ["stop"])),
|
|
412
|
-
onPaste: v(T, ["stop"])
|
|
413
|
-
}, [
|
|
414
|
-
k("input", {
|
|
415
|
-
ref_key: "pasteInputRef",
|
|
416
|
-
ref: se,
|
|
417
|
-
class: "qy-upload__paste-input",
|
|
418
|
-
placeholder: r.pastePlaceholder,
|
|
419
|
-
disabled: r.disabled,
|
|
420
|
-
onPaste: v(T, ["stop"]),
|
|
421
|
-
onInput: ye,
|
|
422
|
-
onClick: t[4] || (t[4] = v(() => {
|
|
423
|
-
}, ["stop"]))
|
|
424
|
-
}, null, 40, He)
|
|
425
|
-
], 32)) : h("", !0)
|
|
426
|
-
], 34))
|
|
427
|
-
]),
|
|
428
|
-
_: 1
|
|
429
|
-
}, 8, ["file-list", "multiple", "limit", "list-type", "accept", "disabled"]),
|
|
430
|
-
$.value ? (m(), $e(s, {
|
|
431
|
-
key: 0,
|
|
432
|
-
"url-list": A.value,
|
|
433
|
-
"initial-index": E.value,
|
|
434
|
-
onClose: Ve
|
|
435
|
-
}, null, 8, ["url-list", "initial-index"])) : h("", !0),
|
|
436
|
-
b(w, {
|
|
437
|
-
modelValue: D.value,
|
|
438
|
-
"onUpdate:modelValue": t[7] || (t[7] = (f) => D.value = f),
|
|
439
|
-
title: W.value,
|
|
440
|
-
width: "640px",
|
|
441
|
-
"append-to-body": "",
|
|
442
|
-
"destroy-on-close": "",
|
|
443
|
-
onClose: t[8] || (t[8] = (f) => D.value = !1)
|
|
444
|
-
}, {
|
|
445
|
-
default: U(() => [
|
|
446
|
-
D.value ? (m(), g("video", {
|
|
447
|
-
key: 0,
|
|
448
|
-
src: H.value,
|
|
449
|
-
controls: "",
|
|
450
|
-
autoplay: "",
|
|
451
|
-
style: { width: "100%", "max-height": "400px", "border-radius": "4px" }
|
|
452
|
-
}, null, 8, We)) : h("", !0)
|
|
453
|
-
]),
|
|
454
|
-
_: 1
|
|
455
|
-
}, 8, ["modelValue", "title"]),
|
|
456
|
-
re.value ? (m(), g("div", Xe, [
|
|
457
|
-
b(i, null, {
|
|
458
|
-
default: U(() => [
|
|
459
|
-
b(ae(Me))
|
|
460
|
-
]),
|
|
461
|
-
_: 1
|
|
462
|
-
}),
|
|
463
|
-
k("span", null, [
|
|
464
|
-
t[12] || (t[12] = I(" 请上传 ", -1)),
|
|
465
|
-
r.fileSize ? (m(), g(N, { key: 0 }, [
|
|
466
|
-
t[10] || (t[10] = I("大小不超过 ", -1)),
|
|
467
|
-
k("b", Ke, R(r.fileSize) + "MB", 1)
|
|
468
|
-
], 64)) : h("", !0),
|
|
469
|
-
(C = x.value) != null && C.length ? (m(), g(N, { key: 1 }, [
|
|
470
|
-
t[11] || (t[11] = I(",格式为 ", -1)),
|
|
471
|
-
k("b", Qe, R(x.value.join("/")), 1)
|
|
472
|
-
], 64)) : h("", !0),
|
|
473
|
-
t[13] || (t[13] = I(" 的文件。 ", -1))
|
|
474
|
-
])
|
|
475
|
-
])) : h("", !0)
|
|
476
|
-
], 6);
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
}), ot = /* @__PURE__ */ _e(Je, [["__scopeId", "data-v-1d6de9b6"]]);
|
|
480
|
-
export {
|
|
481
|
-
ot as default
|
|
482
|
-
};
|
package/dist/lib/utils/auth.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.cjs"),o="Admin-Token";function n(e=o){return t.default.get(e)}exports.getToken=n;
|
package/dist/lib/utils/auth.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(l,i=l==null?void 0:l.name){return i&&(l.install=r=>{r.component(i,l)}),l}exports.withInstall=t;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});/*! js-cookie v3.0.5 | MIT */function u(r){for(var t=1;t<arguments.length;t++){var f=arguments[t];for(var p in f)r[p]=f[p]}return r}var l={read:function(r){return r[0]==='"'&&(r=r.slice(1,-1)),r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(r){return encodeURIComponent(r).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function s(r,t){function f(n,c,e){if(!(typeof document>"u")){e=u({},t,e),typeof e.expires=="number"&&(e.expires=new Date(Date.now()+e.expires*864e5)),e.expires&&(e.expires=e.expires.toUTCString()),n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var i in e)e[i]&&(o+="; "+i,e[i]!==!0&&(o+="="+e[i].split(";")[0]));return document.cookie=n+"="+r.write(c,n)+o}}function p(n){if(!(typeof document>"u"||arguments.length&&!n)){for(var c=document.cookie?document.cookie.split("; "):[],e={},o=0;o<c.length;o++){var i=c[o].split("="),v=i.slice(1).join("=");try{var d=decodeURIComponent(i[0]);if(e[d]=r.read(v,d),n===d)break}catch{}}return n?e[n]:e}}return Object.create({set:f,get:p,remove:function(n,c){f(n,"",u({},c,{expires:-1}))},withAttributes:function(n){return s(this.converter,u({},this.attributes,n))},withConverter:function(n){return s(u({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(r)}})}var g=s(l,{path:"/"});exports.default=g;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/*! js-cookie v3.0.5 | MIT */
|
|
2
|
-
function d(r) {
|
|
3
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
4
|
-
var f = arguments[t];
|
|
5
|
-
for (var p in f)
|
|
6
|
-
r[p] = f[p];
|
|
7
|
-
}
|
|
8
|
-
return r;
|
|
9
|
-
}
|
|
10
|
-
var g = {
|
|
11
|
-
read: function(r) {
|
|
12
|
-
return r[0] === '"' && (r = r.slice(1, -1)), r.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
13
|
-
},
|
|
14
|
-
write: function(r) {
|
|
15
|
-
return encodeURIComponent(r).replace(
|
|
16
|
-
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
17
|
-
decodeURIComponent
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
function s(r, t) {
|
|
22
|
-
function f(n, c, e) {
|
|
23
|
-
if (!(typeof document > "u")) {
|
|
24
|
-
e = d({}, t, e), typeof e.expires == "number" && (e.expires = new Date(Date.now() + e.expires * 864e5)), e.expires && (e.expires = e.expires.toUTCString()), n = encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
25
|
-
var o = "";
|
|
26
|
-
for (var i in e)
|
|
27
|
-
e[i] && (o += "; " + i, e[i] !== !0 && (o += "=" + e[i].split(";")[0]));
|
|
28
|
-
return document.cookie = n + "=" + r.write(c, n) + o;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function p(n) {
|
|
32
|
-
if (!(typeof document > "u" || arguments.length && !n)) {
|
|
33
|
-
for (var c = document.cookie ? document.cookie.split("; ") : [], e = {}, o = 0; o < c.length; o++) {
|
|
34
|
-
var i = c[o].split("="), v = i.slice(1).join("=");
|
|
35
|
-
try {
|
|
36
|
-
var u = decodeURIComponent(i[0]);
|
|
37
|
-
if (e[u] = r.read(v, u), n === u)
|
|
38
|
-
break;
|
|
39
|
-
} catch {
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return n ? e[n] : e;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return Object.create(
|
|
46
|
-
{
|
|
47
|
-
set: f,
|
|
48
|
-
get: p,
|
|
49
|
-
remove: function(n, c) {
|
|
50
|
-
f(
|
|
51
|
-
n,
|
|
52
|
-
"",
|
|
53
|
-
d({}, c, {
|
|
54
|
-
expires: -1
|
|
55
|
-
})
|
|
56
|
-
);
|
|
57
|
-
},
|
|
58
|
-
withAttributes: function(n) {
|
|
59
|
-
return s(this.converter, d({}, this.attributes, n));
|
|
60
|
-
},
|
|
61
|
-
withConverter: function(n) {
|
|
62
|
-
return s(d({}, this.converter, n), this.attributes);
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
attributes: { value: Object.freeze(t) },
|
|
67
|
-
converter: { value: Object.freeze(r) }
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
var C = s(g, { path: "/" });
|
|
72
|
-
export {
|
|
73
|
-
C as default
|
|
74
|
-
};
|