@qynpm/ui 1.0.2 → 1.0.4
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/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 +17 -0
- package/dist/lib/dialog/index.vue.cjs +1 -0
- package/dist/{index-CibtL3Up.mjs → lib/dialog/index.vue.mjs} +16 -15
- package/dist/lib/index.cjs +1 -0
- package/dist/lib/index.mjs +40 -0
- package/dist/lib/qy-action-bar/index.vue.cjs +1 -0
- package/dist/{index-DlwgfuD9.mjs → lib/qy-action-bar/index.vue.mjs} +9 -8
- package/dist/lib/qy-form-section/index.vue.cjs +1 -0
- package/dist/{index-Cuwe7RLf.mjs → lib/qy-form-section/index.vue.mjs} +11 -10
- package/dist/lib/qy-input/index.vue.cjs +1 -0
- package/dist/{index-CEg8yYrg.mjs → lib/qy-input/index.vue.mjs} +7 -7
- package/dist/lib/qy-record-quote-search/index.vue.cjs +1 -0
- package/dist/{index-BzzxlJ2O.mjs → lib/qy-record-quote-search/index.vue.mjs} +11 -10
- package/dist/lib/qy-search-input/index.vue.cjs +1 -0
- package/dist/{index-C02naY8D.mjs → lib/qy-search-input/index.vue.mjs} +18 -17
- package/dist/lib/qy-select/index.vue.cjs +1 -0
- package/dist/{index-Djj-T8oy.mjs → lib/qy-select/index.vue.mjs} +1 -1
- package/dist/lib/remark-image/index.vue.cjs +1 -0
- package/dist/lib/remark-image/index.vue.mjs +198 -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/{index-BddPsC3s.mjs → lib/upload/index.vue.mjs} +59 -61
- 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.1/node_modules/js-cookie/dist/js.cookie.cjs +1 -0
- package/dist/{js.cookie-tagl12-O.mjs → node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.mjs} +1 -1
- 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 +6 -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-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-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/package.json +12 -12
- 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-CzJWU89H.js +0 -1
- package/dist/index-DQ-EEZgS.js +0 -1
- package/dist/index-Dg93AsO_.mjs +0 -216
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),o=require("element-plus"),N=require("../../node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.cjs"),d=require("./utils.cjs");;/* empty css */const A=require("../../_virtual/plugin-vue_export-helper.cjs"),C={class:"qy-remark-image__field"},z={class:"qy-remark-image__upload-anchor"},P={key:0,class:"icon-[line-md--loading-twotone-loop]",role:"img","aria-hidden":"true"},R={key:1,class:"icon-[ion--cloud-upload-outline]",role:"img","aria-hidden":"true"},D={key:2,class:"icon-[ph--images-thin]",role:"img","aria-hidden":"true"},S={class:"qy-remark-image__popover"},U=["src"],M={class:"qy-remark-image__popover-footer"},j=e.defineComponent({__name:"index",props:{defaultValue:{default:""},defaultImage:{default:""},rows:{default:6},width:{default:""},autosize:{type:[Boolean,Object],default:!1},disabled:{type:Boolean,default:!1},placeholder:{default:"粘贴图片上传"},type:{default:"textarea"},api:{default:"/permission-api/common/uploads"},tokenKey:{default:"Admin-Token"}},emits:["change"],setup(w,{expose:b,emit:x}){const l=w,V=x,B=e.useAttrs(),p=e.ref(null),n=e.ref(""),u=e.ref(""),c=e.ref(!1),q=e.computed(()=>l.type==="text"?"text":"textarea"),F=e.computed(()=>{if(l.width)return{width:typeof l.width=="number"?`${l.width}px`:l.width}});e.watch(()=>l.defaultValue,a=>{const t=d.parseRemarkText(a||"");n.value=t.text,u.value=t.imageUrl||l.defaultImage||""},{immediate:!0}),e.watch(()=>l.defaultImage,a=>{a!==void 0&&!d.parseRemarkText(l.defaultValue||"").imageUrl&&(u.value=a||"")},{immediate:!0}),e.onMounted(()=>{e.nextTick(T)}),e.onUnmounted(()=>{const a=_();a&&a.removeEventListener("paste",v)});function _(){var a,t;return((a=p.value)==null?void 0:a.textarea)||((t=p.value)==null?void 0:t.input)||null}function T(){const a=_();a&&(a.removeEventListener("paste",v),a.addEventListener("paste",v))}function I(a){n.value=d.formatRemarkText(a||"")}function y(){u.value="",g()}async function v(a){var i;const s=Array.from(((i=a.clipboardData)==null?void 0:i.files)||[]).find(m=>m.type.startsWith("image/"));s&&(a.preventDefault(),await k({file:s,onError:()=>{},onProgress:()=>{},onSuccess:()=>{}}))}async function k(a){var t,s,i,m;if(a.file.size>51200*1e3)return o.ElMessage.error("图片过大"),!1;c.value=!0;try{const f=new FormData;f.append("files",a.file);const E=N.default.get(l.tokenKey),r=await(await fetch(l.api,{method:"POST",body:f,credentials:"include",headers:E?{Authorization:`Bearer ${E}`}:void 0})).json(),h=(r==null?void 0:r.urls)??((t=r==null?void 0:r.data)==null?void 0:t.urls)??((s=r==null?void 0:r.data)==null?void 0:s.url)??(r==null?void 0:r.url)??"";return u.value=Array.isArray(h)?h[0]:h,g(),o.ElMessage.success("上传图片成功"),(i=a.onSuccess)==null||i.call(a,r),!0}catch(f){return(m=a.onError)==null||m.call(a,f),o.ElMessage.error("上传失败"),!1}finally{c.value=!1}}function g(){V("change",d.parseRemarkWithImage(n.value||"",u.value||""),u.value||"")}return b({deleteImage:y,getValue:()=>({text:n.value||"",imageUrl:u.value||"",value:d.parseRemarkWithImage(n.value||"",u.value||"")})}),(a,t)=>(e.openBlock(),e.createElementBlock("div",{class:"qy-remark-image",style:e.normalizeStyle(F.value)},[e.createElementVNode("div",C,[e.createVNode(e.unref(o.ElInput),e.mergeProps({ref_key:"inputRef",ref:p,"model-value":n.value,type:q.value,rows:a.rows,autosize:a.autosize,disabled:a.disabled,placeholder:a.placeholder},e.unref(B),{"onUpdate:modelValue":I,onBlur:g}),null,16,["model-value","type","rows","autosize","disabled","placeholder"]),e.createVNode(e.unref(o.ElPopover),{placement:"top-start",width:400,trigger:"hover",disabled:!u.value},{reference:e.withCtx(()=>[e.createElementVNode("div",z,[e.createVNode(e.unref(o.ElUpload),{disabled:c.value||a.disabled,class:"qy-remark-image__upload","show-file-list":!1,"http-request":k},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock("span",P)):u.value?(e.openBlock(),e.createElementBlock("span",D)):(e.openBlock(),e.createElementBlock("span",R))]),_:1},8,["disabled"])])]),default:e.withCtx(()=>[e.createElementVNode("div",S,[e.createElementVNode("img",{src:u.value,class:"qy-remark-image__preview-img"},null,8,U),e.createElementVNode("div",M,[t[1]||(t[1]=e.createElementVNode("span",{class:"qy-remark-image__popover-tip"},"再次点击按钮可更换图片",-1)),e.createVNode(e.unref(o.ElButton),{link:"",size:"small",type:"danger",disabled:a.disabled,onClick:y},{default:e.withCtx(()=>t[0]||(t[0]=[e.createTextVNode(" 删除图片 ",-1)])),_:1,__:[0]},8,["disabled"])])])]),_:1},8,["disabled"])])],4))}}),L=A.default(j,[["__scopeId","data-v-3b943ab8"]]);exports.default=L;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { defineComponent as N, useAttrs as j, ref as f, computed as B, watch as I, onMounted as K, nextTick as M, onUnmounted as O, createElementBlock as p, openBlock as v, normalizeStyle as W, createElementVNode as u, createVNode as g, unref as n, mergeProps as $, withCtx as h, createTextVNode as Q } from "vue";
|
|
2
|
+
import { ElMessage as w, ElInput as G, ElPopover as H, ElButton as J, ElUpload as X } from "element-plus";
|
|
3
|
+
import Y from "../../node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.mjs";
|
|
4
|
+
import { parseRemarkText as T, parseRemarkWithImage as q, formatRemarkText as Z } from "./utils.mjs";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import ee from "../../_virtual/plugin-vue_export-helper.mjs";
|
|
7
|
+
const ae = { class: "qy-remark-image__field" }, te = { class: "qy-remark-image__upload-anchor" }, re = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "icon-[line-md--loading-twotone-loop]",
|
|
10
|
+
role: "img",
|
|
11
|
+
"aria-hidden": "true"
|
|
12
|
+
}, le = {
|
|
13
|
+
key: 1,
|
|
14
|
+
class: "icon-[ion--cloud-upload-outline]",
|
|
15
|
+
role: "img",
|
|
16
|
+
"aria-hidden": "true"
|
|
17
|
+
}, oe = {
|
|
18
|
+
key: 2,
|
|
19
|
+
class: "icon-[ph--images-thin]",
|
|
20
|
+
role: "img",
|
|
21
|
+
"aria-hidden": "true"
|
|
22
|
+
}, ue = { class: "qy-remark-image__popover" }, ie = ["src"], se = { class: "qy-remark-image__popover-footer" }, ne = N({
|
|
23
|
+
__name: "index",
|
|
24
|
+
props: {
|
|
25
|
+
defaultValue: { default: "" },
|
|
26
|
+
defaultImage: { default: "" },
|
|
27
|
+
rows: { default: 6 },
|
|
28
|
+
width: { default: "" },
|
|
29
|
+
autosize: { type: [Boolean, Object], default: !1 },
|
|
30
|
+
disabled: { type: Boolean, default: !1 },
|
|
31
|
+
placeholder: { default: "粘贴图片上传" },
|
|
32
|
+
type: { default: "textarea" },
|
|
33
|
+
api: { default: "/permission-api/common/uploads" },
|
|
34
|
+
tokenKey: { default: "Admin-Token" }
|
|
35
|
+
},
|
|
36
|
+
emits: ["change"],
|
|
37
|
+
setup(z, { expose: V, emit: C }) {
|
|
38
|
+
const r = z, D = C, U = j(), y = f(null), o = f(""), l = f(""), d = f(!1), P = B(
|
|
39
|
+
() => r.type === "text" ? "text" : "textarea"
|
|
40
|
+
), R = B(() => {
|
|
41
|
+
if (r.width)
|
|
42
|
+
return {
|
|
43
|
+
width: typeof r.width == "number" ? `${r.width}px` : r.width
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
I(
|
|
47
|
+
() => r.defaultValue,
|
|
48
|
+
(e) => {
|
|
49
|
+
const a = T(e || "");
|
|
50
|
+
o.value = a.text, l.value = a.imageUrl || r.defaultImage || "";
|
|
51
|
+
},
|
|
52
|
+
{ immediate: !0 }
|
|
53
|
+
), I(
|
|
54
|
+
() => r.defaultImage,
|
|
55
|
+
(e) => {
|
|
56
|
+
e !== void 0 && !T(r.defaultValue || "").imageUrl && (l.value = e || "");
|
|
57
|
+
},
|
|
58
|
+
{ immediate: !0 }
|
|
59
|
+
), K(() => {
|
|
60
|
+
M(S);
|
|
61
|
+
}), O(() => {
|
|
62
|
+
const e = b();
|
|
63
|
+
e && e.removeEventListener("paste", _);
|
|
64
|
+
});
|
|
65
|
+
function b() {
|
|
66
|
+
var e, a;
|
|
67
|
+
return ((e = y.value) == null ? void 0 : e.textarea) || ((a = y.value) == null ? void 0 : a.input) || null;
|
|
68
|
+
}
|
|
69
|
+
function S() {
|
|
70
|
+
const e = b();
|
|
71
|
+
e && (e.removeEventListener("paste", _), e.addEventListener("paste", _));
|
|
72
|
+
}
|
|
73
|
+
function L(e) {
|
|
74
|
+
o.value = Z(e || "");
|
|
75
|
+
}
|
|
76
|
+
function x() {
|
|
77
|
+
l.value = "", k();
|
|
78
|
+
}
|
|
79
|
+
async function _(e) {
|
|
80
|
+
var s;
|
|
81
|
+
const i = Array.from(((s = e.clipboardData) == null ? void 0 : s.files) || []).find((m) => m.type.startsWith("image/"));
|
|
82
|
+
i && (e.preventDefault(), await F({
|
|
83
|
+
file: i,
|
|
84
|
+
onError: () => {
|
|
85
|
+
},
|
|
86
|
+
onProgress: () => {
|
|
87
|
+
},
|
|
88
|
+
onSuccess: () => {
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
async function F(e) {
|
|
93
|
+
var a, i, s, m;
|
|
94
|
+
if (e.file.size > 51200 * 1e3)
|
|
95
|
+
return w.error("图片过大"), !1;
|
|
96
|
+
d.value = !0;
|
|
97
|
+
try {
|
|
98
|
+
const c = new FormData();
|
|
99
|
+
c.append("files", e.file);
|
|
100
|
+
const A = Y.get(r.tokenKey), t = await (await fetch(r.api, {
|
|
101
|
+
method: "POST",
|
|
102
|
+
body: c,
|
|
103
|
+
credentials: "include",
|
|
104
|
+
headers: A ? { Authorization: `Bearer ${A}` } : void 0
|
|
105
|
+
})).json(), E = (t == null ? void 0 : t.urls) ?? ((a = t == null ? void 0 : t.data) == null ? void 0 : a.urls) ?? ((i = t == null ? void 0 : t.data) == null ? void 0 : i.url) ?? (t == null ? void 0 : t.url) ?? "";
|
|
106
|
+
return l.value = Array.isArray(E) ? E[0] : E, k(), w.success("上传图片成功"), (s = e.onSuccess) == null || s.call(e, t), !0;
|
|
107
|
+
} catch (c) {
|
|
108
|
+
return (m = e.onError) == null || m.call(e, c), w.error("上传失败"), !1;
|
|
109
|
+
} finally {
|
|
110
|
+
d.value = !1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function k() {
|
|
114
|
+
D(
|
|
115
|
+
"change",
|
|
116
|
+
q(o.value || "", l.value || ""),
|
|
117
|
+
l.value || ""
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
return V({
|
|
121
|
+
deleteImage: x,
|
|
122
|
+
getValue: () => ({
|
|
123
|
+
text: o.value || "",
|
|
124
|
+
imageUrl: l.value || "",
|
|
125
|
+
value: q(o.value || "", l.value || "")
|
|
126
|
+
})
|
|
127
|
+
}), (e, a) => (v(), p("div", {
|
|
128
|
+
class: "qy-remark-image",
|
|
129
|
+
style: W(R.value)
|
|
130
|
+
}, [
|
|
131
|
+
u("div", ae, [
|
|
132
|
+
g(n(G), $({
|
|
133
|
+
ref_key: "inputRef",
|
|
134
|
+
ref: y,
|
|
135
|
+
"model-value": o.value,
|
|
136
|
+
type: P.value,
|
|
137
|
+
rows: e.rows,
|
|
138
|
+
autosize: e.autosize,
|
|
139
|
+
disabled: e.disabled,
|
|
140
|
+
placeholder: e.placeholder
|
|
141
|
+
}, n(U), {
|
|
142
|
+
"onUpdate:modelValue": L,
|
|
143
|
+
onBlur: k
|
|
144
|
+
}), null, 16, ["model-value", "type", "rows", "autosize", "disabled", "placeholder"]),
|
|
145
|
+
g(n(H), {
|
|
146
|
+
placement: "top-start",
|
|
147
|
+
width: 400,
|
|
148
|
+
trigger: "hover",
|
|
149
|
+
disabled: !l.value
|
|
150
|
+
}, {
|
|
151
|
+
reference: h(() => [
|
|
152
|
+
u("div", te, [
|
|
153
|
+
g(n(X), {
|
|
154
|
+
disabled: d.value || e.disabled,
|
|
155
|
+
class: "qy-remark-image__upload",
|
|
156
|
+
"show-file-list": !1,
|
|
157
|
+
"http-request": F
|
|
158
|
+
}, {
|
|
159
|
+
default: h(() => [
|
|
160
|
+
d.value ? (v(), p("span", re)) : l.value ? (v(), p("span", oe)) : (v(), p("span", le))
|
|
161
|
+
]),
|
|
162
|
+
_: 1
|
|
163
|
+
}, 8, ["disabled"])
|
|
164
|
+
])
|
|
165
|
+
]),
|
|
166
|
+
default: h(() => [
|
|
167
|
+
u("div", ue, [
|
|
168
|
+
u("img", {
|
|
169
|
+
src: l.value,
|
|
170
|
+
class: "qy-remark-image__preview-img"
|
|
171
|
+
}, null, 8, ie),
|
|
172
|
+
u("div", se, [
|
|
173
|
+
a[1] || (a[1] = u("span", { class: "qy-remark-image__popover-tip" }, "再次点击按钮可更换图片", -1)),
|
|
174
|
+
g(n(J), {
|
|
175
|
+
link: "",
|
|
176
|
+
size: "small",
|
|
177
|
+
type: "danger",
|
|
178
|
+
disabled: e.disabled,
|
|
179
|
+
onClick: x
|
|
180
|
+
}, {
|
|
181
|
+
default: h(() => a[0] || (a[0] = [
|
|
182
|
+
Q(" 删除图片 ", -1)
|
|
183
|
+
])),
|
|
184
|
+
_: 1,
|
|
185
|
+
__: [0]
|
|
186
|
+
}, 8, ["disabled"])
|
|
187
|
+
])
|
|
188
|
+
])
|
|
189
|
+
]),
|
|
190
|
+
_: 1
|
|
191
|
+
}, 8, ["disabled"])
|
|
192
|
+
])
|
|
193
|
+
], 4));
|
|
194
|
+
}
|
|
195
|
+
}), he = /* @__PURE__ */ ee(ne, [["__scopeId", "data-v-3b943ab8"]]);
|
|
196
|
+
export {
|
|
197
|
+
he as default
|
|
198
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(t){const r=t==null?void 0:t.match(/(\[url\:(.*?)\])(.*)/);return r?{imageUrl:r[2],text:r[3]}:{imageUrl:"",text:t||""}}function a(t){const r=String(t||"").match(/(\[url\:.*?\])([\s\S]*)/);return r?r[2]:t}function n(t,r){return r?`[url:${r}]${t}`:t}exports.formatRemarkText=a;exports.parseRemarkText=e;exports.parseRemarkWithImage=n;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function r(t) {
|
|
2
|
+
const n = t == null ? void 0 : t.match(/(\[url\:(.*?)\])(.*)/);
|
|
3
|
+
return n ? {
|
|
4
|
+
imageUrl: n[2],
|
|
5
|
+
text: n[3]
|
|
6
|
+
} : {
|
|
7
|
+
imageUrl: "",
|
|
8
|
+
text: t || ""
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function u(t) {
|
|
12
|
+
const n = String(t || "").match(/(\[url\:.*?\])([\s\S]*)/);
|
|
13
|
+
return n ? n[2] : t;
|
|
14
|
+
}
|
|
15
|
+
function c(t, n) {
|
|
16
|
+
return n ? `[url:${n}]${t}` : t;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
u as formatRemarkText,
|
|
20
|
+
r as parseRemarkText,
|
|
21
|
+
c as parseRemarkWithImage
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("element-plus/es"),e=require("vue"),O=require("@element-plus/icons-vue"),v=require("element-plus"),oe=require("../utils/auth.cjs");;/* empty css */;/* empty css */const ie=require("../../_virtual/plugin-vue_export-helper.cjs"),se={class:"qy-upload__hint"},ne=["src"],re={key:1,class:"qy-upload__tip"},ue={class:"error"},de={class:"error"},ce=Object.assign({name:"QyUpload"},{__name:"index",props:{defaultValue:{type:Object,default:()=>({files:"",text:""})},multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},fileType:{type:Array,default:()=>[]},fileSize:{type:Number,default:10},limit:{type:Number,default:9},isShowTip:{type:Boolean,default:!1},api:{type:String,default:"/permission-api/common/uploads"},name:{type:String,default:"file"},tokenKey:{type:String,default:"Admin-Token"},supportVideo:{type:Boolean,default:!1},size:{type:String,default:"default"},disableDrag:{type:Boolean,default:!1},callBack:{type:Function,default:null},extraData:{type:Object,default:()=>({})}},emits:["change","success","error","remove"],setup(p,{expose:A,emit:I}){const s=p,g=I,h=e.ref(null),u=e.ref([]),M=e.ref(null),x=[],C=e.ref(!1),S=e.ref([]),E=e.ref(0),V=e.ref(!1),L=e.ref(""),T=e.ref(""),k=new Set,B=e.ref(!1),f=e.ref(""),D=e.ref(!1);e.onMounted(()=>{const l=s.defaultValue;if(!l)return;f.value=l.text??"";const t=l.files??"",o=Array.isArray(t)?t.filter(Boolean):String(t).split(",").filter(Boolean);o.length&&(u.value=o.map((a,i)=>({name:a.split("/").pop()||`file-${i}`,url:a,status:"success",uid:Date.now()+i})))});const P=e.computed(()=>({large:"160px",default:"140px",small:"80px"})[s.size]??s.size),H=e.computed(()=>s.disabled),W=e.computed(()=>{var l;return s.isShowTip&&(s.fileSize||((l=m.value)==null?void 0:l.length))}),m=e.computed(()=>{var l;return(l=s.fileType)!=null&&l.length?s.fileType.map(t=>t.toLowerCase()):s.supportVideo?["mp4","mov","avi"]:["jpg","jpeg","png","gif","webp"]}),N=e.computed(()=>{const l=s.supportVideo?1:s.limit;return u.value.length>=l}),X=e.computed(()=>m.value.map(l=>`.${l}`).join(",")),K=e.computed(()=>({"qy-upload--reached-limit":N.value,"qy-upload--disabled":s.disabled,"qy-upload--video":s.supportVideo}));e.watch(f,()=>b());function Q(){var l;(l=M.value)==null||l.focus()}function b(l){const a={files:(l??u.value).filter(i=>i.status==="success"&&i.url).map(i=>i.url),text:f.value};g("change",a),s.callBack&&s.callBack(a)}function J(l,t){b(t)}function G(l){var a;if(!(l.size/1024/1024<s.fileSize))return v.ElMessage.warning(`文件大小不能超过${s.fileSize}M`),!1;const o=((a=l.name.split(".").pop())==null?void 0:a.toLowerCase())||"";return m.value.includes(o)?!0:(v.ElMessage.warning(`格式不支持,仅允许: ${m.value.join("/")}`),!1)}function z(l,t,o,a){var $,F;const i=s.api.startsWith("http")?s.api:window.location.origin+s.api.replace(/^([^/])/,"/$1"),d=new FormData;d.append(s.name,l),s.extraData&&Object.entries(s.extraData).forEach(([r,ae])=>d.append(r,ae));const n=new XMLHttpRequest;x.push(n);const y=(($=h.value)==null?void 0:$.$el.querySelector(".el-upload--picture-card"))||((F=h.value)==null?void 0:F.$el),q=v.ElLoading.service({target:y,text:"上传中",background:"rgba(255,255,255,0.7)"}),c=()=>{const r=x.indexOf(n);r!==-1&&x.splice(r,1),q.close()};n.open("POST",i);const _=oe.getToken(s.tokenKey);_&&n.setRequestHeader("Authorization",`Bearer ${_}`),n.upload.onprogress=r=>{r.total>0&&(t==null||t({percent:r.loaded/r.total*100}))},n.onload=()=>{if(c(),n.status<200||n.status>=300){const r=`上传失败 (HTTP ${n.status})`;v.ElMessage.error(r),g("error",{msg:r,status:n.status}),a==null||a(new Error(r));return}try{const r=JSON.parse(n.responseText);r.code===200&&r.urls?(v.ElMessage.success("上传成功"),o==null||o({...r,url:r.urls})):(v.ElMessage.error(r.msg||"上传失败"),g("error",r),a==null||a(r))}catch{v.ElMessage.error("上传失败,响应格式错误"),g("error",new Error("Response parse error")),a==null||a(new Error("Response parse error"))}},n.onerror=()=>{c(),v.ElMessage.error("上传失败,网络异常"),g("error",new Error("Network error")),a==null||a(new Error("Network error"))},n.send(d)}function R(l){return s.disabled?!1:G(l)}function Y(l){z(l.file,l.onProgress,t=>{l.onSuccess(t),b(),g("success",t)},t=>l.onError(t))}function Z(l){var a;if(!l.url)return;const t=((a=l.url.split(".").pop())==null?void 0:a.toLowerCase())||"";if(["mp4","mov","avi","webm"].includes(t)){L.value=l.url,T.value=l.name||"视频预览",V.value=!0;return}const o=u.value.filter(i=>{var d;return i.status==="success"&&i.url&&!["mp4","mov","avi","webm"].includes((d=i.url.split(".").pop())==null?void 0:d.toLowerCase())});S.value=o.map(i=>i.url),E.value=o.findIndex(i=>i.uid===l.uid)||0,C.value=!0}function ee(){C.value=!1,S.value=[]}function j(l){for(let t=0;t<l.length;t++){const o=l[t];if(!R(o))continue;const a=Date.now()+t,i=URL.createObjectURL(o);k.add(i),u.value.push({uid:a,name:o.name||`file-${a}`,status:"uploading",percentage:0,url:i}),z(o,d=>{const n=u.value.find(y=>y.uid===a);n&&(n.percentage=d.percent)},d=>{const n=u.value.find(y=>y.uid===a);n&&(n.status="success",n.url=d.url,b(),g("success",d))},()=>le(a))}}function U(l){var a;if(s.disabled)return;const t=(a=l.clipboardData)==null?void 0:a.items;if(!t)return;const o=[];for(let i=0;i<t.length;i++){const d=t[i];if(d.kind==="file"&&d.type.startsWith("image/")){const n=d.getAsFile();n&&o.push(n)}}o.length&&(l.preventDefault(),j(o))}function te(l){var o;if(B.value=!1,s.disabled||N.value)return;const t=Array.from(((o=l.dataTransfer)==null?void 0:o.files)||[]).filter(a=>{var i;return m.value.includes((i=a.name.split(".").pop())==null?void 0:i.toLowerCase())});t.length&&j(t)}function le(l){var o;const t=u.value.findIndex(a=>a.uid===l);t!==-1&&((o=u.value[t].url)!=null&&o.startsWith("blob:")&&(URL.revokeObjectURL(u.value[t].url),k.delete(u.value[t].url)),u.value.splice(t,1))}return e.onBeforeUnmount(()=>{x.forEach(l=>l.abort()),x.length=0,k.forEach(l=>URL.revokeObjectURL(l)),k.clear()}),A({openFileDialog:()=>{var l,t;s.disabled||N.value||(t=(l=h.value)==null?void 0:l.$el.querySelector('input[type="file"]'))==null||t.click()},getPathList:()=>u.value.filter(l=>l.status==="success").map(l=>l.url),clearFiles:()=>{u.value=[],f.value="",b()},getValue:()=>({files:u.value.filter(l=>l.status==="success"&&l.url).map(l=>l.url),text:f.value})}),(l,t)=>{var q;const o=w.ElIcon,a=w.ElInput,i=w.ElPopover,d=w.ElUpload,n=w.ElImageViewer,y=w.ElDialog;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["qy-upload",K.value]),style:e.normalizeStyle({"--qy-upload-size":P.value})},[e.createVNode(d,{ref_key:"uploadRef",ref:h,"file-list":u.value,"onUpdate:fileList":t[6]||(t[6]=c=>u.value=c),action:"#",multiple:p.supportVideo?!1:p.multiple,limit:p.supportVideo?1:p.limit,"list-type":p.supportVideo?"text":"picture-card",accept:X.value,disabled:H.value,"http-request":Y,"before-upload":R,"on-preview":Z,"on-remove":J},{default:e.withCtx(()=>[N.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["qy-upload__trigger",{"is-dragover":B.value}]),onPaste:U,onDragover:t[4]||(t[4]=e.withModifiers(c=>B.value=!0,["prevent"])),onDragleave:t[5]||(t[5]=e.withModifiers(c=>B.value=!1,["prevent"])),onDrop:e.withModifiers(te,["prevent"])},[e.createVNode(o,{class:"qy-upload__icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(O.Plus))]),_:1}),p.supportVideo?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t[9]||(t[9]=e.createElementVNode("span",{class:"qy-upload__label"},"点击上传视频",-1)),e.createElementVNode("span",se,"支持 "+e.toDisplayString(m.value.join(" / "))+",不超过 "+e.toDisplayString(p.fileSize)+"MB",1)],64)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"qy-upload__text",onClick:t[3]||(t[3]=e.withModifiers(()=>{},["stop"])),onPaste:e.withModifiers(U,["stop"])},[e.createVNode(i,{visible:D.value,"onUpdate:visible":t[2]||(t[2]=c=>D.value=c),placement:"bottom-start",width:220,trigger:"click","popper-class":"qy-upload__text-popover",onAfterEnter:Q},{reference:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["qy-upload__text-preview",{"is-placeholder":!f.value}])},e.toDisplayString(f.value||"输入文字"),3)]),default:e.withCtx(()=>[e.createVNode(a,{ref_key:"inputRef",ref:M,modelValue:f.value,"onUpdate:modelValue":t[0]||(t[0]=c=>f.value=c),type:"textarea",autosize:{minRows:2,maxRows:5},placeholder:"输入文字或粘贴图片",disabled:p.disabled,onBlur:t[1]||(t[1]=c=>D.value=!1),onPaste:e.withModifiers(U,["stop"])},null,8,["modelValue","disabled"])]),_:1},8,["visible"])],32)],34))]),_:1},8,["file-list","multiple","limit","list-type","accept","disabled"]),C.value?(e.openBlock(),e.createBlock(n,{key:0,"url-list":S.value,"initial-index":E.value,onClose:ee},null,8,["url-list","initial-index"])):e.createCommentVNode("",!0),e.createVNode(y,{modelValue:V.value,"onUpdate:modelValue":t[7]||(t[7]=c=>V.value=c),title:T.value,width:"640px","append-to-body":"","destroy-on-close":"",onClose:t[8]||(t[8]=c=>V.value=!1)},{default:e.withCtx(()=>[V.value?(e.openBlock(),e.createElementBlock("video",{key:0,src:L.value,controls:"",autoplay:"",style:{width:"100%","max-height":"400px","border-radius":"4px"}},null,8,ne)):e.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),W.value?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(o,null,{default:e.withCtx(()=>[e.createVNode(e.unref(O.InfoFilled))]),_:1}),e.createElementVNode("span",null,[t[12]||(t[12]=e.createTextVNode(" 请上传 ",-1)),p.fileSize?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t[10]||(t[10]=e.createTextVNode("大小不超过 ",-1)),e.createElementVNode("b",ue,e.toDisplayString(p.fileSize)+"MB",1)],64)):e.createCommentVNode("",!0),(q=m.value)!=null&&q.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t[11]||(t[11]=e.createTextVNode(",格式为 ",-1)),e.createElementVNode("b",de,e.toDisplayString(m.value.join("/")),1)],64)):e.createCommentVNode("",!0),t[13]||(t[13]=e.createTextVNode(" 的文件。 ",-1))])])):e.createCommentVNode("",!0)],6)}}}),pe=ie.default(ce,[["__scopeId","data-v-c1472320"]]);exports.default=pe;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
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
|
|
2
|
+
import { ref as p, 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
3
|
import { Plus as Le, InfoFilled as Se } from "@element-plus/icons-vue";
|
|
4
4
|
import { ElMessage as V, ElLoading as De } from "element-plus";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
5
|
+
import { getToken as Re } from "../utils/auth.mjs";
|
|
6
|
+
/* empty css */
|
|
7
|
+
/* empty css */
|
|
8
|
+
import qe from "../../_virtual/plugin-vue_export-helper.mjs";
|
|
9
|
+
const ze = { class: "qy-upload__hint" }, Te = ["src"], je = {
|
|
12
10
|
key: 1,
|
|
13
11
|
class: "qy-upload__tip"
|
|
14
|
-
},
|
|
12
|
+
}, _e = { class: "error" }, $e = { class: "error" }, Ce = Object.assign({
|
|
15
13
|
name: "QyUpload"
|
|
16
14
|
}, {
|
|
17
15
|
__name: "index",
|
|
@@ -54,8 +52,8 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
54
52
|
extraData: { type: Object, default: () => ({}) }
|
|
55
53
|
},
|
|
56
54
|
emits: ["change", "success", "error", "remove"],
|
|
57
|
-
setup(
|
|
58
|
-
const o =
|
|
55
|
+
setup(c, { expose: Z, emit: ee }) {
|
|
56
|
+
const o = c, g = ee, q = p(null), u = p([]), N = p(null), L = [], C = p(!1), F = p([]), P = p(0), S = p(!1), E = p(""), H = p(""), z = /* @__PURE__ */ new Set(), T = p(!1), f = p(""), O = p(!1);
|
|
59
57
|
he(() => {
|
|
60
58
|
const t = o.defaultValue;
|
|
61
59
|
if (!t) return;
|
|
@@ -76,13 +74,13 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
76
74
|
), v = x(() => {
|
|
77
75
|
var t;
|
|
78
76
|
return (t = o.fileType) != null && t.length ? o.fileType.map((e) => e.toLowerCase()) : o.supportVideo ? ["mp4", "mov", "avi"] : ["jpg", "jpeg", "png", "gif", "webp"];
|
|
79
|
-
}),
|
|
77
|
+
}), j = x(() => {
|
|
80
78
|
const t = o.supportVideo ? 1 : o.limit;
|
|
81
79
|
return u.value.length >= t;
|
|
82
80
|
}), ie = x(
|
|
83
81
|
() => v.value.map((t) => `.${t}`).join(",")
|
|
84
82
|
), oe = x(() => ({
|
|
85
|
-
"qy-upload--reached-limit":
|
|
83
|
+
"qy-upload--reached-limit": j.value,
|
|
86
84
|
"qy-upload--disabled": o.disabled,
|
|
87
85
|
"qy-upload--video": o.supportVideo
|
|
88
86
|
}));
|
|
@@ -107,23 +105,23 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
107
105
|
`格式不支持,仅允许: ${v.value.join("/")}`
|
|
108
106
|
), !1);
|
|
109
107
|
}
|
|
110
|
-
function
|
|
108
|
+
function W(t, e, a, l) {
|
|
111
109
|
var J, G;
|
|
112
110
|
const i = o.api.startsWith("http") ? o.api : window.location.origin + o.api.replace(/^([^/])/, "/$1"), r = new FormData();
|
|
113
111
|
r.append(o.name, t), o.extraData && Object.entries(o.extraData).forEach(([n, ve]) => r.append(n, ve));
|
|
114
112
|
const s = new XMLHttpRequest();
|
|
115
113
|
L.push(s);
|
|
116
|
-
const b = ((J =
|
|
114
|
+
const b = ((J = q.value) == null ? void 0 : J.$el.querySelector(".el-upload--picture-card")) || ((G = q.value) == null ? void 0 : G.$el), _ = De.service({
|
|
117
115
|
target: b,
|
|
118
116
|
text: "上传中",
|
|
119
117
|
background: "rgba(255,255,255,0.7)"
|
|
120
118
|
}), d = () => {
|
|
121
119
|
const n = L.indexOf(s);
|
|
122
|
-
n !== -1 && L.splice(n, 1),
|
|
120
|
+
n !== -1 && L.splice(n, 1), _.close();
|
|
123
121
|
};
|
|
124
122
|
s.open("POST", i);
|
|
125
|
-
const
|
|
126
|
-
|
|
123
|
+
const Q = Re(o.tokenKey);
|
|
124
|
+
Q && s.setRequestHeader("Authorization", `Bearer ${Q}`), s.upload.onprogress = (n) => {
|
|
127
125
|
n.total > 0 && (e == null || e({ percent: n.loaded / n.total * 100 }));
|
|
128
126
|
}, s.onload = () => {
|
|
129
127
|
if (d(), s.status < 200 || s.status >= 300) {
|
|
@@ -141,11 +139,11 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
141
139
|
d(), V.error("上传失败,网络异常"), g("error", new Error("Network error")), l == null || l(new Error("Network error"));
|
|
142
140
|
}, s.send(r);
|
|
143
141
|
}
|
|
144
|
-
function
|
|
142
|
+
function X(t) {
|
|
145
143
|
return o.disabled ? !1 : ue(t);
|
|
146
144
|
}
|
|
147
145
|
function re(t) {
|
|
148
|
-
|
|
146
|
+
W(
|
|
149
147
|
t.file,
|
|
150
148
|
t.onProgress,
|
|
151
149
|
(e) => {
|
|
@@ -170,23 +168,23 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
170
168
|
);
|
|
171
169
|
}
|
|
172
170
|
);
|
|
173
|
-
|
|
171
|
+
F.value = a.map((i) => i.url), P.value = a.findIndex((i) => i.uid === t.uid) || 0, C.value = !0;
|
|
174
172
|
}
|
|
175
173
|
function pe() {
|
|
176
|
-
C.value = !1,
|
|
174
|
+
C.value = !1, F.value = [];
|
|
177
175
|
}
|
|
178
|
-
function
|
|
176
|
+
function K(t) {
|
|
179
177
|
for (let e = 0; e < t.length; e++) {
|
|
180
178
|
const a = t[e];
|
|
181
|
-
if (!
|
|
179
|
+
if (!X(a)) continue;
|
|
182
180
|
const l = Date.now() + e, i = URL.createObjectURL(a);
|
|
183
|
-
|
|
181
|
+
z.add(i), u.value.push({
|
|
184
182
|
uid: l,
|
|
185
183
|
name: a.name || `file-${l}`,
|
|
186
184
|
status: "uploading",
|
|
187
185
|
percentage: 0,
|
|
188
186
|
url: i
|
|
189
|
-
}),
|
|
187
|
+
}), W(
|
|
190
188
|
a,
|
|
191
189
|
(r) => {
|
|
192
190
|
const s = u.value.find((b) => b.uid === l);
|
|
@@ -200,7 +198,7 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
200
198
|
);
|
|
201
199
|
}
|
|
202
200
|
}
|
|
203
|
-
function
|
|
201
|
+
function A(t) {
|
|
204
202
|
var l;
|
|
205
203
|
if (o.disabled) return;
|
|
206
204
|
const e = (l = t.clipboardData) == null ? void 0 : l.items;
|
|
@@ -213,30 +211,30 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
213
211
|
s && a.push(s);
|
|
214
212
|
}
|
|
215
213
|
}
|
|
216
|
-
a.length && (t.preventDefault(),
|
|
214
|
+
a.length && (t.preventDefault(), K(a));
|
|
217
215
|
}
|
|
218
216
|
function ce(t) {
|
|
219
217
|
var a;
|
|
220
|
-
if (
|
|
218
|
+
if (T.value = !1, o.disabled || j.value) return;
|
|
221
219
|
const e = Array.from(((a = t.dataTransfer) == null ? void 0 : a.files) || []).filter(
|
|
222
220
|
(l) => {
|
|
223
221
|
var i;
|
|
224
222
|
return v.value.includes((i = l.name.split(".").pop()) == null ? void 0 : i.toLowerCase());
|
|
225
223
|
}
|
|
226
224
|
);
|
|
227
|
-
e.length &&
|
|
225
|
+
e.length && K(e);
|
|
228
226
|
}
|
|
229
227
|
function fe(t) {
|
|
230
228
|
var a;
|
|
231
229
|
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),
|
|
230
|
+
e !== -1 && ((a = u.value[e].url) != null && a.startsWith("blob:") && (URL.revokeObjectURL(u.value[e].url), z.delete(u.value[e].url)), u.value.splice(e, 1));
|
|
233
231
|
}
|
|
234
232
|
return Ve(() => {
|
|
235
|
-
L.forEach((t) => t.abort()), L.length = 0,
|
|
233
|
+
L.forEach((t) => t.abort()), L.length = 0, z.forEach((t) => URL.revokeObjectURL(t)), z.clear();
|
|
236
234
|
}), Z({
|
|
237
235
|
openFileDialog: () => {
|
|
238
236
|
var t, e;
|
|
239
|
-
o.disabled ||
|
|
237
|
+
o.disabled || j.value || (e = (t = q.value) == null ? void 0 : t.$el.querySelector('input[type="file"]')) == null || e.click();
|
|
240
238
|
},
|
|
241
239
|
getPathList: () => u.value.filter((t) => t.status === "success").map((t) => t.url),
|
|
242
240
|
clearFiles: () => {
|
|
@@ -247,7 +245,7 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
247
245
|
text: f.value
|
|
248
246
|
})
|
|
249
247
|
}), (t, e) => {
|
|
250
|
-
var
|
|
248
|
+
var _;
|
|
251
249
|
const a = ye, l = be, i = ge, r = me, s = xe, b = we;
|
|
252
250
|
return m(), w("div", {
|
|
253
251
|
class: I(["qy-upload", oe.value]),
|
|
@@ -255,27 +253,27 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
255
253
|
}, [
|
|
256
254
|
y(r, {
|
|
257
255
|
ref_key: "uploadRef",
|
|
258
|
-
ref:
|
|
256
|
+
ref: q,
|
|
259
257
|
"file-list": u.value,
|
|
260
258
|
"onUpdate:fileList": e[6] || (e[6] = (d) => u.value = d),
|
|
261
259
|
action: "#",
|
|
262
|
-
multiple:
|
|
263
|
-
limit:
|
|
264
|
-
"list-type":
|
|
260
|
+
multiple: c.supportVideo ? !1 : c.multiple,
|
|
261
|
+
limit: c.supportVideo ? 1 : c.limit,
|
|
262
|
+
"list-type": c.supportVideo ? "text" : "picture-card",
|
|
265
263
|
accept: ie.value,
|
|
266
264
|
disabled: le.value,
|
|
267
265
|
"http-request": re,
|
|
268
|
-
"before-upload":
|
|
266
|
+
"before-upload": X,
|
|
269
267
|
"on-preview": de,
|
|
270
268
|
"on-remove": ne
|
|
271
269
|
}, {
|
|
272
270
|
default: U(() => [
|
|
273
|
-
|
|
271
|
+
j.value ? h("", !0) : (m(), w("div", {
|
|
274
272
|
key: 0,
|
|
275
|
-
class: I(["qy-upload__trigger", { "is-dragover":
|
|
276
|
-
onPaste:
|
|
277
|
-
onDragover: e[4] || (e[4] = B((d) =>
|
|
278
|
-
onDragleave: e[5] || (e[5] = B((d) =>
|
|
273
|
+
class: I(["qy-upload__trigger", { "is-dragover": T.value }]),
|
|
274
|
+
onPaste: A,
|
|
275
|
+
onDragover: e[4] || (e[4] = B((d) => T.value = !0, ["prevent"])),
|
|
276
|
+
onDragleave: e[5] || (e[5] = B((d) => T.value = !1, ["prevent"])),
|
|
279
277
|
onDrop: B(ce, ["prevent"])
|
|
280
278
|
}, [
|
|
281
279
|
y(a, { class: "qy-upload__icon" }, {
|
|
@@ -284,19 +282,19 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
284
282
|
]),
|
|
285
283
|
_: 1
|
|
286
284
|
}),
|
|
287
|
-
|
|
285
|
+
c.supportVideo ? (m(), w(M, { key: 0 }, [
|
|
288
286
|
e[9] || (e[9] = k("span", { class: "qy-upload__label" }, "点击上传视频", -1)),
|
|
289
|
-
k("span",
|
|
287
|
+
k("span", ze, "支持 " + R(v.value.join(" / ")) + ",不超过 " + R(c.fileSize) + "MB", 1)
|
|
290
288
|
], 64)) : h("", !0),
|
|
291
289
|
k("div", {
|
|
292
290
|
class: "qy-upload__text",
|
|
293
291
|
onClick: e[3] || (e[3] = B(() => {
|
|
294
292
|
}, ["stop"])),
|
|
295
|
-
onPaste: B(
|
|
293
|
+
onPaste: B(A, ["stop"])
|
|
296
294
|
}, [
|
|
297
295
|
y(i, {
|
|
298
|
-
visible:
|
|
299
|
-
"onUpdate:visible": e[2] || (e[2] = (d) =>
|
|
296
|
+
visible: O.value,
|
|
297
|
+
"onUpdate:visible": e[2] || (e[2] = (d) => O.value = d),
|
|
300
298
|
placement: "bottom-start",
|
|
301
299
|
width: 220,
|
|
302
300
|
trigger: "click",
|
|
@@ -317,9 +315,9 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
317
315
|
type: "textarea",
|
|
318
316
|
autosize: { minRows: 2, maxRows: 5 },
|
|
319
317
|
placeholder: "输入文字或粘贴图片",
|
|
320
|
-
disabled:
|
|
321
|
-
onBlur: e[1] || (e[1] = (d) =>
|
|
322
|
-
onPaste: B(
|
|
318
|
+
disabled: c.disabled,
|
|
319
|
+
onBlur: e[1] || (e[1] = (d) => O.value = !1),
|
|
320
|
+
onPaste: B(A, ["stop"])
|
|
323
321
|
}, null, 8, ["modelValue", "disabled"])
|
|
324
322
|
]),
|
|
325
323
|
_: 1
|
|
@@ -331,7 +329,7 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
331
329
|
}, 8, ["file-list", "multiple", "limit", "list-type", "accept", "disabled"]),
|
|
332
330
|
C.value ? (m(), Be(s, {
|
|
333
331
|
key: 0,
|
|
334
|
-
"url-list":
|
|
332
|
+
"url-list": F.value,
|
|
335
333
|
"initial-index": P.value,
|
|
336
334
|
onClose: pe
|
|
337
335
|
}, null, 8, ["url-list", "initial-index"])) : h("", !0),
|
|
@@ -351,11 +349,11 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
351
349
|
controls: "",
|
|
352
350
|
autoplay: "",
|
|
353
351
|
style: { width: "100%", "max-height": "400px", "border-radius": "4px" }
|
|
354
|
-
}, null, 8,
|
|
352
|
+
}, null, 8, Te)) : h("", !0)
|
|
355
353
|
]),
|
|
356
354
|
_: 1
|
|
357
355
|
}, 8, ["modelValue", "title"]),
|
|
358
|
-
ae.value ? (m(), w("div",
|
|
356
|
+
ae.value ? (m(), w("div", je, [
|
|
359
357
|
y(a, null, {
|
|
360
358
|
default: U(() => [
|
|
361
359
|
y(Y(Se))
|
|
@@ -364,13 +362,13 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
364
362
|
}),
|
|
365
363
|
k("span", null, [
|
|
366
364
|
e[12] || (e[12] = $(" 请上传 ", -1)),
|
|
367
|
-
|
|
365
|
+
c.fileSize ? (m(), w(M, { key: 0 }, [
|
|
368
366
|
e[10] || (e[10] = $("大小不超过 ", -1)),
|
|
369
|
-
k("b",
|
|
367
|
+
k("b", _e, R(c.fileSize) + "MB", 1)
|
|
370
368
|
], 64)) : h("", !0),
|
|
371
|
-
(
|
|
369
|
+
(_ = v.value) != null && _.length ? (m(), w(M, { key: 1 }, [
|
|
372
370
|
e[11] || (e[11] = $(",格式为 ", -1)),
|
|
373
|
-
k("b",
|
|
371
|
+
k("b", $e, R(v.value.join("/")), 1)
|
|
374
372
|
], 64)) : h("", !0),
|
|
375
373
|
e[13] || (e[13] = $(" 的文件。 ", -1))
|
|
376
374
|
])
|
|
@@ -378,7 +376,7 @@ const _e = { class: "qy-upload__hint" }, je = ["src"], $e = {
|
|
|
378
376
|
], 6);
|
|
379
377
|
};
|
|
380
378
|
}
|
|
381
|
-
}), He = /* @__PURE__ */
|
|
379
|
+
}), He = /* @__PURE__ */ qe(Ce, [["__scopeId", "data-v-c1472320"]]);
|
|
382
380
|
export {
|
|
383
|
-
He as
|
|
381
|
+
He as default
|
|
384
382
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.cjs"),o="Admin-Token";function n(e=o){return t.default.get(e)}exports.getToken=n;
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});/*! js-cookie v3.0.1 | MIT */function u(r){for(var i=1;i<arguments.length;i++){var f=arguments[i];for(var p in f)r[p]=f[p]}return r}var v={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,i){function f(n,c,e){if(!(typeof document>"u")){e=u({},i,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 t in e)e[t]&&(o+="; "+t,e[t]!==!0&&(o+="="+e[t].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 t=c[o].split("="),a=t.slice(1).join("=");try{var d=decodeURIComponent(t[0]);if(e[d]=r.read(a,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(i)},converter:{value:Object.freeze(r)}})}var l=s(v,{path:"/"});exports.default=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../lib/qy-action-bar/index.vue.cjs"),t=require("../lib/utils/install.cjs"),i=t.withInstall(e.default,"QyActionBar");exports.default=i;
|
package/dist/qy-dialog/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../index
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../lib/dialog/index.vue.cjs"),t=require("../lib/utils/install.cjs"),l=t.withInstall(e.default,"QyDialog");exports.default=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../index
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../lib/qy-form-section/index.vue.cjs"),t=require("../lib/utils/install.cjs"),i=t.withInstall(e.default,"QyFormSection");exports.default=i;
|