@qynpm/ui 1.0.2 → 1.0.5
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 -59
- package/dist/_virtual/_plugin-vue_export-helper.cjs +1 -0
- package/dist/_virtual/_plugin-vue_export-helper.mjs +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +21 -0
- package/dist/lib/dialog/index.vue.cjs +1 -0
- package/dist/{index-CibtL3Up.mjs → lib/dialog/index.vue.mjs} +12 -12
- package/dist/lib/dialog/index.vue3.cjs +1 -0
- package/dist/lib/dialog/index.vue3.mjs +5 -0
- package/dist/lib/index.cjs +1 -0
- package/dist/lib/index.mjs +53 -0
- package/dist/lib/qy-action-bar/index.vue.cjs +1 -0
- package/dist/lib/qy-action-bar/index.vue.mjs +7 -0
- package/dist/lib/qy-action-bar/index.vue2.cjs +1 -0
- package/dist/{index-DlwgfuD9.mjs → lib/qy-action-bar/index.vue2.mjs} +12 -12
- package/dist/lib/qy-form-section/index.vue.cjs +1 -0
- package/dist/lib/qy-form-section/index.vue.mjs +7 -0
- package/dist/lib/qy-form-section/index.vue2.cjs +1 -0
- package/dist/{index-Cuwe7RLf.mjs → lib/qy-form-section/index.vue2.mjs} +19 -20
- package/dist/lib/qy-input/index.vue.cjs +1 -0
- package/dist/{index-CEg8yYrg.mjs → lib/qy-input/index.vue.mjs} +8 -7
- package/dist/lib/qy-input/index.vue2.cjs +1 -0
- package/dist/lib/qy-input/index.vue2.mjs +4 -0
- package/dist/lib/qy-money-input/index.vue.cjs +1 -0
- package/dist/lib/qy-money-input/index.vue.mjs +171 -0
- package/dist/lib/qy-money-input/index.vue2.cjs +1 -0
- package/dist/lib/qy-money-input/index.vue2.mjs +4 -0
- package/dist/lib/qy-radio-group/index.vue.cjs +1 -0
- package/dist/lib/qy-radio-group/index.vue.mjs +90 -0
- package/dist/lib/qy-radio-group/index.vue2.cjs +1 -0
- package/dist/lib/qy-radio-group/index.vue2.mjs +4 -0
- package/dist/lib/qy-record-quote-search/index.vue.cjs +1 -0
- package/dist/lib/qy-record-quote-search/index.vue.mjs +7 -0
- package/dist/lib/qy-record-quote-search/index.vue2.cjs +1 -0
- package/dist/{index-BzzxlJ2O.mjs → lib/qy-record-quote-search/index.vue2.mjs} +68 -69
- package/dist/lib/qy-remote-select/index.vue.cjs +1 -0
- package/dist/lib/qy-remote-select/index.vue.mjs +214 -0
- package/dist/lib/qy-remote-select/index.vue2.cjs +1 -0
- package/dist/lib/qy-remote-select/index.vue2.mjs +4 -0
- package/dist/lib/qy-search-input/index.vue.cjs +1 -0
- package/dist/lib/qy-search-input/index.vue.mjs +7 -0
- package/dist/lib/qy-search-input/index.vue2.cjs +1 -0
- package/dist/{index-C02naY8D.mjs → lib/qy-search-input/index.vue2.mjs} +77 -77
- package/dist/lib/qy-select/index.vue.cjs +1 -0
- package/dist/lib/qy-select/index.vue.mjs +162 -0
- package/dist/lib/qy-select/index.vue2.cjs +1 -0
- package/dist/lib/qy-select/index.vue2.mjs +4 -0
- package/dist/lib/qy-voucher-upload/index.vue.cjs +1 -0
- package/dist/lib/qy-voucher-upload/index.vue.mjs +123 -0
- package/dist/lib/remark-image/index.vue.cjs +1 -0
- package/dist/lib/remark-image/index.vue.mjs +7 -0
- package/dist/lib/remark-image/index.vue2.cjs +1 -0
- package/dist/lib/remark-image/index.vue2.mjs +197 -0
- package/dist/lib/remark-image/utils.cjs +1 -0
- package/dist/lib/remark-image/utils.mjs +22 -0
- package/dist/lib/upload/index.vue.cjs +1 -0
- package/dist/lib/upload/index.vue.mjs +482 -0
- package/dist/lib/utils/auth.cjs +1 -0
- package/dist/lib/utils/auth.mjs +8 -0
- package/dist/lib/utils/install.cjs +1 -0
- package/dist/{install-CxBnxbuN.mjs → lib/utils/install.mjs} +2 -2
- package/dist/node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.cjs +1 -0
- package/dist/{js.cookie-tagl12-O.mjs → node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs} +6 -6
- package/dist/qy-action-bar/index.cjs +1 -1
- package/dist/qy-action-bar/index.mjs +6 -0
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +7 -0
- package/dist/qy-form-section/index.cjs +1 -1
- package/dist/qy-form-section/index.mjs +6 -0
- package/dist/qy-input/index.cjs +1 -1
- package/dist/qy-input/index.mjs +6 -0
- package/dist/qy-money-input/index.cjs +1 -0
- package/dist/qy-money-input/index.mjs +6 -0
- package/dist/qy-radio-group/index.cjs +1 -0
- package/dist/qy-radio-group/index.mjs +6 -0
- package/dist/qy-record-quote-search/index.cjs +1 -1
- package/dist/qy-record-quote-search/index.mjs +6 -0
- package/dist/qy-remark-image/index.cjs +2 -2
- package/dist/qy-remark-image/index.mjs +7 -0
- package/dist/qy-remote-select/index.cjs +1 -0
- package/dist/qy-remote-select/index.mjs +6 -0
- package/dist/qy-search-input/index.cjs +1 -1
- package/dist/qy-search-input/index.mjs +6 -0
- package/dist/qy-select/index.cjs +1 -1
- package/dist/qy-select/index.mjs +6 -0
- package/dist/qy-upload/index.cjs +1 -1
- package/dist/qy-upload/index.mjs +6 -0
- package/dist/qy-voucher-upload/index.cjs +1 -0
- package/dist/qy-voucher-upload/index.mjs +6 -0
- package/index.d.ts +20 -11
- package/package.json +36 -12
- package/qy-money-input/index.d.ts +12 -0
- package/qy-money-input/index.js +15 -0
- package/qy-radio-group/index.d.ts +12 -0
- package/qy-radio-group/index.js +15 -0
- package/qy-remote-select/index.d.ts +12 -0
- package/qy-remote-select/index.js +15 -0
- package/qy-voucher-upload/index.d.ts +12 -0
- package/qy-voucher-upload/index.js +15 -0
- package/dist/index-1ocyh-Ge.js +0 -1
- package/dist/index-BYAIkGVF.js +0 -1
- package/dist/index-BaU5rDMh.js +0 -1
- package/dist/index-BddPsC3s.mjs +0 -384
- package/dist/index-CzJWU89H.js +0 -1
- package/dist/index-DQ-EEZgS.js +0 -1
- package/dist/index-Dg93AsO_.mjs +0 -216
- package/dist/index-Djj-T8oy.mjs +0 -137
- package/dist/index-Do5SZ8yS.js +0 -1
- package/dist/index-DooOsQ9d.js +0 -1
- package/dist/index-DzX3lxdp.js +0 -1
- package/dist/index-tC70xKe_.js +0 -1
- package/dist/install-c8il9DQv.js +0 -1
- package/dist/js.cookie-XvHV2tha.js +0 -1
- package/dist/plugin-vue_export-helper-BHFhmbuH.js +0 -1
- package/dist/plugin-vue_export-helper-CHgC5LLL.mjs +0 -9
package/dist/index-BddPsC3s.mjs
DELETED
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
import { ElUpload as me, ElIcon as ye, ElPopover as ge, ElInput as be, ElImageViewer as xe, ElDialog as we } from "element-plus/es";
|
|
2
|
-
import { ref as c, onMounted as he, computed as x, watch as ke, onBeforeUnmount as Ve, createElementBlock as w, openBlock as m, normalizeStyle as Ue, normalizeClass as I, createVNode as y, createBlock as Be, createCommentVNode as h, withCtx as U, withModifiers as B, createElementVNode as k, unref as Y, Fragment as M, toDisplayString as R, createTextVNode as $ } from "vue";
|
|
3
|
-
import { Plus as Le, InfoFilled as Se } from "@element-plus/icons-vue";
|
|
4
|
-
import { ElMessage as V, ElLoading as De } from "element-plus";
|
|
5
|
-
import { a as Re } from "./js.cookie-tagl12-O.mjs";
|
|
6
|
-
import { _ as Te } from "./plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
7
|
-
const qe = "Admin-Token";
|
|
8
|
-
function ze(p = qe) {
|
|
9
|
-
return Re.get(p);
|
|
10
|
-
}
|
|
11
|
-
const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
12
|
-
key: 1,
|
|
13
|
-
class: "qy-upload__tip"
|
|
14
|
-
}, Ce = { class: "error" }, Ae = { class: "error" }, Fe = Object.assign({
|
|
15
|
-
name: "QyUpload"
|
|
16
|
-
}, {
|
|
17
|
-
__name: "index",
|
|
18
|
-
props: {
|
|
19
|
-
/**
|
|
20
|
-
* 初始值,结构为 { files: '逗号分隔的URL', text: '文字内容' }
|
|
21
|
-
* 非受控模式,仅初始化时读取一次
|
|
22
|
-
*/
|
|
23
|
-
defaultValue: { type: Object, default: () => ({ files: "", text: "" }) },
|
|
24
|
-
/** 是否多选 */
|
|
25
|
-
multiple: { type: Boolean, default: !0 },
|
|
26
|
-
/** 是否禁用 */
|
|
27
|
-
disabled: { type: Boolean, default: !1 },
|
|
28
|
-
/** 允许的文件类型后缀(如 ['jpg', 'mp4']) */
|
|
29
|
-
fileType: { type: Array, default: () => [] },
|
|
30
|
-
/** 单个文件大小限制(MB) */
|
|
31
|
-
fileSize: { type: Number, default: 10 },
|
|
32
|
-
/** 文件数量限制 */
|
|
33
|
-
limit: { type: Number, default: 9 },
|
|
34
|
-
/** 是否显示格式/大小提示 */
|
|
35
|
-
isShowTip: { type: Boolean, default: !1 },
|
|
36
|
-
/** 接口路径 */
|
|
37
|
-
api: { type: String, default: "/permission-api/common/uploads" },
|
|
38
|
-
/** FormData 中文件字段名 */
|
|
39
|
-
name: { type: String, default: "file" },
|
|
40
|
-
tokenKey: { type: String, default: "Admin-Token" },
|
|
41
|
-
/** 是否支持视频模式(强制 limit=1) */
|
|
42
|
-
supportVideo: { type: Boolean, default: !1 },
|
|
43
|
-
/**
|
|
44
|
-
* 卡片尺寸
|
|
45
|
-
* 预设:'large'(160px) | 'default'(140px) | 'small'(80px)
|
|
46
|
-
* 自定义:任意 CSS 单位,如 '60px'、'8vw'
|
|
47
|
-
*/
|
|
48
|
-
size: { type: String, default: "default" },
|
|
49
|
-
/** 禁用拖拽(默认在触发区开启) */
|
|
50
|
-
disableDrag: { type: Boolean, default: !1 },
|
|
51
|
-
/** 成功回调(用于复杂业务联动) */
|
|
52
|
-
callBack: { type: Function, default: null },
|
|
53
|
-
/** 上传时附加的额外 FormData 字段 */
|
|
54
|
-
extraData: { type: Object, default: () => ({}) }
|
|
55
|
-
},
|
|
56
|
-
emits: ["change", "success", "error", "remove"],
|
|
57
|
-
setup(p, { expose: Z, emit: ee }) {
|
|
58
|
-
const o = p, g = ee, T = c(null), u = c([]), N = c(null), L = [], C = c(!1), A = c([]), P = c(0), S = c(!1), E = c(""), H = c(""), q = /* @__PURE__ */ new Set(), z = c(!1), f = c(""), F = c(!1);
|
|
59
|
-
he(() => {
|
|
60
|
-
const t = o.defaultValue;
|
|
61
|
-
if (!t) return;
|
|
62
|
-
f.value = t.text ?? "";
|
|
63
|
-
const e = t.files ?? "", a = Array.isArray(e) ? e.filter(Boolean) : String(e).split(",").filter(Boolean);
|
|
64
|
-
a.length && (u.value = a.map((l, i) => ({
|
|
65
|
-
name: l.split("/").pop() || `file-${i}`,
|
|
66
|
-
url: l,
|
|
67
|
-
status: "success",
|
|
68
|
-
uid: Date.now() + i
|
|
69
|
-
})));
|
|
70
|
-
});
|
|
71
|
-
const te = x(() => ({ large: "160px", default: "140px", small: "80px" })[o.size] ?? o.size), le = x(() => o.disabled), ae = x(
|
|
72
|
-
() => {
|
|
73
|
-
var t;
|
|
74
|
-
return o.isShowTip && (o.fileSize || ((t = v.value) == null ? void 0 : t.length));
|
|
75
|
-
}
|
|
76
|
-
), v = x(() => {
|
|
77
|
-
var t;
|
|
78
|
-
return (t = o.fileType) != null && t.length ? o.fileType.map((e) => e.toLowerCase()) : o.supportVideo ? ["mp4", "mov", "avi"] : ["jpg", "jpeg", "png", "gif", "webp"];
|
|
79
|
-
}), _ = x(() => {
|
|
80
|
-
const t = o.supportVideo ? 1 : o.limit;
|
|
81
|
-
return u.value.length >= t;
|
|
82
|
-
}), ie = x(
|
|
83
|
-
() => v.value.map((t) => `.${t}`).join(",")
|
|
84
|
-
), oe = x(() => ({
|
|
85
|
-
"qy-upload--reached-limit": _.value,
|
|
86
|
-
"qy-upload--disabled": o.disabled,
|
|
87
|
-
"qy-upload--video": o.supportVideo
|
|
88
|
-
}));
|
|
89
|
-
ke(f, () => D());
|
|
90
|
-
function se() {
|
|
91
|
-
var t;
|
|
92
|
-
(t = N.value) == null || t.focus();
|
|
93
|
-
}
|
|
94
|
-
function D(t) {
|
|
95
|
-
const l = { files: (t ?? u.value).filter((i) => i.status === "success" && i.url).map((i) => i.url), text: f.value };
|
|
96
|
-
g("change", l), o.callBack && o.callBack(l);
|
|
97
|
-
}
|
|
98
|
-
function ne(t, e) {
|
|
99
|
-
D(e);
|
|
100
|
-
}
|
|
101
|
-
function ue(t) {
|
|
102
|
-
var l;
|
|
103
|
-
if (!(t.size / 1024 / 1024 < o.fileSize))
|
|
104
|
-
return V.warning(`文件大小不能超过${o.fileSize}M`), !1;
|
|
105
|
-
const a = ((l = t.name.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
|
|
106
|
-
return v.value.includes(a) ? !0 : (V.warning(
|
|
107
|
-
`格式不支持,仅允许: ${v.value.join("/")}`
|
|
108
|
-
), !1);
|
|
109
|
-
}
|
|
110
|
-
function K(t, e, a, l) {
|
|
111
|
-
var J, G;
|
|
112
|
-
const i = o.api.startsWith("http") ? o.api : window.location.origin + o.api.replace(/^([^/])/, "/$1"), r = new FormData();
|
|
113
|
-
r.append(o.name, t), o.extraData && Object.entries(o.extraData).forEach(([n, ve]) => r.append(n, ve));
|
|
114
|
-
const s = new XMLHttpRequest();
|
|
115
|
-
L.push(s);
|
|
116
|
-
const b = ((J = T.value) == null ? void 0 : J.$el.querySelector(".el-upload--picture-card")) || ((G = T.value) == null ? void 0 : G.$el), j = De.service({
|
|
117
|
-
target: b,
|
|
118
|
-
text: "上传中",
|
|
119
|
-
background: "rgba(255,255,255,0.7)"
|
|
120
|
-
}), d = () => {
|
|
121
|
-
const n = L.indexOf(s);
|
|
122
|
-
n !== -1 && L.splice(n, 1), j.close();
|
|
123
|
-
};
|
|
124
|
-
s.open("POST", i);
|
|
125
|
-
const X = ze(o.tokenKey);
|
|
126
|
-
X && s.setRequestHeader("Authorization", `Bearer ${X}`), s.upload.onprogress = (n) => {
|
|
127
|
-
n.total > 0 && (e == null || e({ percent: n.loaded / n.total * 100 }));
|
|
128
|
-
}, s.onload = () => {
|
|
129
|
-
if (d(), s.status < 200 || s.status >= 300) {
|
|
130
|
-
const n = `上传失败 (HTTP ${s.status})`;
|
|
131
|
-
V.error(n), g("error", { msg: n, status: s.status }), l == null || l(new Error(n));
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
try {
|
|
135
|
-
const n = JSON.parse(s.responseText);
|
|
136
|
-
n.code === 200 && n.urls ? (V.success("上传成功"), a == null || a({ ...n, url: n.urls })) : (V.error(n.msg || "上传失败"), g("error", n), l == null || l(n));
|
|
137
|
-
} catch {
|
|
138
|
-
V.error("上传失败,响应格式错误"), g("error", new Error("Response parse error")), l == null || l(new Error("Response parse error"));
|
|
139
|
-
}
|
|
140
|
-
}, s.onerror = () => {
|
|
141
|
-
d(), V.error("上传失败,网络异常"), g("error", new Error("Network error")), l == null || l(new Error("Network error"));
|
|
142
|
-
}, s.send(r);
|
|
143
|
-
}
|
|
144
|
-
function Q(t) {
|
|
145
|
-
return o.disabled ? !1 : ue(t);
|
|
146
|
-
}
|
|
147
|
-
function re(t) {
|
|
148
|
-
K(
|
|
149
|
-
t.file,
|
|
150
|
-
t.onProgress,
|
|
151
|
-
(e) => {
|
|
152
|
-
t.onSuccess(e), D(), g("success", e);
|
|
153
|
-
},
|
|
154
|
-
(e) => t.onError(e)
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
function de(t) {
|
|
158
|
-
var l;
|
|
159
|
-
if (!t.url) return;
|
|
160
|
-
const e = ((l = t.url.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
|
|
161
|
-
if (["mp4", "mov", "avi", "webm"].includes(e)) {
|
|
162
|
-
E.value = t.url, H.value = t.name || "视频预览", S.value = !0;
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
const a = u.value.filter(
|
|
166
|
-
(i) => {
|
|
167
|
-
var r;
|
|
168
|
-
return i.status === "success" && i.url && !["mp4", "mov", "avi", "webm"].includes(
|
|
169
|
-
(r = i.url.split(".").pop()) == null ? void 0 : r.toLowerCase()
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
);
|
|
173
|
-
A.value = a.map((i) => i.url), P.value = a.findIndex((i) => i.uid === t.uid) || 0, C.value = !0;
|
|
174
|
-
}
|
|
175
|
-
function pe() {
|
|
176
|
-
C.value = !1, A.value = [];
|
|
177
|
-
}
|
|
178
|
-
function W(t) {
|
|
179
|
-
for (let e = 0; e < t.length; e++) {
|
|
180
|
-
const a = t[e];
|
|
181
|
-
if (!Q(a)) continue;
|
|
182
|
-
const l = Date.now() + e, i = URL.createObjectURL(a);
|
|
183
|
-
q.add(i), u.value.push({
|
|
184
|
-
uid: l,
|
|
185
|
-
name: a.name || `file-${l}`,
|
|
186
|
-
status: "uploading",
|
|
187
|
-
percentage: 0,
|
|
188
|
-
url: i
|
|
189
|
-
}), K(
|
|
190
|
-
a,
|
|
191
|
-
(r) => {
|
|
192
|
-
const s = u.value.find((b) => b.uid === l);
|
|
193
|
-
s && (s.percentage = r.percent);
|
|
194
|
-
},
|
|
195
|
-
(r) => {
|
|
196
|
-
const s = u.value.find((b) => b.uid === l);
|
|
197
|
-
s && (s.status = "success", s.url = r.url, D(), g("success", r));
|
|
198
|
-
},
|
|
199
|
-
() => fe(l)
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
function O(t) {
|
|
204
|
-
var l;
|
|
205
|
-
if (o.disabled) return;
|
|
206
|
-
const e = (l = t.clipboardData) == null ? void 0 : l.items;
|
|
207
|
-
if (!e) return;
|
|
208
|
-
const a = [];
|
|
209
|
-
for (let i = 0; i < e.length; i++) {
|
|
210
|
-
const r = e[i];
|
|
211
|
-
if (r.kind === "file" && r.type.startsWith("image/")) {
|
|
212
|
-
const s = r.getAsFile();
|
|
213
|
-
s && a.push(s);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
a.length && (t.preventDefault(), W(a));
|
|
217
|
-
}
|
|
218
|
-
function ce(t) {
|
|
219
|
-
var a;
|
|
220
|
-
if (z.value = !1, o.disabled || _.value) return;
|
|
221
|
-
const e = Array.from(((a = t.dataTransfer) == null ? void 0 : a.files) || []).filter(
|
|
222
|
-
(l) => {
|
|
223
|
-
var i;
|
|
224
|
-
return v.value.includes((i = l.name.split(".").pop()) == null ? void 0 : i.toLowerCase());
|
|
225
|
-
}
|
|
226
|
-
);
|
|
227
|
-
e.length && W(e);
|
|
228
|
-
}
|
|
229
|
-
function fe(t) {
|
|
230
|
-
var a;
|
|
231
|
-
const e = u.value.findIndex((l) => l.uid === t);
|
|
232
|
-
e !== -1 && ((a = u.value[e].url) != null && a.startsWith("blob:") && (URL.revokeObjectURL(u.value[e].url), q.delete(u.value[e].url)), u.value.splice(e, 1));
|
|
233
|
-
}
|
|
234
|
-
return Ve(() => {
|
|
235
|
-
L.forEach((t) => t.abort()), L.length = 0, q.forEach((t) => URL.revokeObjectURL(t)), q.clear();
|
|
236
|
-
}), Z({
|
|
237
|
-
openFileDialog: () => {
|
|
238
|
-
var t, e;
|
|
239
|
-
o.disabled || _.value || (e = (t = T.value) == null ? void 0 : t.$el.querySelector('input[type="file"]')) == null || e.click();
|
|
240
|
-
},
|
|
241
|
-
getPathList: () => u.value.filter((t) => t.status === "success").map((t) => t.url),
|
|
242
|
-
clearFiles: () => {
|
|
243
|
-
u.value = [], f.value = "", D();
|
|
244
|
-
},
|
|
245
|
-
getValue: () => ({
|
|
246
|
-
files: u.value.filter((t) => t.status === "success" && t.url).map((t) => t.url),
|
|
247
|
-
text: f.value
|
|
248
|
-
})
|
|
249
|
-
}), (t, e) => {
|
|
250
|
-
var j;
|
|
251
|
-
const a = ye, l = be, i = ge, r = me, s = xe, b = we;
|
|
252
|
-
return m(), w("div", {
|
|
253
|
-
class: I(["qy-upload", oe.value]),
|
|
254
|
-
style: Ue({ "--qy-upload-size": te.value })
|
|
255
|
-
}, [
|
|
256
|
-
y(r, {
|
|
257
|
-
ref_key: "uploadRef",
|
|
258
|
-
ref: T,
|
|
259
|
-
"file-list": u.value,
|
|
260
|
-
"onUpdate:fileList": e[6] || (e[6] = (d) => u.value = d),
|
|
261
|
-
action: "#",
|
|
262
|
-
multiple: p.supportVideo ? !1 : p.multiple,
|
|
263
|
-
limit: p.supportVideo ? 1 : p.limit,
|
|
264
|
-
"list-type": p.supportVideo ? "text" : "picture-card",
|
|
265
|
-
accept: ie.value,
|
|
266
|
-
disabled: le.value,
|
|
267
|
-
"http-request": re,
|
|
268
|
-
"before-upload": Q,
|
|
269
|
-
"on-preview": de,
|
|
270
|
-
"on-remove": ne
|
|
271
|
-
}, {
|
|
272
|
-
default: U(() => [
|
|
273
|
-
_.value ? h("", !0) : (m(), w("div", {
|
|
274
|
-
key: 0,
|
|
275
|
-
class: I(["qy-upload__trigger", { "is-dragover": z.value }]),
|
|
276
|
-
onPaste: O,
|
|
277
|
-
onDragover: e[4] || (e[4] = B((d) => z.value = !0, ["prevent"])),
|
|
278
|
-
onDragleave: e[5] || (e[5] = B((d) => z.value = !1, ["prevent"])),
|
|
279
|
-
onDrop: B(ce, ["prevent"])
|
|
280
|
-
}, [
|
|
281
|
-
y(a, { class: "qy-upload__icon" }, {
|
|
282
|
-
default: U(() => [
|
|
283
|
-
y(Y(Le))
|
|
284
|
-
]),
|
|
285
|
-
_: 1
|
|
286
|
-
}),
|
|
287
|
-
p.supportVideo ? (m(), w(M, { key: 0 }, [
|
|
288
|
-
e[9] || (e[9] = k("span", { class: "qy-upload__label" }, "点击上传视频", -1)),
|
|
289
|
-
k("span", _e, "支持 " + R(v.value.join(" / ")) + ",不超过 " + R(p.fileSize) + "MB", 1)
|
|
290
|
-
], 64)) : h("", !0),
|
|
291
|
-
k("div", {
|
|
292
|
-
class: "qy-upload__text",
|
|
293
|
-
onClick: e[3] || (e[3] = B(() => {
|
|
294
|
-
}, ["stop"])),
|
|
295
|
-
onPaste: B(O, ["stop"])
|
|
296
|
-
}, [
|
|
297
|
-
y(i, {
|
|
298
|
-
visible: F.value,
|
|
299
|
-
"onUpdate:visible": e[2] || (e[2] = (d) => F.value = d),
|
|
300
|
-
placement: "bottom-start",
|
|
301
|
-
width: 220,
|
|
302
|
-
trigger: "click",
|
|
303
|
-
"popper-class": "qy-upload__text-popover",
|
|
304
|
-
onAfterEnter: se
|
|
305
|
-
}, {
|
|
306
|
-
reference: U(() => [
|
|
307
|
-
k("div", {
|
|
308
|
-
class: I(["qy-upload__text-preview", { "is-placeholder": !f.value }])
|
|
309
|
-
}, R(f.value || "输入文字"), 3)
|
|
310
|
-
]),
|
|
311
|
-
default: U(() => [
|
|
312
|
-
y(l, {
|
|
313
|
-
ref_key: "inputRef",
|
|
314
|
-
ref: N,
|
|
315
|
-
modelValue: f.value,
|
|
316
|
-
"onUpdate:modelValue": e[0] || (e[0] = (d) => f.value = d),
|
|
317
|
-
type: "textarea",
|
|
318
|
-
autosize: { minRows: 2, maxRows: 5 },
|
|
319
|
-
placeholder: "输入文字或粘贴图片",
|
|
320
|
-
disabled: p.disabled,
|
|
321
|
-
onBlur: e[1] || (e[1] = (d) => F.value = !1),
|
|
322
|
-
onPaste: B(O, ["stop"])
|
|
323
|
-
}, null, 8, ["modelValue", "disabled"])
|
|
324
|
-
]),
|
|
325
|
-
_: 1
|
|
326
|
-
}, 8, ["visible"])
|
|
327
|
-
], 32)
|
|
328
|
-
], 34))
|
|
329
|
-
]),
|
|
330
|
-
_: 1
|
|
331
|
-
}, 8, ["file-list", "multiple", "limit", "list-type", "accept", "disabled"]),
|
|
332
|
-
C.value ? (m(), Be(s, {
|
|
333
|
-
key: 0,
|
|
334
|
-
"url-list": A.value,
|
|
335
|
-
"initial-index": P.value,
|
|
336
|
-
onClose: pe
|
|
337
|
-
}, null, 8, ["url-list", "initial-index"])) : h("", !0),
|
|
338
|
-
y(b, {
|
|
339
|
-
modelValue: S.value,
|
|
340
|
-
"onUpdate:modelValue": e[7] || (e[7] = (d) => S.value = d),
|
|
341
|
-
title: H.value,
|
|
342
|
-
width: "640px",
|
|
343
|
-
"append-to-body": "",
|
|
344
|
-
"destroy-on-close": "",
|
|
345
|
-
onClose: e[8] || (e[8] = (d) => S.value = !1)
|
|
346
|
-
}, {
|
|
347
|
-
default: U(() => [
|
|
348
|
-
S.value ? (m(), w("video", {
|
|
349
|
-
key: 0,
|
|
350
|
-
src: E.value,
|
|
351
|
-
controls: "",
|
|
352
|
-
autoplay: "",
|
|
353
|
-
style: { width: "100%", "max-height": "400px", "border-radius": "4px" }
|
|
354
|
-
}, null, 8, je)) : h("", !0)
|
|
355
|
-
]),
|
|
356
|
-
_: 1
|
|
357
|
-
}, 8, ["modelValue", "title"]),
|
|
358
|
-
ae.value ? (m(), w("div", $e, [
|
|
359
|
-
y(a, null, {
|
|
360
|
-
default: U(() => [
|
|
361
|
-
y(Y(Se))
|
|
362
|
-
]),
|
|
363
|
-
_: 1
|
|
364
|
-
}),
|
|
365
|
-
k("span", null, [
|
|
366
|
-
e[12] || (e[12] = $(" 请上传 ", -1)),
|
|
367
|
-
p.fileSize ? (m(), w(M, { key: 0 }, [
|
|
368
|
-
e[10] || (e[10] = $("大小不超过 ", -1)),
|
|
369
|
-
k("b", Ce, R(p.fileSize) + "MB", 1)
|
|
370
|
-
], 64)) : h("", !0),
|
|
371
|
-
(j = v.value) != null && j.length ? (m(), w(M, { key: 1 }, [
|
|
372
|
-
e[11] || (e[11] = $(",格式为 ", -1)),
|
|
373
|
-
k("b", Ae, R(v.value.join("/")), 1)
|
|
374
|
-
], 64)) : h("", !0),
|
|
375
|
-
e[13] || (e[13] = $(" 的文件。 ", -1))
|
|
376
|
-
])
|
|
377
|
-
])) : h("", !0)
|
|
378
|
-
], 6);
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
}), He = /* @__PURE__ */ Te(Fe, [["__scopeId", "data-v-c1472320"]]);
|
|
382
|
-
export {
|
|
383
|
-
He as Q
|
|
384
|
-
};
|
package/dist/index-CzJWU89H.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),N=require("./index-BaU5rDMh.js"),A=require("./plugin-vue_export-helper-BHFhmbuH.js"),O={class:"qy-record-quote-search"},R={key:0,class:"qy-record-quote-search__header"},T={key:0,class:"qy-record-quote-search__label"},L={key:1,class:"qy-record-quote-search__description"},P=t.defineComponent({name:"QyRecordQuoteSearch",inheritAttrs:!1,__name:"index",props:{modelValue:{default:""},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{default:"请输入报价单号"},buttonText:{default:"查询报价单"},autoNormalize:{type:Boolean,default:!0},showStatus:{type:Boolean,default:!0},status:{default:"default"},statusText:{default:""},suggestions:{default:()=>[]},fetchSuggestions:{type:[Function,null],default:null},fetchSuggestionsMethod:{type:[Function,null],default:null},debounce:{default:300},minLength:{default:1},searchOnSelect:{type:Boolean,default:!0},searchMethod:{type:[Function,null],default:null},extractMethod:{type:[Function,null],default:null},normalizeMethod:{type:[Function,null],default:null},label:{default:"报价单号"},description:{default:""},trimMode:{default:"blur"}},emits:["update:modelValue","search","clear","normalize","enter","select","error","success"],setup(y,{expose:S,emit:v}){const r=y,n=v,b=t.useAttrs(),a=t.ref(null),d=t.ref(!1),i=t.computed(()=>r.statusText||""),V=t.computed(()=>r.loading||d.value);function u(e){return e==null?"":String(e)}function k(e){const o=u(e).trim(),l=c(o),s=l.match(/BJ\d{8}[A-Z0-9]{4}/i);return s?s[0]:l}function c(e){return u(e).replace(/\s+/g,"").trim().toUpperCase()}function f(e){return r.extractMethod?r.extractMethod(e):k(e)}function h(e){return r.normalizeMethod?r.normalizeMethod(e):c(e)}function m(e,o){const l=u(e),s=f(l),g=r.autoNormalize?h(s):s;return n("normalize",{rawValue:l,code:g}),{rawValue:l,code:g,item:o}}function C(e){n("update:modelValue",e)}async function p(e){if(n("search",e),!!r.searchMethod){d.value=!0;try{const o=await r.searchMethod(e);n("success",o)}catch(o){n("error",o)}finally{d.value=!1}}}function B(e){const o=m(e);o.code!==u(r.modelValue)&&n("update:modelValue",o.code),p(o)}function E(){n("clear")}function M(e){n("enter",e)}function q(e){if(n("select",e),!r.searchOnSelect)return;const o=m(e.value,e);o.code!==u(r.modelValue)&&n("update:modelValue",o.code),p(o)}function $(e){n("error",e)}function z(){var e,o;(o=(e=a.value)==null?void 0:e.focus)==null||o.call(e)}function F(){var e,o;(o=(e=a.value)==null?void 0:e.blur)==null||o.call(e)}function Q(){var e,o;(o=(e=a.value)==null?void 0:e.select)==null||o.call(e)}function w(){var e,o;(o=(e=a.value)==null?void 0:e.clear)==null||o.call(e)}return S({focus:z,blur:F,select:Q,clear:w,extractQuoteOrderCode:f,normalizeQuoteOrderCode:h}),(e,o)=>(t.openBlock(),t.createElementBlock("div",O,[t.renderSlot(e.$slots,"label",{},()=>[e.label||e.description?(t.openBlock(),t.createElementBlock("div",R,[e.label?(t.openBlock(),t.createElementBlock("div",T,t.toDisplayString(e.label),1)):t.createCommentVNode("",!0),e.description?(t.openBlock(),t.createElementBlock("div",L,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],!0),t.createVNode(N.QySearchInput,t.mergeProps({ref_key:"searchRef",ref:a},t.unref(b),{"model-value":e.modelValue,loading:V.value,disabled:e.disabled,placeholder:e.placeholder,"remove-space":!0,"trim-mode":e.trimMode,"button-text":e.buttonText,suggestions:e.suggestions,"fetch-suggestions":e.fetchSuggestions,"fetch-suggestions-method":e.fetchSuggestionsMethod,debounce:e.debounce,"min-length":e.minLength,"search-on-select":!1,"onUpdate:modelValue":C,onSearch:B,onClear:E,onEnter:M,onSelect:q,onError:$}),t.createSlots({_:2},[e.$slots.prefix?{name:"prefix",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"prefix",{},void 0,!0)]),key:"0"}:void 0,e.$slots.suffix?{name:"suffix",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"suffix",{},void 0,!0)]),key:"1"}:void 0,e.$slots.item?{name:"item",fn:t.withCtx(l=>[t.renderSlot(e.$slots,"item",t.normalizeProps(t.guardReactiveProps(l)),void 0,!0)]),key:"2"}:void 0,e.$slots.empty?{name:"empty",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"empty",{},void 0,!0)]),key:"3"}:void 0,e.$slots.loading?{name:"loading",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"loading",{},void 0,!0)]),key:"4"}:void 0]),1040,["model-value","loading","disabled","placeholder","trim-mode","button-text","suggestions","fetch-suggestions","fetch-suggestions-method","debounce","min-length"]),e.showStatus&&i.value?t.renderSlot(e.$slots,"status",{key:0,status:e.status,statusText:i.value},()=>[t.createElementVNode("div",{class:t.normalizeClass(["qy-record-quote-search__status",`is-${e.status}`])},t.toDisplayString(i.value),3)],!0):t.createCommentVNode("",!0)]))}}),D=A._export_sfc(P,[["__scopeId","data-v-8bc26d3a"]]);exports.QyRecordQuoteSearch=D;
|
package/dist/index-DQ-EEZgS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const Z=require("element-plus/es"),e=require("vue"),U=require("clsx"),A=require("element-plus"),H=require("@vueuse/core"),X={class:"text-lg flex items-center pt-2 pl-[var(--content-padding)]"},W={key:0},Y={key:1},G={key:0,class:"icon-[material-symbols--square-outline-rounded]",role:"img","aria-hidden":"true"},J={key:1,class:"icon-[tdesign--fullscreen-exit-1]",role:"img","aria-hidden":"true"},K={key:0,class:"fixed -right-12 top-2 h-9 w-9 hover:bg-gray-600/80 transition-all"},Q={class:"flex justify-between h-[var(--footer-height)] px-[var(--content-padding)] items-center"},ee={class:"flex items-center justify-between w-full pl-1 pr-4 h-full ml-2"},te={class:"flex items-center gap-2"},oe={class:"text-sm text-gray-700 truncate max-w-[200px]"},le={class:"flex items-center gap-2"},L=5,C=2e3,ne=e.defineComponent({__name:"index",props:e.mergeModels({layout:{type:[Array,String,Boolean],default:()=>["confirm","cancel"]},fullscreen:{type:Boolean,default:!1},showFullscreen:{type:Boolean,default:!1},confirmProps:{default:()=>({})},size:{default:"default"},zIndex:{default:2e3}},{modelValue:{default:!0},modelModifiers:{}}),emits:e.mergeModels(["confirm","cancel","close","opened","ok"],["update:modelValue"]),setup(E,{expose:O,emit:j}){const l=E,y=e.useSlots(),B=e.ref(!0),v=e.ref(!1),M=e.ref(C),F=H.useBreakpoints({mobile:0,tablet:640,laptop:1024,desktop:1280}).isSmaller("tablet"),w=e.computed(()=>{if(Array.isArray(l.layout))return l.layout;if(typeof l.layout=="string")return l.layout.split(",").map(o=>o.trim())}),z=e.computed(()=>({CancelButton:e.createVNode(I),ConfirmButton:e.createVNode(S)})),b=e.computed(()=>y.footer||l.layout!==!1),h=e.ref(!1),s=e.ref(l.showFullscreen&&F?!0:l.fullscreen),d=j,x=e.useModel(E,"modelValue");e.watchEffect(()=>{x.value&&(h.value=!1)}),O({});const k=e.useAttrs(),i=`qy-dialog-${Math.random().toString(36).slice(2,11)}`,a=e.ref(!1),u=e.ref(null);window.minimizedCount||(window.minimizedCount=0);const{x:V,y:_}=H.useDraggable(u,{initialValue:{x:5,y:window.innerHeight-100-(window.minimizedCount||0)*60},onMove(o){var t;(t=u.value)==null||t.classList.add("dragging"),document.body.classList.add("qy-dialog--dragging"),V.value=Math.max(0,Math.min(window.innerWidth-300,o.x)),_.value=Math.max(0,Math.min(window.innerHeight-50,o.y))},onEnd(){var o;(o=u.value)==null||o.classList.remove("dragging"),document.body.classList.remove("qy-dialog--dragging")}}),P=e.computed(()=>({transform:`translate(${V.value}px, ${_.value}px)`,willChange:"transform"}));function q(o){const t=o.target,{scrollTop:n,scrollHeight:r,clientHeight:f}=t;B.value=n<=L,v.value=r-(n+f)<=L}function T(){document.querySelector(`.${i}.el-dialog`).addEventListener("scroll",q),m(),d("opened")}function N(){s.value=!s.value,m()}function c(){h.value||(h.value=!0,a.value=!1,x.value=!1,d("cancel"),d("close"))}function R(o){l.showFullscreen&&o.detail>=2&&N()}function S(){return e.h(A.ElButton,{...e.unref(l.confirmProps),type:"primary",class:"dialog__footerBtn",onClick:()=>{d("confirm"),d("ok")}},()=>e.unref(l.confirmProps).title||"确 认")}function I(){return e.h(A.ElButton,{class:"dialog__footerBtn",onClick:()=>c()},()=>"取 消")}e.onMounted(()=>{typeof window.qyDialogMaxZIndex>"u"&&(window.qyDialogMaxZIndex=C),m()});function m(){var $;const o=Array.from(document.querySelectorAll(".el-overlay")).filter(p=>window.getComputedStyle(p).display!=="none"&&!p.classList.contains("is-message")),t=($=document.querySelector(`.${i}`))==null?void 0:$.closest(".el-overlay"),n=document.querySelector(`.${i}.el-dialog`);if(!t||!n)return;const r=C;window.qyDialogMaxZIndex=window.qyDialogMaxZIndex||r;const g=Math.max(window.qyDialogMaxZIndex,...o.map(p=>parseInt(window.getComputedStyle(p).zIndex||r.toString())))+2;window.qyDialogMaxZIndex=g,e.nextTick(()=>{t.style.zIndex=g.toString(),n.style.zIndex=(g+1).toString(),M.value=g+1})}e.onUnmounted(()=>{const o=document.querySelector(`.${i} .qy-dialog__wrapper-container`);o&&o.removeEventListener("scroll",q),a.value&&window.minimizedCount--});function D(){var t;a.value=!a.value;const o=(t=document.querySelector(`.${i}`))==null?void 0:t.closest(".el-overlay");a.value?(o.style.display="none",window.minimizedCount++,_.value=window.innerHeight-50-(window.minimizedCount||0)*60):(o.style.display="block",window.minimizedCount--,m())}return(o,t)=>{const n=e.resolveComponent("Close"),r=Z.ElIcon,f=Z.ElDialog;return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(f,e.mergeProps({ref:"dialogRef",class:["qy-dialog",[l.size==="small"&&"[&_.el-dialog__header]:!hidden",i]],"model-value":x.value,"align-center":"","append-to-body":"",style:{"--el-dialog-padding-primary":0},"show-close":!1,fullscreen:s.value,"z-index":M.value,onClosed:c,onOpened:T,draggable:""},e.unref(k)),e.createSlots({header:e.withCtx(()=>[l.size==="default"?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({borderBottom:"1px solid",borderColor:B.value?"transparent":"var(--block-outline-color)",transition:"border-color .2s linear"}),class:"flex justify-between h-[var(--header-height)]",onDblclick:R},[e.createElementVNode("div",X,[e.unref(y).header?e.unref(y).header?(e.openBlock(),e.createElementBlock("div",Y,[e.renderSlot(o.$slots,"header")])):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",W,e.toDisplayString(e.unref(k).title),1))]),e.createElementVNode("div",{class:"flex",onMousedown:t[3]||(t[3]=e.withModifiers(()=>{},["stop"]))},[l.size==="default"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qy-dialog__btn qy-dialog__btn--default",onClick:e.withModifiers(D,["stop"]),onMousedown:t[0]||(t[0]=e.withModifiers(()=>{},["stop"]))},t[4]||(t[4]=[e.createElementVNode("span",{class:"icon-[material-symbols--minimize] text-xl mb-3",role:"img","aria-hidden":"true"},null,-1)]),32)):e.createCommentVNode("",!0),l.showFullscreen?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qy-dialog__btn qy-dialog__btn--default",onClick:e.withModifiers(N,["stop"]),onMousedown:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},[s.value?(e.openBlock(),e.createElementBlock("span",J)):(e.openBlock(),e.createElementBlock("span",G))],32)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"qy-dialog__btn qy-dialog__btn--danger",onClick:e.withModifiers(c,["stop"]),onMousedown:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},t[5]||(t[5]=[e.createElementVNode("span",{class:"icon-[ri--close-line] text-xl",role:"img","aria-hidden":"true"},null,-1)]),32)],32)],36)):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["qy-dialog__wrapper",e.unref(U)(s.value&&"qy-dialog__wrapper--fullscreen")]),style:e.normalizeStyle({maxHeight:b.value?"calc(100vh - var(--header-height) - var(--footer-height) - var(--sides-gap))":"calc(100vh - var(--header-height) - var(--sides-gap))",padding:l.size==="small"?"var(--small-content-padding)":"var(--content-padding)"})},[l.size==="small"?(e.openBlock(),e.createElementBlock("div",K,[e.createVNode(r,{size:36,class:"cursor-pointer text-gray-100 active:scale-75 rounded-sm transition-all",onClick:c},{default:e.withCtx(()=>[e.createVNode(n)]),_:1})])):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"default")],6)]),_:2},[!o.$slots.footer&&Array.isArray(w.value)?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",Q,[e.createElementVNode("div",null,[e.renderSlot(o.$slots,"footer-left")]),e.createElementVNode("div",{class:e.normalizeClass([{"qy-dialog__footer--outline":v.value},"qy-dialog__footer flex items-center justify-end"])},[w.value.includes("cancel")?(e.openBlock(),e.createBlock(I,{key:0})):e.createCommentVNode("",!0),w.value.includes("confirm")?(e.openBlock(),e.createBlock(S,{key:1})):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"footer-append")],2)])]),key:"0"}:b.value?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([{"qy-dialog__footer--outline":v.value},"qy-dialog__footer px-[var(--content-padding)] min-h-[var(--footer-height)] flex items-center justify-end"])},[e.renderSlot(o.$slots,"footer",{layouts:z.value,layoutsNode:Object.values(z.value)})],2)]),key:"1"}:void 0]),1040,["class","model-value","fullscreen","z-index"]),e.withDirectives(e.createElementVNode("div",{ref_key:"minimizedRef",ref:u,class:"fixed left-0 top-0 bg-white rounded shadow-lg cursor-pointer z-[9999] hover:bg-gray-50",style:e.normalizeStyle([P.value,{width:"300px",height:"50px","will-change":"transform"}])},[e.createElementVNode("div",ee,[e.createElementVNode("div",te,[t[6]||(t[6]=e.createElementVNode("div",{class:"icon-[mdi--window-restore] text-gray-600"},null,-1)),e.createElementVNode("span",oe,e.toDisplayString(e.unref(k).title),1)]),e.createElementVNode("div",le,[e.createElementVNode("div",{class:"p-1 hover:bg-gray-200 rounded",onClick:e.withModifiers(D,["stop"])},t[7]||(t[7]=[e.createElementVNode("div",{class:"icon-[mdi--window-maximize] text-gray-600"},null,-1)])),e.createElementVNode("div",{class:"p-1 hover:bg-red-100 rounded",onClick:e.withModifiers(c,["stop"])},t[8]||(t[8]=[e.createElementVNode("div",{class:"icon-[mdi--close] text-red-600"},null,-1)]))])])],4),[[e.vShow,a.value]])])}}});exports._sfc_main=ne;
|
package/dist/index-Dg93AsO_.mjs
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { defineComponent as $, useAttrs as N, ref as v, computed as q, watch as z, onMounted as j, nextTick as K, onUnmounted as M, createElementBlock as g, openBlock as h, normalizeStyle as O, createElementVNode as i, createVNode as _, unref as c, mergeProps as Q, withCtx as y, createTextVNode as W } from "vue";
|
|
2
|
-
import { ElMessage as F, ElInput as G, ElPopover as H, ElButton as J, ElUpload as X } from "element-plus";
|
|
3
|
-
import { a as Y } from "./js.cookie-tagl12-O.mjs";
|
|
4
|
-
import { _ as Z } from "./plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
5
|
-
function U(r) {
|
|
6
|
-
const l = r == null ? void 0 : r.match(/(\[url\:(.*?)\])(.*)/);
|
|
7
|
-
return l ? {
|
|
8
|
-
imageUrl: l[2],
|
|
9
|
-
text: l[3]
|
|
10
|
-
} : {
|
|
11
|
-
imageUrl: "",
|
|
12
|
-
text: r || ""
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function ee(r) {
|
|
16
|
-
const l = String(r || "").match(/(\[url\:.*?\])([\s\S]*)/);
|
|
17
|
-
return l ? l[2] : r;
|
|
18
|
-
}
|
|
19
|
-
function V(r, l) {
|
|
20
|
-
return l ? `[url:${l}]${r}` : r;
|
|
21
|
-
}
|
|
22
|
-
const ae = { class: "qy-remark-image__field" }, te = { class: "qy-remark-image__upload-anchor" }, re = {
|
|
23
|
-
key: 0,
|
|
24
|
-
class: "icon-[line-md--loading-twotone-loop]",
|
|
25
|
-
role: "img",
|
|
26
|
-
"aria-hidden": "true"
|
|
27
|
-
}, le = {
|
|
28
|
-
key: 1,
|
|
29
|
-
class: "icon-[ion--cloud-upload-outline]",
|
|
30
|
-
role: "img",
|
|
31
|
-
"aria-hidden": "true"
|
|
32
|
-
}, ue = {
|
|
33
|
-
key: 2,
|
|
34
|
-
class: "icon-[ph--images-thin]",
|
|
35
|
-
role: "img",
|
|
36
|
-
"aria-hidden": "true"
|
|
37
|
-
}, oe = { class: "qy-remark-image__popover" }, ne = ["src"], ie = { class: "qy-remark-image__popover-footer" }, se = $({
|
|
38
|
-
__name: "index",
|
|
39
|
-
props: {
|
|
40
|
-
defaultValue: { default: "" },
|
|
41
|
-
defaultImage: { default: "" },
|
|
42
|
-
rows: { default: 6 },
|
|
43
|
-
width: { default: "" },
|
|
44
|
-
autosize: { type: [Boolean, Object], default: !1 },
|
|
45
|
-
disabled: { type: Boolean, default: !1 },
|
|
46
|
-
placeholder: { default: "粘贴图片上传" },
|
|
47
|
-
type: { default: "textarea" },
|
|
48
|
-
api: { default: "/permission-api/common/uploads" },
|
|
49
|
-
tokenKey: { default: "Admin-Token" }
|
|
50
|
-
},
|
|
51
|
-
emits: ["change"],
|
|
52
|
-
setup(r, { expose: l, emit: C }) {
|
|
53
|
-
const u = r, D = C, S = N(), k = v(null), n = v(""), o = v(""), m = v(!1), P = q(
|
|
54
|
-
() => u.type === "text" ? "text" : "textarea"
|
|
55
|
-
), R = q(() => {
|
|
56
|
-
if (u.width)
|
|
57
|
-
return {
|
|
58
|
-
width: typeof u.width == "number" ? `${u.width}px` : u.width
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
z(
|
|
62
|
-
() => u.defaultValue,
|
|
63
|
-
(e) => {
|
|
64
|
-
const a = U(e || "");
|
|
65
|
-
n.value = a.text, o.value = a.imageUrl || u.defaultImage || "";
|
|
66
|
-
},
|
|
67
|
-
{ immediate: !0 }
|
|
68
|
-
), z(
|
|
69
|
-
() => u.defaultImage,
|
|
70
|
-
(e) => {
|
|
71
|
-
e !== void 0 && !U(u.defaultValue || "").imageUrl && (o.value = e || "");
|
|
72
|
-
},
|
|
73
|
-
{ immediate: !0 }
|
|
74
|
-
), j(() => {
|
|
75
|
-
K(T);
|
|
76
|
-
}), M(() => {
|
|
77
|
-
const e = x();
|
|
78
|
-
e && e.removeEventListener("paste", E);
|
|
79
|
-
});
|
|
80
|
-
function x() {
|
|
81
|
-
var e, a;
|
|
82
|
-
return ((e = k.value) == null ? void 0 : e.textarea) || ((a = k.value) == null ? void 0 : a.input) || null;
|
|
83
|
-
}
|
|
84
|
-
function T() {
|
|
85
|
-
const e = x();
|
|
86
|
-
e && (e.removeEventListener("paste", E), e.addEventListener("paste", E));
|
|
87
|
-
}
|
|
88
|
-
function L(e) {
|
|
89
|
-
n.value = ee(e || "");
|
|
90
|
-
}
|
|
91
|
-
function A() {
|
|
92
|
-
o.value = "", w();
|
|
93
|
-
}
|
|
94
|
-
async function E(e) {
|
|
95
|
-
var d;
|
|
96
|
-
const s = Array.from(((d = e.clipboardData) == null ? void 0 : d.files) || []).find((f) => f.type.startsWith("image/"));
|
|
97
|
-
s && (e.preventDefault(), await B({
|
|
98
|
-
file: s,
|
|
99
|
-
onError: () => {
|
|
100
|
-
},
|
|
101
|
-
onProgress: () => {
|
|
102
|
-
},
|
|
103
|
-
onSuccess: () => {
|
|
104
|
-
}
|
|
105
|
-
}));
|
|
106
|
-
}
|
|
107
|
-
async function B(e) {
|
|
108
|
-
var a, s, d, f;
|
|
109
|
-
if (e.file.size > 51200 * 1e3)
|
|
110
|
-
return F.error("图片过大"), !1;
|
|
111
|
-
m.value = !0;
|
|
112
|
-
try {
|
|
113
|
-
const p = new FormData();
|
|
114
|
-
p.append("files", e.file);
|
|
115
|
-
const I = Y.get(u.tokenKey), t = await (await fetch(u.api, {
|
|
116
|
-
method: "POST",
|
|
117
|
-
body: p,
|
|
118
|
-
credentials: "include",
|
|
119
|
-
headers: I ? { Authorization: `Bearer ${I}` } : void 0
|
|
120
|
-
})).json(), b = (t == null ? void 0 : t.urls) ?? ((a = t == null ? void 0 : t.data) == null ? void 0 : a.urls) ?? ((s = t == null ? void 0 : t.data) == null ? void 0 : s.url) ?? (t == null ? void 0 : t.url) ?? "";
|
|
121
|
-
return o.value = Array.isArray(b) ? b[0] : b, w(), F.success("上传图片成功"), (d = e.onSuccess) == null || d.call(e, t), !0;
|
|
122
|
-
} catch (p) {
|
|
123
|
-
return (f = e.onError) == null || f.call(e, p), F.error("上传失败"), !1;
|
|
124
|
-
} finally {
|
|
125
|
-
m.value = !1;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
function w() {
|
|
129
|
-
D(
|
|
130
|
-
"change",
|
|
131
|
-
V(n.value || "", o.value || ""),
|
|
132
|
-
o.value || ""
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
return l({
|
|
136
|
-
deleteImage: A,
|
|
137
|
-
getValue: () => ({
|
|
138
|
-
text: n.value || "",
|
|
139
|
-
imageUrl: o.value || "",
|
|
140
|
-
value: V(n.value || "", o.value || "")
|
|
141
|
-
})
|
|
142
|
-
}), (e, a) => (h(), g("div", {
|
|
143
|
-
class: "qy-remark-image",
|
|
144
|
-
style: O(R.value)
|
|
145
|
-
}, [
|
|
146
|
-
i("div", ae, [
|
|
147
|
-
_(c(G), Q({
|
|
148
|
-
ref_key: "inputRef",
|
|
149
|
-
ref: k,
|
|
150
|
-
"model-value": n.value,
|
|
151
|
-
type: P.value,
|
|
152
|
-
rows: e.rows,
|
|
153
|
-
autosize: e.autosize,
|
|
154
|
-
disabled: e.disabled,
|
|
155
|
-
placeholder: e.placeholder
|
|
156
|
-
}, c(S), {
|
|
157
|
-
"onUpdate:modelValue": L,
|
|
158
|
-
onBlur: w
|
|
159
|
-
}), null, 16, ["model-value", "type", "rows", "autosize", "disabled", "placeholder"]),
|
|
160
|
-
_(c(H), {
|
|
161
|
-
placement: "top-start",
|
|
162
|
-
width: 400,
|
|
163
|
-
trigger: "hover",
|
|
164
|
-
disabled: !o.value
|
|
165
|
-
}, {
|
|
166
|
-
reference: y(() => [
|
|
167
|
-
i("div", te, [
|
|
168
|
-
_(c(X), {
|
|
169
|
-
disabled: m.value || e.disabled,
|
|
170
|
-
class: "qy-remark-image__upload",
|
|
171
|
-
"show-file-list": !1,
|
|
172
|
-
"http-request": B
|
|
173
|
-
}, {
|
|
174
|
-
default: y(() => [
|
|
175
|
-
m.value ? (h(), g("span", re)) : o.value ? (h(), g("span", ue)) : (h(), g("span", le))
|
|
176
|
-
]),
|
|
177
|
-
_: 1
|
|
178
|
-
}, 8, ["disabled"])
|
|
179
|
-
])
|
|
180
|
-
]),
|
|
181
|
-
default: y(() => [
|
|
182
|
-
i("div", oe, [
|
|
183
|
-
i("img", {
|
|
184
|
-
src: o.value,
|
|
185
|
-
class: "qy-remark-image__preview-img"
|
|
186
|
-
}, null, 8, ne),
|
|
187
|
-
i("div", ie, [
|
|
188
|
-
a[1] || (a[1] = i("span", { class: "qy-remark-image__popover-tip" }, "再次点击按钮可更换图片", -1)),
|
|
189
|
-
_(c(J), {
|
|
190
|
-
link: "",
|
|
191
|
-
size: "small",
|
|
192
|
-
type: "danger",
|
|
193
|
-
disabled: e.disabled,
|
|
194
|
-
onClick: A
|
|
195
|
-
}, {
|
|
196
|
-
default: y(() => a[0] || (a[0] = [
|
|
197
|
-
W(" 删除图片 ", -1)
|
|
198
|
-
])),
|
|
199
|
-
_: 1,
|
|
200
|
-
__: [0]
|
|
201
|
-
}, 8, ["disabled"])
|
|
202
|
-
])
|
|
203
|
-
])
|
|
204
|
-
]),
|
|
205
|
-
_: 1
|
|
206
|
-
}, 8, ["disabled"])
|
|
207
|
-
])
|
|
208
|
-
], 4));
|
|
209
|
-
}
|
|
210
|
-
}), ve = /* @__PURE__ */ Z(se, [["__scopeId", "data-v-3b943ab8"]]);
|
|
211
|
-
export {
|
|
212
|
-
ve as Q,
|
|
213
|
-
V as a,
|
|
214
|
-
ee as f,
|
|
215
|
-
U as p
|
|
216
|
-
};
|