@qynpm/ui 0.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/README.md +183 -8
- 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 -0
- package/dist/index.mjs +17 -0
- package/dist/lib/dialog/index.vue.cjs +1 -0
- package/dist/lib/dialog/index.vue.mjs +326 -0
- 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/lib/qy-action-bar/index.vue.mjs +56 -0
- package/dist/lib/qy-form-section/index.vue.cjs +1 -0
- package/dist/lib/qy-form-section/index.vue.mjs +89 -0
- package/dist/lib/qy-input/index.vue.cjs +1 -0
- package/dist/lib/qy-input/index.vue.mjs +142 -0
- package/dist/lib/qy-record-quote-search/index.vue.cjs +1 -0
- package/dist/lib/qy-record-quote-search/index.vue.mjs +206 -0
- package/dist/lib/qy-search-input/index.vue.cjs +1 -0
- package/dist/lib/qy-search-input/index.vue.mjs +277 -0
- package/dist/lib/qy-select/index.vue.cjs +1 -0
- package/dist/lib/qy-select/index.vue.mjs +137 -0
- 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/lib/upload/index.vue.mjs +382 -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/lib/utils/install.mjs +8 -0
- package/dist/node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.cjs +1 -0
- package/dist/node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.mjs +74 -0
- package/dist/qy-action-bar/index.cjs +1 -0
- package/dist/qy-action-bar/index.mjs +6 -0
- package/dist/qy-dialog/index.cjs +1 -0
- package/dist/qy-dialog/index.mjs +6 -0
- package/dist/qy-form-section/index.cjs +1 -0
- package/dist/qy-form-section/index.mjs +6 -0
- package/dist/qy-input/index.cjs +1 -0
- package/dist/qy-input/index.mjs +6 -0
- package/dist/qy-record-quote-search/index.cjs +1 -0
- package/dist/qy-record-quote-search/index.mjs +6 -0
- package/dist/qy-remark-image/index.cjs +2 -0
- package/dist/qy-remark-image/index.mjs +7 -0
- package/dist/qy-search-input/index.cjs +1 -0
- package/dist/qy-search-input/index.mjs +6 -0
- package/dist/qy-select/index.cjs +1 -0
- package/dist/qy-select/index.mjs +6 -0
- package/dist/qy-upload/index.cjs +1 -0
- package/dist/qy-upload/index.mjs +6 -0
- package/index.d.ts +16 -4
- package/package.json +60 -7
- package/qy-action-bar/index.d.ts +5 -0
- package/qy-action-bar/index.js +4 -0
- package/qy-dialog/index.d.ts +5 -0
- package/qy-dialog/index.js +4 -0
- package/qy-form-section/index.d.ts +5 -0
- package/qy-form-section/index.js +4 -0
- package/qy-input/index.d.ts +5 -0
- package/qy-input/index.js +4 -0
- package/qy-record-quote-search/index.d.ts +5 -0
- package/qy-record-quote-search/index.js +4 -0
- package/qy-remark-image/index.d.ts +5 -0
- package/qy-remark-image/index.js +4 -0
- package/qy-search-input/index.d.ts +5 -0
- package/qy-search-input/index.js +4 -0
- package/qy-select/index.d.ts +5 -0
- package/qy-select/index.js +4 -0
- package/qy-upload/index.d.ts +5 -0
- package/qy-upload/index.js +4 -0
- package/dist/ui.es.js +0 -994
- package/dist/ui.umd.js +0 -2
- package/index.js +0 -9
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { defineComponent as ae, useAttrs as ue, ref as y, computed as b, watch as re, createElementBlock as F, openBlock as V, normalizeClass as se, createVNode as ie, unref as B, mergeProps as M, withKeys as ce, createSlots as de, withCtx as i, renderSlot as d, createElementVNode as E, createCommentVNode as pe, toDisplayString as I, createBlock as fe, createTextVNode as ge } from "vue";
|
|
2
|
+
import { ElAutocomplete as he, ElButton as me } from "element-plus";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import ve from "../../_virtual/plugin-vue_export-helper.mjs";
|
|
5
|
+
const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "qy-search-input__item-description"
|
|
8
|
+
}, Be = ae({
|
|
9
|
+
name: "QySearchInput",
|
|
10
|
+
inheritAttrs: !1,
|
|
11
|
+
__name: "index",
|
|
12
|
+
props: {
|
|
13
|
+
modelValue: { default: "" },
|
|
14
|
+
loading: { type: Boolean, default: !1 },
|
|
15
|
+
disabled: { type: Boolean, default: !1 },
|
|
16
|
+
placeholder: { default: "请输入搜索内容" },
|
|
17
|
+
removeSpace: { type: Boolean, default: !1 },
|
|
18
|
+
trimMode: { default: "none" },
|
|
19
|
+
clearable: { type: Boolean, default: !0 },
|
|
20
|
+
buttonText: { default: "搜索" },
|
|
21
|
+
buttonProps: { default: () => ({}) },
|
|
22
|
+
suggestions: { default: () => [] },
|
|
23
|
+
fetchSuggestions: { type: [Function, null], default: null },
|
|
24
|
+
fetchSuggestionsMethod: { type: [Function, null], default: null },
|
|
25
|
+
debounce: { default: 300 },
|
|
26
|
+
minLength: { default: 1 },
|
|
27
|
+
triggerOnFocus: { type: Boolean, default: !1 },
|
|
28
|
+
searchOnEnter: { type: Boolean, default: !0 },
|
|
29
|
+
searchOnSelect: { type: Boolean, default: !1 },
|
|
30
|
+
highlightKeyword: { type: Boolean, default: !0 },
|
|
31
|
+
teleported: { type: Boolean, default: !0 },
|
|
32
|
+
appendTo: { default: "body" },
|
|
33
|
+
popperClass: { default: "" },
|
|
34
|
+
fitInputWidth: { type: Boolean, default: !0 }
|
|
35
|
+
},
|
|
36
|
+
emits: ["update:modelValue", "search", "clear", "input", "change", "focus", "blur", "enter", "select", "visible-change", "suggestions-change", "error"],
|
|
37
|
+
setup(L, { expose: T, emit: A }) {
|
|
38
|
+
const l = L, o = A, O = ue(), r = y(null), c = y(u(l.modelValue)), f = b(() => u(l.modelValue)), _ = b(
|
|
39
|
+
() => ["qy-search-input__popper", l.popperClass].filter(Boolean).join(" ")
|
|
40
|
+
), z = b(() => u(l.modelValue)), g = y("");
|
|
41
|
+
re(
|
|
42
|
+
() => l.modelValue,
|
|
43
|
+
(e) => {
|
|
44
|
+
c.value = u(e);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
function u(e) {
|
|
48
|
+
return e == null ? "" : String(e);
|
|
49
|
+
}
|
|
50
|
+
function P(e) {
|
|
51
|
+
return l.removeSpace ? e.replace(/\s+/g, "") : e;
|
|
52
|
+
}
|
|
53
|
+
function w(e, t) {
|
|
54
|
+
return l.trimMode !== t ? e : e.trim();
|
|
55
|
+
}
|
|
56
|
+
function h(e) {
|
|
57
|
+
return P(u(e));
|
|
58
|
+
}
|
|
59
|
+
function m(e) {
|
|
60
|
+
c.value = e, o("update:modelValue", e);
|
|
61
|
+
}
|
|
62
|
+
function S(e, t = "") {
|
|
63
|
+
return {
|
|
64
|
+
...e,
|
|
65
|
+
label: e.label || e.value,
|
|
66
|
+
value: e.value || e.label,
|
|
67
|
+
description: e.description || t
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function v(e = []) {
|
|
71
|
+
return e.flatMap((t) => {
|
|
72
|
+
if (Array.isArray(t.items)) {
|
|
73
|
+
const n = t;
|
|
74
|
+
return n.items.map((a) => S(a, n.groupLabel));
|
|
75
|
+
}
|
|
76
|
+
return S(t);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function K(e) {
|
|
80
|
+
const t = e.toLowerCase();
|
|
81
|
+
return (n) => [n.label, n.value, n.description].filter(Boolean).some((a) => String(a).toLowerCase().includes(t));
|
|
82
|
+
}
|
|
83
|
+
function R(e) {
|
|
84
|
+
return e ? e.length >= l.minLength : l.triggerOnFocus;
|
|
85
|
+
}
|
|
86
|
+
function s(e) {
|
|
87
|
+
o("suggestions-change", e), o("visible-change", e.length > 0);
|
|
88
|
+
}
|
|
89
|
+
async function D(e) {
|
|
90
|
+
if (!R(e))
|
|
91
|
+
return s([]), [];
|
|
92
|
+
if (l.fetchSuggestionsMethod) {
|
|
93
|
+
const a = await new Promise((p) => {
|
|
94
|
+
var $;
|
|
95
|
+
($ = l.fetchSuggestionsMethod) == null || $.call(l, e, (oe) => {
|
|
96
|
+
p(v(oe));
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
return s(a), a;
|
|
100
|
+
}
|
|
101
|
+
if (l.fetchSuggestions) {
|
|
102
|
+
const a = await l.fetchSuggestions(e), p = v(Array.isArray(a) ? a : []);
|
|
103
|
+
return s(p), p;
|
|
104
|
+
}
|
|
105
|
+
const t = v(l.suggestions), n = e ? t.filter(K(e)) : t;
|
|
106
|
+
return s(n), n;
|
|
107
|
+
}
|
|
108
|
+
async function H(e, t) {
|
|
109
|
+
g.value = e;
|
|
110
|
+
try {
|
|
111
|
+
const n = await D(e);
|
|
112
|
+
t(n);
|
|
113
|
+
} catch (n) {
|
|
114
|
+
o("error", n), s([]), t([]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function N() {
|
|
118
|
+
var e, t;
|
|
119
|
+
g.value && ((t = (e = r.value) == null ? void 0 : e.getData) == null || t.call(e, g.value));
|
|
120
|
+
}
|
|
121
|
+
function Q(e) {
|
|
122
|
+
const t = h(e);
|
|
123
|
+
m(t);
|
|
124
|
+
}
|
|
125
|
+
function q(e) {
|
|
126
|
+
const t = h(e);
|
|
127
|
+
c.value = t, o("input", t);
|
|
128
|
+
}
|
|
129
|
+
function U(e) {
|
|
130
|
+
const t = w(h(e), "change");
|
|
131
|
+
t !== u(l.modelValue) && m(t), o("change", t);
|
|
132
|
+
}
|
|
133
|
+
function W(e) {
|
|
134
|
+
o("focus", e);
|
|
135
|
+
}
|
|
136
|
+
function j(e) {
|
|
137
|
+
const t = w(c.value, "blur");
|
|
138
|
+
t !== u(l.modelValue) && m(t), o("blur", e), o("visible-change", !1);
|
|
139
|
+
}
|
|
140
|
+
function x() {
|
|
141
|
+
c.value = "", o("update:modelValue", ""), o("clear"), s([]);
|
|
142
|
+
}
|
|
143
|
+
function G(e) {
|
|
144
|
+
o("enter", e), l.searchOnEnter && k();
|
|
145
|
+
}
|
|
146
|
+
function k() {
|
|
147
|
+
o("search", u(l.modelValue));
|
|
148
|
+
}
|
|
149
|
+
function J(e) {
|
|
150
|
+
o("select", e), l.searchOnSelect && o("search", e.value);
|
|
151
|
+
}
|
|
152
|
+
function C(e) {
|
|
153
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
154
|
+
}
|
|
155
|
+
function X(e) {
|
|
156
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
157
|
+
}
|
|
158
|
+
function Y(e) {
|
|
159
|
+
const t = C(e || "");
|
|
160
|
+
if (!l.highlightKeyword || !f.value) return t;
|
|
161
|
+
const n = X(C(f.value));
|
|
162
|
+
return n ? t.replace(
|
|
163
|
+
new RegExp(`(${n})`, "ig"),
|
|
164
|
+
'<mark class="qy-search-input__mark">$1</mark>'
|
|
165
|
+
) : t;
|
|
166
|
+
}
|
|
167
|
+
function Z() {
|
|
168
|
+
var e, t;
|
|
169
|
+
(t = (e = r.value) == null ? void 0 : e.focus) == null || t.call(e);
|
|
170
|
+
}
|
|
171
|
+
function ee() {
|
|
172
|
+
var e, t;
|
|
173
|
+
(t = (e = r.value) == null ? void 0 : e.blur) == null || t.call(e);
|
|
174
|
+
}
|
|
175
|
+
function te() {
|
|
176
|
+
var e, t, n;
|
|
177
|
+
(n = (t = (e = r.value) == null ? void 0 : e.inputRef) == null ? void 0 : t.select) == null || n.call(t);
|
|
178
|
+
}
|
|
179
|
+
function ne() {
|
|
180
|
+
var e, t;
|
|
181
|
+
(t = (e = r.value) == null ? void 0 : e.clear) == null || t.call(e);
|
|
182
|
+
}
|
|
183
|
+
function le() {
|
|
184
|
+
var e, t;
|
|
185
|
+
(t = (e = r.value) == null ? void 0 : e.close) == null || t.call(e);
|
|
186
|
+
}
|
|
187
|
+
return T({
|
|
188
|
+
focus: Z,
|
|
189
|
+
blur: ee,
|
|
190
|
+
select: te,
|
|
191
|
+
clear: ne,
|
|
192
|
+
closePanel: le,
|
|
193
|
+
retryFetch: N
|
|
194
|
+
}), (e, t) => (V(), F("div", {
|
|
195
|
+
class: se(["qy-search-input", { "is-disabled": e.disabled }])
|
|
196
|
+
}, [
|
|
197
|
+
ie(B(he), M({
|
|
198
|
+
ref_key: "autocompleteRef",
|
|
199
|
+
ref: r
|
|
200
|
+
}, B(O), {
|
|
201
|
+
"model-value": z.value,
|
|
202
|
+
disabled: e.disabled,
|
|
203
|
+
placeholder: e.placeholder,
|
|
204
|
+
clearable: e.clearable,
|
|
205
|
+
debounce: e.debounce,
|
|
206
|
+
"fetch-suggestions": H,
|
|
207
|
+
"trigger-on-focus": e.triggerOnFocus,
|
|
208
|
+
teleported: e.teleported,
|
|
209
|
+
"fit-input-width": e.fitInputWidth,
|
|
210
|
+
"popper-class": _.value,
|
|
211
|
+
"append-to": e.appendTo,
|
|
212
|
+
"value-key": "value",
|
|
213
|
+
"onUpdate:modelValue": Q,
|
|
214
|
+
onInput: q,
|
|
215
|
+
onChange: U,
|
|
216
|
+
onFocus: W,
|
|
217
|
+
onBlur: j,
|
|
218
|
+
onClear: x,
|
|
219
|
+
onSelect: J,
|
|
220
|
+
onKeydown: ce(G, ["enter"])
|
|
221
|
+
}), de({
|
|
222
|
+
append: i(() => [
|
|
223
|
+
e.$slots.append ? d(e.$slots, "append", { key: 0 }, void 0, !0) : (V(), fe(B(me), M({ key: 1 }, e.buttonProps, {
|
|
224
|
+
loading: e.loading,
|
|
225
|
+
disabled: e.disabled,
|
|
226
|
+
onClick: k
|
|
227
|
+
}), {
|
|
228
|
+
default: i(() => [
|
|
229
|
+
ge(I(e.buttonText), 1)
|
|
230
|
+
]),
|
|
231
|
+
_: 1
|
|
232
|
+
}, 16, ["loading", "disabled"]))
|
|
233
|
+
]),
|
|
234
|
+
default: i(({ item: n }) => [
|
|
235
|
+
d(e.$slots, "item", {
|
|
236
|
+
item: n,
|
|
237
|
+
keyword: f.value
|
|
238
|
+
}, () => [
|
|
239
|
+
E("div", ye, [
|
|
240
|
+
E("div", {
|
|
241
|
+
class: "qy-search-input__item-label",
|
|
242
|
+
innerHTML: Y(n.label || n.value || "")
|
|
243
|
+
}, null, 8, be),
|
|
244
|
+
n.description ? (V(), F("div", Ve, I(n.description), 1)) : pe("", !0)
|
|
245
|
+
])
|
|
246
|
+
], !0)
|
|
247
|
+
]),
|
|
248
|
+
_: 2
|
|
249
|
+
}, [
|
|
250
|
+
e.$slots.prefix ? {
|
|
251
|
+
name: "prefix",
|
|
252
|
+
fn: i(() => [
|
|
253
|
+
d(e.$slots, "prefix", {}, void 0, !0)
|
|
254
|
+
]),
|
|
255
|
+
key: "0"
|
|
256
|
+
} : void 0,
|
|
257
|
+
e.$slots.suffix ? {
|
|
258
|
+
name: "suffix",
|
|
259
|
+
fn: i(() => [
|
|
260
|
+
d(e.$slots, "suffix", {}, void 0, !0)
|
|
261
|
+
]),
|
|
262
|
+
key: "1"
|
|
263
|
+
} : void 0,
|
|
264
|
+
e.$slots.prepend ? {
|
|
265
|
+
name: "prepend",
|
|
266
|
+
fn: i(() => [
|
|
267
|
+
d(e.$slots, "prepend", {}, void 0, !0)
|
|
268
|
+
]),
|
|
269
|
+
key: "2"
|
|
270
|
+
} : void 0
|
|
271
|
+
]), 1040, ["model-value", "disabled", "placeholder", "clearable", "debounce", "trigger-on-focus", "teleported", "fit-input-width", "popper-class", "append-to"])
|
|
272
|
+
], 2));
|
|
273
|
+
}
|
|
274
|
+
}), $e = /* @__PURE__ */ ve(Be, [["__scopeId", "data-v-47c6430a"]]);
|
|
275
|
+
export {
|
|
276
|
+
$e as default
|
|
277
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),r=require("element-plus"),$=l.defineComponent({name:"QySelect",inheritAttrs:!1,__name:"index",props:{modelValue:{type:[String,Number,Boolean,Array,null],default:void 0},options:{default:()=>[]},labelKey:{default:"label"},valueKey:{default:"value"},disabledKey:{default:"disabled"},placeholder:{default:"请选择"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},filterable:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},collapseTags:{type:Boolean,default:!1},collapseTagsTooltip:{type:Boolean,default:!1},size:{default:"small"},teleported:{type:Boolean,default:!0},appendTo:{default:"body"},fitInputWidth:{type:Boolean,default:!0},popperClass:{default:""}},emits:["update:modelValue","change","clear","visible-change","focus","blur"],setup(n,{expose:o,emit:f}){const u=n,t=f,i=l.useAttrs(),d=l.ref(null),p=l.computed(()=>["qy-select__popper",u.popperClass].filter(Boolean).join(" ")),c=l.computed(()=>(u.options||[]).map(e=>({raw:e,label:(e==null?void 0:e[u.labelKey])??(e==null?void 0:e.label)??(e==null?void 0:e.value)??"",value:(e==null?void 0:e[u.valueKey])??(e==null?void 0:e.value)??(e==null?void 0:e.label),disabled:!!(e!=null&&e[u.disabledKey])})));function b(e,a){return`${String(e.value??e.label??"")}-${a}`}function m(e){t("update:modelValue",e)}function y(e){t("change",e)}function g(){t("clear")}function h(e){t("visible-change",e)}function v(e){t("focus",e)}function B(e){t("blur",e)}function C(){var e,a;(a=(e=d.value)==null?void 0:e.focus)==null||a.call(e)}function k(){var e,a;(a=(e=d.value)==null?void 0:e.blur)==null||a.call(e)}return o({focus:C,blur:k}),(e,a)=>(l.openBlock(),l.createBlock(l.unref(r.ElSelect),l.mergeProps({ref_key:"selectRef",ref:d},l.unref(i),{"model-value":e.modelValue,placeholder:e.placeholder,disabled:e.disabled,clearable:e.clearable,filterable:e.filterable,multiple:e.multiple,"collapse-tags":e.collapseTags,"collapse-tags-tooltip":e.collapseTagsTooltip,size:e.size,teleported:e.teleported,"fit-input-width":e.fitInputWidth,"popper-class":p.value,"append-to":e.appendTo,"onUpdate:modelValue":m,onChange:y,onClear:g,onVisibleChange:h,onFocus:v,onBlur:B}),l.createSlots({default:l.withCtx(()=>[e.$slots.default?l.renderSlot(e.$slots,"default",{key:0}):(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:1},l.renderList(c.value,(s,S)=>(l.openBlock(),l.createBlock(l.unref(r.ElOption),{key:b(s,S),label:s.label,value:s.value,disabled:s.disabled},null,8,["label","value","disabled"]))),128))]),_:2},[e.$slots.prefix?{name:"prefix",fn:l.withCtx(()=>[l.renderSlot(e.$slots,"prefix")]),key:"0"}:void 0,e.$slots.empty?{name:"empty",fn:l.withCtx(()=>[l.renderSlot(e.$slots,"empty")]),key:"1"}:void 0,e.$slots.loading?{name:"loading",fn:l.withCtx(()=>[l.renderSlot(e.$slots,"loading")]),key:"2"}:void 0,e.$slots.tag?{name:"tag",fn:l.withCtx(s=>[l.renderSlot(e.$slots,"tag",l.normalizeProps(l.guardReactiveProps(s)))]),key:"3"}:void 0]),1040,["model-value","placeholder","disabled","clearable","filterable","multiple","collapse-tags","collapse-tags-tooltip","size","teleported","fit-input-width","popper-class","append-to"]))}});exports.default=$;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { defineComponent as S, useAttrs as w, ref as E, computed as o, createBlock as p, openBlock as n, unref as f, mergeProps as F, createSlots as P, withCtx as d, renderSlot as u, createElementBlock as A, Fragment as O, renderList as R, normalizeProps as I, guardReactiveProps as U } from "vue";
|
|
2
|
+
import { ElSelect as W, ElOption as j } from "element-plus";
|
|
3
|
+
const M = S({
|
|
4
|
+
name: "QySelect",
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "index",
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: { type: [String, Number, Boolean, Array, null], default: void 0 },
|
|
9
|
+
options: { default: () => [] },
|
|
10
|
+
labelKey: { default: "label" },
|
|
11
|
+
valueKey: { default: "value" },
|
|
12
|
+
disabledKey: { default: "disabled" },
|
|
13
|
+
placeholder: { default: "请选择" },
|
|
14
|
+
disabled: { type: Boolean, default: !1 },
|
|
15
|
+
clearable: { type: Boolean, default: !0 },
|
|
16
|
+
filterable: { type: Boolean, default: !1 },
|
|
17
|
+
multiple: { type: Boolean, default: !1 },
|
|
18
|
+
collapseTags: { type: Boolean, default: !1 },
|
|
19
|
+
collapseTagsTooltip: { type: Boolean, default: !1 },
|
|
20
|
+
size: { default: "small" },
|
|
21
|
+
teleported: { type: Boolean, default: !0 },
|
|
22
|
+
appendTo: { default: "body" },
|
|
23
|
+
fitInputWidth: { type: Boolean, default: !0 },
|
|
24
|
+
popperClass: { default: "" }
|
|
25
|
+
},
|
|
26
|
+
emits: ["update:modelValue", "change", "clear", "visible-change", "focus", "blur"],
|
|
27
|
+
setup(i, { expose: c, emit: b }) {
|
|
28
|
+
const t = i, a = b, m = w(), r = E(null), y = o(
|
|
29
|
+
() => ["qy-select__popper", t.popperClass].filter(Boolean).join(" ")
|
|
30
|
+
), g = o(
|
|
31
|
+
() => (t.options || []).map((e) => ({
|
|
32
|
+
raw: e,
|
|
33
|
+
label: (e == null ? void 0 : e[t.labelKey]) ?? (e == null ? void 0 : e.label) ?? (e == null ? void 0 : e.value) ?? "",
|
|
34
|
+
value: (e == null ? void 0 : e[t.valueKey]) ?? (e == null ? void 0 : e.value) ?? (e == null ? void 0 : e.label),
|
|
35
|
+
disabled: !!(e != null && e[t.disabledKey])
|
|
36
|
+
}))
|
|
37
|
+
);
|
|
38
|
+
function h(e, l) {
|
|
39
|
+
return `${String(e.value ?? e.label ?? "")}-${l}`;
|
|
40
|
+
}
|
|
41
|
+
function v(e) {
|
|
42
|
+
a("update:modelValue", e);
|
|
43
|
+
}
|
|
44
|
+
function B(e) {
|
|
45
|
+
a("change", e);
|
|
46
|
+
}
|
|
47
|
+
function $() {
|
|
48
|
+
a("clear");
|
|
49
|
+
}
|
|
50
|
+
function k(e) {
|
|
51
|
+
a("visible-change", e);
|
|
52
|
+
}
|
|
53
|
+
function C(e) {
|
|
54
|
+
a("focus", e);
|
|
55
|
+
}
|
|
56
|
+
function T(e) {
|
|
57
|
+
a("blur", e);
|
|
58
|
+
}
|
|
59
|
+
function V() {
|
|
60
|
+
var e, l;
|
|
61
|
+
(l = (e = r.value) == null ? void 0 : e.focus) == null || l.call(e);
|
|
62
|
+
}
|
|
63
|
+
function K() {
|
|
64
|
+
var e, l;
|
|
65
|
+
(l = (e = r.value) == null ? void 0 : e.blur) == null || l.call(e);
|
|
66
|
+
}
|
|
67
|
+
return c({
|
|
68
|
+
focus: V,
|
|
69
|
+
blur: K
|
|
70
|
+
}), (e, l) => (n(), p(f(W), F({
|
|
71
|
+
ref_key: "selectRef",
|
|
72
|
+
ref: r
|
|
73
|
+
}, f(m), {
|
|
74
|
+
"model-value": e.modelValue,
|
|
75
|
+
placeholder: e.placeholder,
|
|
76
|
+
disabled: e.disabled,
|
|
77
|
+
clearable: e.clearable,
|
|
78
|
+
filterable: e.filterable,
|
|
79
|
+
multiple: e.multiple,
|
|
80
|
+
"collapse-tags": e.collapseTags,
|
|
81
|
+
"collapse-tags-tooltip": e.collapseTagsTooltip,
|
|
82
|
+
size: e.size,
|
|
83
|
+
teleported: e.teleported,
|
|
84
|
+
"fit-input-width": e.fitInputWidth,
|
|
85
|
+
"popper-class": y.value,
|
|
86
|
+
"append-to": e.appendTo,
|
|
87
|
+
"onUpdate:modelValue": v,
|
|
88
|
+
onChange: B,
|
|
89
|
+
onClear: $,
|
|
90
|
+
onVisibleChange: k,
|
|
91
|
+
onFocus: C,
|
|
92
|
+
onBlur: T
|
|
93
|
+
}), P({
|
|
94
|
+
default: d(() => [
|
|
95
|
+
e.$slots.default ? u(e.$slots, "default", { key: 0 }) : (n(!0), A(O, { key: 1 }, R(g.value, (s, z) => (n(), p(f(j), {
|
|
96
|
+
key: h(s, z),
|
|
97
|
+
label: s.label,
|
|
98
|
+
value: s.value,
|
|
99
|
+
disabled: s.disabled
|
|
100
|
+
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
101
|
+
]),
|
|
102
|
+
_: 2
|
|
103
|
+
}, [
|
|
104
|
+
e.$slots.prefix ? {
|
|
105
|
+
name: "prefix",
|
|
106
|
+
fn: d(() => [
|
|
107
|
+
u(e.$slots, "prefix")
|
|
108
|
+
]),
|
|
109
|
+
key: "0"
|
|
110
|
+
} : void 0,
|
|
111
|
+
e.$slots.empty ? {
|
|
112
|
+
name: "empty",
|
|
113
|
+
fn: d(() => [
|
|
114
|
+
u(e.$slots, "empty")
|
|
115
|
+
]),
|
|
116
|
+
key: "1"
|
|
117
|
+
} : void 0,
|
|
118
|
+
e.$slots.loading ? {
|
|
119
|
+
name: "loading",
|
|
120
|
+
fn: d(() => [
|
|
121
|
+
u(e.$slots, "loading")
|
|
122
|
+
]),
|
|
123
|
+
key: "2"
|
|
124
|
+
} : void 0,
|
|
125
|
+
e.$slots.tag ? {
|
|
126
|
+
name: "tag",
|
|
127
|
+
fn: d((s) => [
|
|
128
|
+
u(e.$slots, "tag", I(U(s)))
|
|
129
|
+
]),
|
|
130
|
+
key: "3"
|
|
131
|
+
} : void 0
|
|
132
|
+
]), 1040, ["model-value", "placeholder", "disabled", "clearable", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "size", "teleported", "fit-input-width", "popper-class", "append-to"]));
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
export {
|
|
136
|
+
M as default
|
|
137
|
+
};
|
|
@@ -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
|
+
};
|