@qynpm/ui 1.0.5 → 1.0.6
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 +54 -19
- package/dist/qy-action-bar/index.cjs +1 -1
- package/dist/qy-action-bar/index.mjs +4 -4
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +4 -5
- package/dist/qy-form-section/index.cjs +1 -1
- package/dist/qy-form-section/index.mjs +2 -2
- package/dist/qy-input/index.cjs +1 -1
- package/dist/qy-input/index.mjs +4 -4
- package/dist/qy-money-input/index.cjs +1 -1
- package/dist/qy-money-input/index.mjs +4 -4
- package/dist/qy-radio-group/index.cjs +1 -1
- package/dist/qy-radio-group/index.mjs +4 -4
- package/dist/qy-record-quote-search/index.cjs +1 -1
- package/dist/qy-record-quote-search/index.mjs +2 -2
- package/dist/qy-remark-image/index.cjs +1 -2
- package/dist/qy-remark-image/index.mjs +3 -4
- package/dist/qy-remote-select/index.cjs +1 -1
- package/dist/qy-remote-select/index.mjs +4 -4
- package/dist/qy-search-input/index.cjs +1 -1
- package/dist/qy-search-input/index.mjs +3 -3
- package/dist/qy-select/index.cjs +1 -1
- package/dist/qy-select/index.mjs +4 -4
- package/dist/qy-upload/index.cjs +1 -1
- package/dist/qy-upload/index.mjs +3 -3
- package/dist/qy-voucher-upload/index.cjs +1 -1
- package/dist/qy-voucher-upload/index.mjs +4 -4
- package/dist/shared/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
- package/dist/shared/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/dist/{lib/qy-action-bar/index.vue2.mjs → shared/index-Bw9kVFsm.mjs} +14 -13
- package/dist/{lib/qy-record-quote-search/index.vue2.mjs → shared/index-BzV4959-.mjs} +58 -57
- package/dist/{lib/qy-form-section/index.vue2.mjs → shared/index-C0ADdL4S.mjs} +20 -19
- package/dist/shared/index-CBSjmD0C.mjs +217 -0
- package/dist/shared/index-CJb1S7CP.cjs +1 -0
- package/dist/shared/index-CO8lz02r.cjs +1 -0
- package/dist/shared/index-ClPxDFKd.cjs +1 -0
- package/dist/shared/index-CtOqRiaj.cjs +1 -0
- package/dist/shared/index-DXB7_Tb5.cjs +1 -0
- package/dist/{lib/upload/index.vue.mjs → shared/index-DeWkPj3O.mjs} +121 -119
- package/dist/{lib/qy-voucher-upload/index.vue.mjs → shared/index-PUYQxK94.mjs} +2 -2
- package/dist/shared/index-UzZbxoqZ.cjs +1 -0
- package/dist/shared/index-a90QeEC4.cjs +1 -0
- package/dist/{lib/qy-search-input/index.vue2.mjs → shared/index-wW02nNOp.mjs} +50 -49
- package/dist/{lib/qy-remote-select/index.vue.mjs → shared/index.vue_vue_type_script_setup_true_lang-BcZg8D-y.mjs} +2 -2
- package/dist/{lib/qy-select/index.vue.mjs → shared/index.vue_vue_type_script_setup_true_lang-BmeBeCu0.mjs} +1 -1
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-C85575cL.cjs +1 -0
- package/dist/{lib/qy-radio-group/index.vue.mjs → shared/index.vue_vue_type_script_setup_true_lang-DkYwdYdF.mjs} +4 -4
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-Do5SZ8yS.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DpZzyX5f.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DuUkOqwY.cjs +1 -0
- package/dist/{lib/qy-input/index.vue.mjs → shared/index.vue_vue_type_script_setup_true_lang-Dvh1BFaR.mjs} +7 -7
- package/dist/{lib/qy-money-input/index.vue.mjs → shared/index.vue_vue_type_script_setup_true_lang-RtfqJ73A.mjs} +24 -24
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-VVjCLNMD.cjs +1 -0
- package/dist/{lib/dialog/index.vue.mjs → shared/index.vue_vue_type_style_index_0_lang-DpIL_6vO.mjs} +1 -1
- package/dist/shared/index.vue_vue_type_style_index_0_lang-haqCjB5x.cjs +1 -0
- package/dist/{lib/utils/install.mjs → shared/install-CxBnxbuN.mjs} +2 -2
- package/dist/shared/install-c8il9DQv.cjs +1 -0
- package/dist/shared/js.cookie-CojEIxHg.cjs +1 -0
- package/dist/{node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs → shared/js.cookie-OLEfuq_g.mjs} +13 -13
- package/index.d.ts +20 -20
- package/package.json +1 -1
- package/qy-money-input/index.d.ts +12 -12
- package/qy-money-input/index.js +15 -15
- package/qy-radio-group/index.d.ts +12 -12
- package/qy-radio-group/index.js +15 -15
- package/qy-remote-select/index.d.ts +12 -12
- package/qy-remote-select/index.js +15 -15
- package/qy-voucher-upload/index.d.ts +12 -12
- package/qy-voucher-upload/index.js +15 -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.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-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-input/index.vue.cjs +0 -1
- 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.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.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-remote-select/index.vue.cjs +0 -1
- 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-select/index.vue.cjs +0 -1
- 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/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/utils/auth.cjs +0 -1
- package/dist/lib/utils/auth.mjs +0 -8
- package/dist/lib/utils/install.cjs +0 -1
- package/dist/node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.cjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),k=require("../upload/index.vue.cjs"),S=Object.assign({name:"QyVoucherUpload",inheritAttrs:!1},{__name:"index",props:{modelValue:{type:Array,default:()=>[]},api:{type:String,default:"/permission-api/common/uploads"},name:{type:String,default:"files"},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},tokenKey:{type:String,default:"Admin-Token"},supportVideo:{type:Boolean,default:!1},size:{type:String,default:"90px"},disableDrag:{type:Boolean,default:!1},callBack:{type:Function,default:null},extraData:{type:Object,default:()=>({})},pastePlaceholder:{type:String,default:"粘贴图片上传"}},emits:["update:modelValue","change","success","error","remove"],setup(t,{expose:r,emit:d}){const i=d,s=l.useAttrs(),n=l.ref(null);function o(e){return Array.isArray(e)?e:[]}function c(e){i("update:modelValue",o(e))}function f(e){const a=o(e==null?void 0:e.files);i("change",a)}function m(e){i("success",e)}function p(e){i("error",e)}function y(e,a){i("remove",e,a)}function h(){var e,a;(a=(e=n.value)==null?void 0:e.openFileDialog)==null||a.call(e)}function u(){var e,a;return((a=(e=n.value)==null?void 0:e.getPathList)==null?void 0:a.call(e))||[]}function g(){var e,a;(a=(e=n.value)==null?void 0:e.clearFiles)==null||a.call(e)}function b(){return u()}return r({openFileDialog:h,getPathList:u,clearFiles:g,getValue:b}),(e,a)=>(l.openBlock(),l.createBlock(k.default,l.mergeProps({ref_key:"uploadRef",ref:n},l.unref(s),{"model-value":t.modelValue,"value-format":"array",api:t.api,name:t.name,multiple:t.multiple,disabled:t.disabled,"file-type":t.fileType,"file-size":t.fileSize,limit:t.limit,"is-show-tip":t.isShowTip,"token-key":t.tokenKey,"support-video":t.supportVideo,size:t.size,"disable-drag":t.disableDrag,"call-back":t.callBack,"extra-data":t.extraData,"show-text":!1,"show-paste-input":!0,"paste-placeholder":t.pastePlaceholder,"onUpdate:modelValue":c,onChange:f,onSuccess:m,onError:p,onRemove:y}),null,16,["model-value","api","name","multiple","disabled","file-type","file-size","limit","is-show-tip","token-key","support-video","size","disable-drag","call-back","extra-data","paste-placeholder"]))}});exports.default=S;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=require("../../_virtual/_plugin-vue_export-helper.cjs"),u=t.default(e.default,[["__scopeId","data-v-dd0a0a37"]]);exports.default=u;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),n=require("element-plus"),z=require("../../node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.cjs"),u=require("./utils.cjs"),C={class:"qy-remark-image__field"},P={class:"qy-remark-image__upload-anchor"},R={key:0,class:"icon-[line-md--loading-twotone-loop]",role:"img","aria-hidden":"true"},S={key:1,class:"icon-[ion--cloud-upload-outline]",role:"img","aria-hidden":"true"},U={key:2,class:"icon-[ph--images-thin]",role:"img","aria-hidden":"true"},A={class:"qy-remark-image__popover"},M=["src"],j={class:"qy-remark-image__popover-footer"},D=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(E,{expose:b,emit:x}){const l=E,V=x,q=e.useAttrs(),p=e.ref(null),s=e.ref(""),o=e.ref(""),c=e.ref(!1),B=e.computed(()=>l.type==="text"?"text":"textarea"),T=e.computed(()=>{if(l.width)return{width:typeof l.width=="number"?`${l.width}px`:l.width}});e.watch(()=>l.defaultValue,a=>{const t=u.parseRemarkText(a||"");s.value=t.text,o.value=t.imageUrl||l.defaultImage||""},{immediate:!0}),e.watch(()=>l.defaultImage,a=>{a!==void 0&&!u.parseRemarkText(l.defaultValue||"").imageUrl&&(o.value=a||"")},{immediate:!0}),e.onMounted(()=>{e.nextTick(N)}),e.onUnmounted(()=>{const a=y();a&&a.removeEventListener("paste",v)});function y(){var a,t;return((a=p.value)==null?void 0:a.textarea)||((t=p.value)==null?void 0:t.input)||null}function N(){const a=y();a&&(a.removeEventListener("paste",v),a.addEventListener("paste",v))}function I(a){s.value=u.formatRemarkText(a||"")}function k(){o.value="",g()}async function v(a){var d;const i=Array.from(((d=a.clipboardData)==null?void 0:d.files)||[]).find(m=>m.type.startsWith("image/"));i&&(a.preventDefault(),await _({file:i,onError:()=>{},onProgress:()=>{},onSuccess:()=>{}}))}async function _(a){var t,i,d,m;if(a.file.size>51200*1e3)return n.ElMessage.error("图片过大"),!1;c.value=!0;try{const f=new FormData;f.append("files",a.file);const w=z.default.get(l.tokenKey),r=await(await fetch(l.api,{method:"POST",body:f,credentials:"include",headers:w?{Authorization:`Bearer ${w}`}:void 0})).json(),h=(r==null?void 0:r.urls)??((t=r==null?void 0:r.data)==null?void 0:t.urls)??((i=r==null?void 0:r.data)==null?void 0:i.url)??(r==null?void 0:r.url)??"";return o.value=Array.isArray(h)?h[0]:h,g(),n.ElMessage.success("上传图片成功"),(d=a.onSuccess)==null||d.call(a,r),!0}catch(f){return(m=a.onError)==null||m.call(a,f),n.ElMessage.error("上传失败"),!1}finally{c.value=!1}}function g(){V("change",u.parseRemarkWithImage(s.value||"",o.value||""),o.value||"")}return b({deleteImage:k,getValue:()=>({text:s.value||"",imageUrl:o.value||"",value:u.parseRemarkWithImage(s.value||"",o.value||"")})}),(a,t)=>(e.openBlock(),e.createElementBlock("div",{class:"qy-remark-image",style:e.normalizeStyle(T.value)},[e.createElementVNode("div",C,[e.createVNode(e.unref(n.ElInput),e.mergeProps({ref_key:"inputRef",ref:p,"model-value":s.value,type:B.value,rows:a.rows,autosize:a.autosize,disabled:a.disabled,placeholder:a.placeholder},e.unref(q),{"onUpdate:modelValue":I,onBlur:g}),null,16,["model-value","type","rows","autosize","disabled","placeholder"]),e.createVNode(e.unref(n.ElPopover),{placement:"top-start",width:400,trigger:"hover",disabled:!o.value},{reference:e.withCtx(()=>[e.createElementVNode("div",P,[e.createVNode(e.unref(n.ElUpload),{disabled:c.value||a.disabled,class:"qy-remark-image__upload","show-file-list":!1,"http-request":_},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock("span",R)):o.value?(e.openBlock(),e.createElementBlock("span",U)):(e.openBlock(),e.createElementBlock("span",S))]),_:1},8,["disabled"])])]),default:e.withCtx(()=>[e.createElementVNode("div",A,[e.createElementVNode("img",{src:o.value,class:"qy-remark-image__preview-img"},null,8,M),e.createElementVNode("div",j,[t[1]||(t[1]=e.createElementVNode("span",{class:"qy-remark-image__popover-tip"},"再次点击按钮可更换图片",-1)),e.createVNode(e.unref(n.ElButton),{link:"",size:"small",type:"danger",disabled:a.disabled,onClick:k},{default:e.withCtx(()=>t[0]||(t[0]=[e.createTextVNode(" 删除图片 ",-1)])),_:1,__:[0]},8,["disabled"])])])]),_:1},8,["disabled"])])],4))}});exports.default=D;
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { defineComponent as j, useAttrs as F, ref as f, computed as z, watch as I, onMounted as K, nextTick as M, onUnmounted as O, createElementBlock as p, openBlock as v, normalizeStyle as W, createElementVNode as i, createVNode as g, unref as d, mergeProps as $, withCtx as h, createTextVNode as G } from "vue";
|
|
2
|
-
import { ElMessage as b, ElInput as H, ElPopover as J, ElButton as Q, ElUpload as X } from "element-plus";
|
|
3
|
-
import Y from "../../node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs";
|
|
4
|
-
import { parseRemarkText as V, parseRemarkWithImage as B, formatRemarkText as Z } from "./utils.mjs";
|
|
5
|
-
const ee = { class: "qy-remark-image__field" }, ae = { class: "qy-remark-image__upload-anchor" }, te = {
|
|
6
|
-
key: 0,
|
|
7
|
-
class: "icon-[line-md--loading-twotone-loop]",
|
|
8
|
-
role: "img",
|
|
9
|
-
"aria-hidden": "true"
|
|
10
|
-
}, re = {
|
|
11
|
-
key: 1,
|
|
12
|
-
class: "icon-[ion--cloud-upload-outline]",
|
|
13
|
-
role: "img",
|
|
14
|
-
"aria-hidden": "true"
|
|
15
|
-
}, le = {
|
|
16
|
-
key: 2,
|
|
17
|
-
class: "icon-[ph--images-thin]",
|
|
18
|
-
role: "img",
|
|
19
|
-
"aria-hidden": "true"
|
|
20
|
-
}, oe = { class: "qy-remark-image__popover" }, ie = ["src"], se = { class: "qy-remark-image__popover-footer" }, fe = /* @__PURE__ */ j({
|
|
21
|
-
__name: "index",
|
|
22
|
-
props: {
|
|
23
|
-
defaultValue: { default: "" },
|
|
24
|
-
defaultImage: { default: "" },
|
|
25
|
-
rows: { default: 6 },
|
|
26
|
-
width: { default: "" },
|
|
27
|
-
autosize: { type: [Boolean, Object], default: !1 },
|
|
28
|
-
disabled: { type: Boolean, default: !1 },
|
|
29
|
-
placeholder: { default: "粘贴图片上传" },
|
|
30
|
-
type: { default: "textarea" },
|
|
31
|
-
api: { default: "/permission-api/common/uploads" },
|
|
32
|
-
tokenKey: { default: "Admin-Token" }
|
|
33
|
-
},
|
|
34
|
-
emits: ["change"],
|
|
35
|
-
setup(U, { expose: A, emit: P }) {
|
|
36
|
-
const r = U, C = P, R = F(), y = f(null), o = f(""), l = f(""), u = f(!1), S = z(
|
|
37
|
-
() => r.type === "text" ? "text" : "textarea"
|
|
38
|
-
), D = z(() => {
|
|
39
|
-
if (r.width)
|
|
40
|
-
return {
|
|
41
|
-
width: typeof r.width == "number" ? `${r.width}px` : r.width
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
I(
|
|
45
|
-
() => r.defaultValue,
|
|
46
|
-
(e) => {
|
|
47
|
-
const a = V(e || "");
|
|
48
|
-
o.value = a.text, l.value = a.imageUrl || r.defaultImage || "";
|
|
49
|
-
},
|
|
50
|
-
{ immediate: !0 }
|
|
51
|
-
), I(
|
|
52
|
-
() => r.defaultImage,
|
|
53
|
-
(e) => {
|
|
54
|
-
e !== void 0 && !V(r.defaultValue || "").imageUrl && (l.value = e || "");
|
|
55
|
-
},
|
|
56
|
-
{ immediate: !0 }
|
|
57
|
-
), K(() => {
|
|
58
|
-
M(L);
|
|
59
|
-
}), O(() => {
|
|
60
|
-
const e = x();
|
|
61
|
-
e && e.removeEventListener("paste", _);
|
|
62
|
-
});
|
|
63
|
-
function x() {
|
|
64
|
-
var e, a;
|
|
65
|
-
return ((e = y.value) == null ? void 0 : e.textarea) || ((a = y.value) == null ? void 0 : a.input) || null;
|
|
66
|
-
}
|
|
67
|
-
function L() {
|
|
68
|
-
const e = x();
|
|
69
|
-
e && (e.removeEventListener("paste", _), e.addEventListener("paste", _));
|
|
70
|
-
}
|
|
71
|
-
function N(e) {
|
|
72
|
-
o.value = Z(e || "");
|
|
73
|
-
}
|
|
74
|
-
function E() {
|
|
75
|
-
l.value = "", k();
|
|
76
|
-
}
|
|
77
|
-
async function _(e) {
|
|
78
|
-
var n;
|
|
79
|
-
const s = Array.from(((n = e.clipboardData) == null ? void 0 : n.files) || []).find((m) => m.type.startsWith("image/"));
|
|
80
|
-
s && (e.preventDefault(), await T({
|
|
81
|
-
file: s,
|
|
82
|
-
onError: () => {
|
|
83
|
-
},
|
|
84
|
-
onProgress: () => {
|
|
85
|
-
},
|
|
86
|
-
onSuccess: () => {
|
|
87
|
-
}
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
async function T(e) {
|
|
91
|
-
var a, s, n, m;
|
|
92
|
-
if (e.file.size > 51200 * 1e3)
|
|
93
|
-
return b.error("图片过大"), !1;
|
|
94
|
-
u.value = !0;
|
|
95
|
-
try {
|
|
96
|
-
const c = new FormData();
|
|
97
|
-
c.append("files", e.file);
|
|
98
|
-
const q = Y.get(r.tokenKey), t = await (await fetch(r.api, {
|
|
99
|
-
method: "POST",
|
|
100
|
-
body: c,
|
|
101
|
-
credentials: "include",
|
|
102
|
-
headers: q ? { Authorization: `Bearer ${q}` } : void 0
|
|
103
|
-
})).json(), w = (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) ?? "";
|
|
104
|
-
return l.value = Array.isArray(w) ? w[0] : w, k(), b.success("上传图片成功"), (n = e.onSuccess) == null || n.call(e, t), !0;
|
|
105
|
-
} catch (c) {
|
|
106
|
-
return (m = e.onError) == null || m.call(e, c), b.error("上传失败"), !1;
|
|
107
|
-
} finally {
|
|
108
|
-
u.value = !1;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
function k() {
|
|
112
|
-
C(
|
|
113
|
-
"change",
|
|
114
|
-
B(o.value || "", l.value || ""),
|
|
115
|
-
l.value || ""
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
return A({
|
|
119
|
-
deleteImage: E,
|
|
120
|
-
// 给表单保存或外部调试读取当前拆分值。
|
|
121
|
-
getValue: () => ({
|
|
122
|
-
text: o.value || "",
|
|
123
|
-
imageUrl: l.value || "",
|
|
124
|
-
value: B(o.value || "", l.value || "")
|
|
125
|
-
})
|
|
126
|
-
}), (e, a) => (v(), p("div", {
|
|
127
|
-
class: "qy-remark-image",
|
|
128
|
-
style: W(D.value)
|
|
129
|
-
}, [
|
|
130
|
-
i("div", ee, [
|
|
131
|
-
g(d(H), $({
|
|
132
|
-
ref_key: "inputRef",
|
|
133
|
-
ref: y,
|
|
134
|
-
"model-value": o.value,
|
|
135
|
-
type: S.value,
|
|
136
|
-
rows: e.rows,
|
|
137
|
-
autosize: e.autosize,
|
|
138
|
-
disabled: e.disabled,
|
|
139
|
-
placeholder: e.placeholder
|
|
140
|
-
}, d(R), {
|
|
141
|
-
"onUpdate:modelValue": N,
|
|
142
|
-
onBlur: k
|
|
143
|
-
}), null, 16, ["model-value", "type", "rows", "autosize", "disabled", "placeholder"]),
|
|
144
|
-
g(d(J), {
|
|
145
|
-
placement: "top-start",
|
|
146
|
-
width: 400,
|
|
147
|
-
trigger: "hover",
|
|
148
|
-
disabled: !l.value
|
|
149
|
-
}, {
|
|
150
|
-
reference: h(() => [
|
|
151
|
-
i("div", ae, [
|
|
152
|
-
g(d(X), {
|
|
153
|
-
disabled: u.value || e.disabled,
|
|
154
|
-
class: "qy-remark-image__upload",
|
|
155
|
-
"show-file-list": !1,
|
|
156
|
-
"http-request": T
|
|
157
|
-
}, {
|
|
158
|
-
default: h(() => [
|
|
159
|
-
u.value ? (v(), p("span", te)) : l.value ? (v(), p("span", le)) : (v(), p("span", re))
|
|
160
|
-
]),
|
|
161
|
-
_: 1
|
|
162
|
-
}, 8, ["disabled"])
|
|
163
|
-
])
|
|
164
|
-
]),
|
|
165
|
-
default: h(() => [
|
|
166
|
-
i("div", oe, [
|
|
167
|
-
i("img", {
|
|
168
|
-
src: l.value,
|
|
169
|
-
class: "qy-remark-image__preview-img"
|
|
170
|
-
}, null, 8, ie),
|
|
171
|
-
i("div", se, [
|
|
172
|
-
a[1] || (a[1] = i("span", { class: "qy-remark-image__popover-tip" }, "再次点击按钮可更换图片", -1)),
|
|
173
|
-
g(d(Q), {
|
|
174
|
-
link: "",
|
|
175
|
-
size: "small",
|
|
176
|
-
type: "danger",
|
|
177
|
-
disabled: e.disabled,
|
|
178
|
-
onClick: E
|
|
179
|
-
}, {
|
|
180
|
-
default: h(() => a[0] || (a[0] = [
|
|
181
|
-
G(" 删除图片 ", -1)
|
|
182
|
-
])),
|
|
183
|
-
_: 1,
|
|
184
|
-
__: [0]
|
|
185
|
-
}, 8, ["disabled"])
|
|
186
|
-
])
|
|
187
|
-
])
|
|
188
|
-
]),
|
|
189
|
-
_: 1
|
|
190
|
-
}, 8, ["disabled"])
|
|
191
|
-
])
|
|
192
|
-
], 4));
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
export {
|
|
196
|
-
fe as default
|
|
197
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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;
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("element-plus/es"),t=require("vue"),H=require("@element-plus/icons-vue"),g=require("element-plus"),ge=require("../utils/auth.cjs");;/* empty css */;/* empty css */const ye=require("../../_virtual/_plugin-vue_export-helper.cjs"),xe={class:"qy-upload__hint"},he=["placeholder","disabled"],Ve=["src"],we={key:1,class:"qy-upload__tip"},be={class:"error"},ke={class:"error"},Be=Object.assign({name:"QyUpload"},{__name:"index",props:{modelValue:{type:[Object,Array,String],default:void 0},defaultValue:{type:Object,default:()=>({files:"",text:""})},valueFormat:{type:String,default:"object"},showText:{type:Boolean,default:!0},showPasteInput:{type:Boolean,default:!1},pastePlaceholder:{type:String,default:"输入文字"},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:["update:modelValue","change","success","error","remove"],setup(d,{expose:W,emit:X}){const o=d,m=X,k=t.ref(null),r=t.ref([]),U=t.ref(null),K=t.ref(null),h=[];let C=!1;const M=t.ref(!1),D=t.ref([]),E=t.ref(0),V=t.ref(!1),L=t.ref(""),R=t.ref(""),B=new Set,N=t.ref(!1),f=t.ref(""),T=t.ref(!1);t.onMounted(()=>{o.modelValue===void 0&&j(o.defaultValue)});const Q=t.computed(()=>({large:"160px",default:"140px",small:"80px"})[o.size]??o.size),J=t.computed(()=>o.disabled),G=t.computed(()=>{var e;return o.isShowTip&&(o.fileSize||((e=v.value)==null?void 0:e.length))}),v=t.computed(()=>{var e;return(e=o.fileType)!=null&&e.length?o.fileType.map(l=>l.toLowerCase()):o.supportVideo?["mp4","mov","avi"]:["jpg","jpeg","png","gif","webp"]}),S=t.computed(()=>{const e=o.supportVideo?1:o.limit;return r.value.length>=e}),Y=t.computed(()=>v.value.map(e=>`.${e}`).join(",")),Z=t.computed(()=>({"qy-upload--reached-limit":S.value,"qy-upload--disabled":o.disabled,"qy-upload--video":o.supportVideo,"qy-upload--without-text":!o.showText&&!o.showPasteInput}));t.watch(f,()=>{C||w()}),t.watch(()=>o.modelValue,e=>{e!==void 0&&j(e)},{immediate:!0,deep:!0});function P(e){return Array.isArray(e)?e.filter(Boolean):e?String(e).split(",").filter(Boolean):[]}function ee(e){return Array.isArray(e)?{files:e,text:""}:typeof e=="string"?{files:P(e),text:""}:e&&typeof e=="object"?{files:P(e.files),text:e.text??""}:{files:[],text:""}}function te(e=[]){return e.map((l,i)=>({name:String(l).split("/").pop()||`file-${i}`,url:l,status:"success",uid:Date.now()+i}))}function le(e){const l=new Set(e.map(a=>a.url)),i=r.value.filter(a=>a.status==="uploading"&&!l.has(a.url));return[...e,...i]}function j(e){const l=ee(e);C=!0,f.value=l.text,r.value=le(te(l.files)),t.nextTick(()=>{C=!1})}function z(e){return o.valueFormat==="array"?e.files:o.valueFormat==="string"?e.files.join(","):e}function ae(){var e;(e=U.value)==null||e.focus()}function oe(e){e.target.value=""}function w(e){const a={files:(e??r.value).filter(n=>n.status==="success"&&n.url).map(n=>n.url),text:f.value};m("update:modelValue",z(a)),m("change",a),o.callBack&&o.callBack(a)}function ie(e,l){w(l),m("remove",e,l)}function ne(e){var a;if(!(e.size/1024/1024<o.fileSize))return g.ElMessage.warning(`文件大小不能超过${o.fileSize}M`),!1;const i=((a=e.name.split(".").pop())==null?void 0:a.toLowerCase())||"";return v.value.includes(i)?!0:(g.ElMessage.warning(`格式不支持,仅允许: ${v.value.join("/")}`),!1)}function I(e,l,i,a){var F,_;const n=o.api.startsWith("http")?o.api:window.location.origin+o.api.replace(/^([^/])/,"/$1"),c=new FormData;c.append(o.name,e),o.extraData&&Object.entries(o.extraData).forEach(([u,ve])=>c.append(u,ve));const s=new XMLHttpRequest;h.push(s);const y=((F=k.value)==null?void 0:F.$el.querySelector(".el-upload--picture-card"))||((_=k.value)==null?void 0:_.$el),q=g.ElLoading.service({target:y,text:"上传中",background:"rgba(255,255,255,0.7)"}),p=()=>{const u=h.indexOf(s);u!==-1&&h.splice(u,1),q.close()};s.open("POST",n);const A=ge.getToken(o.tokenKey);A&&s.setRequestHeader("Authorization",`Bearer ${A}`),s.upload.onprogress=u=>{u.total>0&&(l==null||l({percent:u.loaded/u.total*100}))},s.onload=()=>{if(p(),s.status<200||s.status>=300){const u=`上传失败 (HTTP ${s.status})`;g.ElMessage.error(u),m("error",{msg:u,status:s.status}),a==null||a(new Error(u));return}try{const u=JSON.parse(s.responseText);u.code===200&&u.urls?(g.ElMessage.success("上传成功"),i==null||i({...u,url:u.urls})):(g.ElMessage.error(u.msg||"上传失败"),m("error",u),a==null||a(u))}catch{g.ElMessage.error("上传失败,响应格式错误"),m("error",new Error("Response parse error")),a==null||a(new Error("Response parse error"))}},s.onerror=()=>{p(),g.ElMessage.error("上传失败,网络异常"),m("error",new Error("Network error")),a==null||a(new Error("Network error"))},s.send(c)}function O(e){return o.disabled?!1:ne(e)}function se(e,l){const i=r.value.find(a=>{var n;return a.uid===(e==null?void 0:e.uid)||((n=a.raw)==null?void 0:n.uid)===(e==null?void 0:e.uid)});i&&(i.url=l,i.status="success")}function re(e){I(e.file,e.onProgress,l=>{se(e.file,l.url),e.onSuccess(l),w(),m("success",l)},l=>e.onError(l))}function ue(e){var a;if(!e.url)return;const l=((a=e.url.split(".").pop())==null?void 0:a.toLowerCase())||"";if(["mp4","mov","avi","webm"].includes(l)){L.value=e.url,R.value=e.name||"视频预览",V.value=!0;return}const i=r.value.filter(n=>{var c;return n.status==="success"&&n.url&&!["mp4","mov","avi","webm"].includes((c=n.url.split(".").pop())==null?void 0:c.toLowerCase())});D.value=i.map(n=>n.url),E.value=i.findIndex(n=>n.uid===e.uid)||0,M.value=!0}function de(){M.value=!1,D.value=[]}function $(e){for(let l=0;l<e.length;l++){const i=e[l];if(!O(i))continue;const a=Date.now()+l,n=URL.createObjectURL(i);B.add(n),r.value.push({uid:a,name:i.name||`file-${a}`,status:"uploading",percentage:0,url:n}),I(i,c=>{const s=r.value.find(y=>y.uid===a);s&&(s.percentage=c.percent)},c=>{const s=r.value.find(y=>y.uid===a);s&&(s.status="success",s.url=c.url,w(),m("success",c))},()=>me(a))}}function b(e){var a;if(o.disabled)return;const l=(a=e.clipboardData)==null?void 0:a.items;if(!l)return;const i=[];for(let n=0;n<l.length;n++){const c=l[n];if(c.kind==="file"&&c.type.startsWith("image/")){const s=c.getAsFile();s&&i.push(s)}}i.length&&(e.preventDefault(),$(i))}function ce(){o.disabled||o.disableDrag||(N.value=!0)}function pe(){N.value=!1}function fe(e){var i;if(N.value=!1,o.disabled||o.disableDrag||S.value)return;const l=Array.from(((i=e.dataTransfer)==null?void 0:i.files)||[]).filter(a=>{var n;return v.value.includes((n=a.name.split(".").pop())==null?void 0:n.toLowerCase())});l.length&&$(l)}function me(e){var i;const l=r.value.findIndex(a=>a.uid===e);l!==-1&&((i=r.value[l].url)!=null&&i.startsWith("blob:")&&(URL.revokeObjectURL(r.value[l].url),B.delete(r.value[l].url)),r.value.splice(l,1))}return t.onBeforeUnmount(()=>{h.forEach(e=>e.abort()),h.length=0,B.forEach(e=>URL.revokeObjectURL(e)),B.clear()}),W({openFileDialog:()=>{var e,l;o.disabled||S.value||(l=(e=k.value)==null?void 0:e.$el.querySelector('input[type="file"]'))==null||l.click()},getPathList:()=>r.value.filter(e=>e.status==="success").map(e=>e.url),clearFiles:()=>{r.value=[],f.value="",w()},getValue:()=>({files:r.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:f.value}),getModelValue:()=>z({files:r.value.filter(e=>e.status==="success"&&e.url).map(e=>e.url),text:f.value})}),(e,l)=>{var q;const i=x.ElIcon,a=x.ElInput,n=x.ElPopover,c=x.ElUpload,s=x.ElImageViewer,y=x.ElDialog;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["qy-upload",Z.value]),style:t.normalizeStyle({"--qy-upload-size":Q.value})},[t.createVNode(c,{ref_key:"uploadRef",ref:k,"file-list":r.value,"onUpdate:fileList":l[6]||(l[6]=p=>r.value=p),action:"#",multiple:d.supportVideo?!1:d.multiple,limit:d.supportVideo?1:d.limit,"list-type":d.supportVideo?"text":"picture-card",accept:Y.value,disabled:J.value,"http-request":re,"before-upload":O,"on-preview":ue,"on-remove":ie},{default:t.withCtx(()=>[S.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["qy-upload__trigger",{"is-dragover":N.value}]),onPaste:b,onDragover:t.withModifiers(ce,["prevent"]),onDragleave:t.withModifiers(pe,["prevent"]),onDrop:t.withModifiers(fe,["prevent"])},[t.createVNode(i,{class:"qy-upload__icon"},{default:t.withCtx(()=>[t.createVNode(t.unref(H.Plus))]),_:1}),d.supportVideo?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[l[9]||(l[9]=t.createElementVNode("span",{class:"qy-upload__label"},"点击上传视频",-1)),t.createElementVNode("span",xe,"支持 "+t.toDisplayString(v.value.join(" / "))+",不超过 "+t.toDisplayString(d.fileSize)+"MB",1)],64)):t.createCommentVNode("",!0),d.showText?(t.openBlock(),t.createElementBlock("div",{key:1,class:"qy-upload__text",onClick:l[3]||(l[3]=t.withModifiers(()=>{},["stop"])),onPaste:t.withModifiers(b,["stop"])},[t.createVNode(n,{visible:T.value,"onUpdate:visible":l[2]||(l[2]=p=>T.value=p),placement:"bottom-start",width:220,trigger:"click","popper-class":"qy-upload__text-popover",onAfterEnter:ae},{reference:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["qy-upload__text-preview",{"is-placeholder":!f.value}])},t.toDisplayString(f.value||d.pastePlaceholder),3)]),default:t.withCtx(()=>[t.createVNode(a,{ref_key:"inputRef",ref:U,modelValue:f.value,"onUpdate:modelValue":l[0]||(l[0]=p=>f.value=p),type:"textarea",autosize:{minRows:2,maxRows:5},placeholder:d.pastePlaceholder,disabled:d.disabled,onBlur:l[1]||(l[1]=p=>T.value=!1),onPaste:t.withModifiers(b,["stop"])},null,8,["modelValue","placeholder","disabled"])]),_:1},8,["visible"])],32)):d.showPasteInput?(t.openBlock(),t.createElementBlock("div",{key:2,class:"qy-upload__text",onClick:l[5]||(l[5]=t.withModifiers(()=>{},["stop"])),onPaste:t.withModifiers(b,["stop"])},[t.createElementVNode("input",{ref_key:"pasteInputRef",ref:K,class:"qy-upload__paste-input",placeholder:d.pastePlaceholder,disabled:d.disabled,onPaste:t.withModifiers(b,["stop"]),onInput:oe,onClick:l[4]||(l[4]=t.withModifiers(()=>{},["stop"]))},null,40,he)],32)):t.createCommentVNode("",!0)],34))]),_:1},8,["file-list","multiple","limit","list-type","accept","disabled"]),M.value?(t.openBlock(),t.createBlock(s,{key:0,"url-list":D.value,"initial-index":E.value,onClose:de},null,8,["url-list","initial-index"])):t.createCommentVNode("",!0),t.createVNode(y,{modelValue:V.value,"onUpdate:modelValue":l[7]||(l[7]=p=>V.value=p),title:R.value,width:"640px","append-to-body":"","destroy-on-close":"",onClose:l[8]||(l[8]=p=>V.value=!1)},{default:t.withCtx(()=>[V.value?(t.openBlock(),t.createElementBlock("video",{key:0,src:L.value,controls:"",autoplay:"",style:{width:"100%","max-height":"400px","border-radius":"4px"}},null,8,Ve)):t.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),G.value?(t.openBlock(),t.createElementBlock("div",we,[t.createVNode(i,null,{default:t.withCtx(()=>[t.createVNode(t.unref(H.InfoFilled))]),_:1}),t.createElementVNode("span",null,[l[12]||(l[12]=t.createTextVNode(" 请上传 ",-1)),d.fileSize?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[l[10]||(l[10]=t.createTextVNode("大小不超过 ",-1)),t.createElementVNode("b",be,t.toDisplayString(d.fileSize)+"MB",1)],64)):t.createCommentVNode("",!0),(q=v.value)!=null&&q.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[l[11]||(l[11]=t.createTextVNode(",格式为 ",-1)),t.createElementVNode("b",ke,t.toDisplayString(v.value.join("/")),1)],64)):t.createCommentVNode("",!0),l[13]||(l[13]=t.createTextVNode(" 的文件。 ",-1))])])):t.createCommentVNode("",!0)],6)}}}),Ne=ye.default(Be,[["__scopeId","data-v-1d6de9b6"]]);exports.default=Ne;
|
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;
|