@qynpm/ui 1.0.2 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +228 -59
- package/dist/_virtual/_plugin-vue_export-helper.cjs +1 -0
- package/dist/_virtual/_plugin-vue_export-helper.mjs +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +21 -0
- package/dist/lib/dialog/index.vue.cjs +1 -0
- package/dist/{index-CibtL3Up.mjs → lib/dialog/index.vue.mjs} +12 -12
- package/dist/lib/dialog/index.vue3.cjs +1 -0
- package/dist/lib/dialog/index.vue3.mjs +5 -0
- package/dist/lib/index.cjs +1 -0
- package/dist/lib/index.mjs +53 -0
- package/dist/lib/qy-action-bar/index.vue.cjs +1 -0
- package/dist/lib/qy-action-bar/index.vue.mjs +7 -0
- package/dist/lib/qy-action-bar/index.vue2.cjs +1 -0
- package/dist/{index-DlwgfuD9.mjs → lib/qy-action-bar/index.vue2.mjs} +12 -12
- package/dist/lib/qy-form-section/index.vue.cjs +1 -0
- package/dist/lib/qy-form-section/index.vue.mjs +7 -0
- package/dist/lib/qy-form-section/index.vue2.cjs +1 -0
- package/dist/{index-Cuwe7RLf.mjs → lib/qy-form-section/index.vue2.mjs} +19 -20
- package/dist/lib/qy-input/index.vue.cjs +1 -0
- package/dist/{index-CEg8yYrg.mjs → lib/qy-input/index.vue.mjs} +8 -7
- package/dist/lib/qy-input/index.vue2.cjs +1 -0
- package/dist/lib/qy-input/index.vue2.mjs +4 -0
- package/dist/lib/qy-money-input/index.vue.cjs +1 -0
- package/dist/lib/qy-money-input/index.vue.mjs +171 -0
- package/dist/lib/qy-money-input/index.vue2.cjs +1 -0
- package/dist/lib/qy-money-input/index.vue2.mjs +4 -0
- package/dist/lib/qy-radio-group/index.vue.cjs +1 -0
- package/dist/lib/qy-radio-group/index.vue.mjs +90 -0
- package/dist/lib/qy-radio-group/index.vue2.cjs +1 -0
- package/dist/lib/qy-radio-group/index.vue2.mjs +4 -0
- package/dist/lib/qy-record-quote-search/index.vue.cjs +1 -0
- package/dist/lib/qy-record-quote-search/index.vue.mjs +7 -0
- package/dist/lib/qy-record-quote-search/index.vue2.cjs +1 -0
- package/dist/{index-BzzxlJ2O.mjs → lib/qy-record-quote-search/index.vue2.mjs} +68 -69
- package/dist/lib/qy-remote-select/index.vue.cjs +1 -0
- package/dist/lib/qy-remote-select/index.vue.mjs +214 -0
- package/dist/lib/qy-remote-select/index.vue2.cjs +1 -0
- package/dist/lib/qy-remote-select/index.vue2.mjs +4 -0
- package/dist/lib/qy-search-input/index.vue.cjs +1 -0
- package/dist/lib/qy-search-input/index.vue.mjs +7 -0
- package/dist/lib/qy-search-input/index.vue2.cjs +1 -0
- package/dist/{index-C02naY8D.mjs → lib/qy-search-input/index.vue2.mjs} +77 -77
- package/dist/lib/qy-select/index.vue.cjs +1 -0
- package/dist/lib/qy-select/index.vue.mjs +162 -0
- package/dist/lib/qy-select/index.vue2.cjs +1 -0
- package/dist/lib/qy-select/index.vue2.mjs +4 -0
- package/dist/lib/qy-voucher-upload/index.vue.cjs +1 -0
- package/dist/lib/qy-voucher-upload/index.vue.mjs +123 -0
- package/dist/lib/remark-image/index.vue.cjs +1 -0
- package/dist/lib/remark-image/index.vue.mjs +7 -0
- package/dist/lib/remark-image/index.vue2.cjs +1 -0
- package/dist/lib/remark-image/index.vue2.mjs +197 -0
- package/dist/lib/remark-image/utils.cjs +1 -0
- package/dist/lib/remark-image/utils.mjs +22 -0
- package/dist/lib/upload/index.vue.cjs +1 -0
- package/dist/lib/upload/index.vue.mjs +482 -0
- package/dist/lib/utils/auth.cjs +1 -0
- package/dist/lib/utils/auth.mjs +8 -0
- package/dist/lib/utils/install.cjs +1 -0
- package/dist/{install-CxBnxbuN.mjs → lib/utils/install.mjs} +2 -2
- package/dist/node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.cjs +1 -0
- package/dist/{js.cookie-tagl12-O.mjs → node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs} +6 -6
- package/dist/qy-action-bar/index.cjs +1 -1
- package/dist/qy-action-bar/index.mjs +6 -0
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +7 -0
- package/dist/qy-form-section/index.cjs +1 -1
- package/dist/qy-form-section/index.mjs +6 -0
- package/dist/qy-input/index.cjs +1 -1
- package/dist/qy-input/index.mjs +6 -0
- package/dist/qy-money-input/index.cjs +1 -0
- package/dist/qy-money-input/index.mjs +6 -0
- package/dist/qy-radio-group/index.cjs +1 -0
- package/dist/qy-radio-group/index.mjs +6 -0
- package/dist/qy-record-quote-search/index.cjs +1 -1
- package/dist/qy-record-quote-search/index.mjs +6 -0
- package/dist/qy-remark-image/index.cjs +2 -2
- package/dist/qy-remark-image/index.mjs +7 -0
- package/dist/qy-remote-select/index.cjs +1 -0
- package/dist/qy-remote-select/index.mjs +6 -0
- package/dist/qy-search-input/index.cjs +1 -1
- package/dist/qy-search-input/index.mjs +6 -0
- package/dist/qy-select/index.cjs +1 -1
- package/dist/qy-select/index.mjs +6 -0
- package/dist/qy-upload/index.cjs +1 -1
- package/dist/qy-upload/index.mjs +6 -0
- package/dist/qy-voucher-upload/index.cjs +1 -0
- package/dist/qy-voucher-upload/index.mjs +6 -0
- package/index.d.ts +20 -11
- package/package.json +36 -12
- package/qy-money-input/index.d.ts +12 -0
- package/qy-money-input/index.js +15 -0
- package/qy-radio-group/index.d.ts +12 -0
- package/qy-radio-group/index.js +15 -0
- package/qy-remote-select/index.d.ts +12 -0
- package/qy-remote-select/index.js +15 -0
- package/qy-voucher-upload/index.d.ts +12 -0
- package/qy-voucher-upload/index.js +15 -0
- package/dist/index-1ocyh-Ge.js +0 -1
- package/dist/index-BYAIkGVF.js +0 -1
- package/dist/index-BaU5rDMh.js +0 -1
- package/dist/index-BddPsC3s.mjs +0 -384
- package/dist/index-CzJWU89H.js +0 -1
- package/dist/index-DQ-EEZgS.js +0 -1
- package/dist/index-Dg93AsO_.mjs +0 -216
- package/dist/index-Djj-T8oy.mjs +0 -137
- package/dist/index-Do5SZ8yS.js +0 -1
- package/dist/index-DooOsQ9d.js +0 -1
- package/dist/index-DzX3lxdp.js +0 -1
- package/dist/index-tC70xKe_.js +0 -1
- package/dist/install-c8il9DQv.js +0 -1
- package/dist/js.cookie-XvHV2tha.js +0 -1
- package/dist/plugin-vue_export-helper-BHFhmbuH.js +0 -1
- package/dist/plugin-vue_export-helper-CHgC5LLL.mjs +0 -9
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { defineComponent as ae, useAttrs as
|
|
1
|
+
import { defineComponent as ae, useAttrs as re, ref as y, computed as b, watch as ue, createElementBlock as M, openBlock as V, normalizeClass as se, createVNode as ie, unref as w, mergeProps as E, withKeys as ce, createSlots as de, withCtx as i, renderSlot as d, createElementVNode as F, createCommentVNode as fe, toDisplayString as L, createBlock as pe, createTextVNode as ge } from "vue";
|
|
2
2
|
import { ElAutocomplete as he, ElButton as me } from "element-plus";
|
|
3
|
-
|
|
4
|
-
const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
3
|
+
const ve = { class: "qy-search-input__item" }, ye = ["innerHTML"], be = {
|
|
5
4
|
key: 0,
|
|
6
5
|
class: "qy-search-input__item-description"
|
|
7
|
-
},
|
|
6
|
+
}, ke = /* @__PURE__ */ ae({
|
|
8
7
|
name: "QySearchInput",
|
|
9
8
|
inheritAttrs: !1,
|
|
10
9
|
__name: "index",
|
|
@@ -33,32 +32,32 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
33
32
|
fitInputWidth: { type: Boolean, default: !0 }
|
|
34
33
|
},
|
|
35
34
|
emits: ["update:modelValue", "search", "clear", "input", "change", "focus", "blur", "enter", "select", "visible-change", "suggestions-change", "error"],
|
|
36
|
-
setup(
|
|
37
|
-
const l =
|
|
35
|
+
setup(T, { expose: A, emit: I }) {
|
|
36
|
+
const l = T, o = I, O = re(), u = y(null), c = y(r(l.modelValue)), p = b(() => r(l.modelValue)), z = b(
|
|
38
37
|
() => ["qy-search-input__popper", l.popperClass].filter(Boolean).join(" ")
|
|
39
|
-
),
|
|
40
|
-
|
|
38
|
+
), P = b(() => r(l.modelValue)), g = y("");
|
|
39
|
+
ue(
|
|
41
40
|
() => l.modelValue,
|
|
42
41
|
(e) => {
|
|
43
|
-
c.value =
|
|
42
|
+
c.value = r(e);
|
|
44
43
|
}
|
|
45
44
|
);
|
|
46
|
-
function
|
|
45
|
+
function r(e) {
|
|
47
46
|
return e == null ? "" : String(e);
|
|
48
47
|
}
|
|
49
|
-
function
|
|
48
|
+
function K(e) {
|
|
50
49
|
return l.removeSpace ? e.replace(/\s+/g, "") : e;
|
|
51
50
|
}
|
|
52
|
-
function
|
|
51
|
+
function k(e, t) {
|
|
53
52
|
return l.trimMode !== t ? e : e.trim();
|
|
54
53
|
}
|
|
55
54
|
function h(e) {
|
|
56
|
-
return
|
|
55
|
+
return K(r(e));
|
|
57
56
|
}
|
|
58
57
|
function m(e) {
|
|
59
58
|
c.value = e, o("update:modelValue", e);
|
|
60
59
|
}
|
|
61
|
-
function
|
|
60
|
+
function B(e, t = "") {
|
|
62
61
|
return {
|
|
63
62
|
...e,
|
|
64
63
|
label: e.label || e.value,
|
|
@@ -70,162 +69,163 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
70
69
|
return e.flatMap((t) => {
|
|
71
70
|
if (Array.isArray(t.items)) {
|
|
72
71
|
const n = t;
|
|
73
|
-
return n.items.map((a) =>
|
|
72
|
+
return n.items.map((a) => B(a, n.groupLabel));
|
|
74
73
|
}
|
|
75
|
-
return
|
|
74
|
+
return B(t);
|
|
76
75
|
});
|
|
77
76
|
}
|
|
78
|
-
function
|
|
77
|
+
function R(e) {
|
|
79
78
|
const t = e.toLowerCase();
|
|
80
79
|
return (n) => [n.label, n.value, n.description].filter(Boolean).some((a) => String(a).toLowerCase().includes(t));
|
|
81
80
|
}
|
|
82
|
-
function
|
|
81
|
+
function H(e) {
|
|
83
82
|
return e ? e.length >= l.minLength : l.triggerOnFocus;
|
|
84
83
|
}
|
|
85
84
|
function s(e) {
|
|
86
85
|
o("suggestions-change", e), o("visible-change", e.length > 0);
|
|
87
86
|
}
|
|
88
|
-
async function
|
|
89
|
-
if (!
|
|
87
|
+
async function N(e) {
|
|
88
|
+
if (!H(e))
|
|
90
89
|
return s([]), [];
|
|
91
90
|
if (l.fetchSuggestionsMethod) {
|
|
92
|
-
const a = await new Promise((
|
|
91
|
+
const a = await new Promise((f) => {
|
|
93
92
|
var $;
|
|
94
93
|
($ = l.fetchSuggestionsMethod) == null || $.call(l, e, (oe) => {
|
|
95
|
-
|
|
94
|
+
f(v(oe));
|
|
96
95
|
});
|
|
97
96
|
});
|
|
98
97
|
return s(a), a;
|
|
99
98
|
}
|
|
100
99
|
if (l.fetchSuggestions) {
|
|
101
|
-
const a = await l.fetchSuggestions(e),
|
|
102
|
-
return s(
|
|
100
|
+
const a = await l.fetchSuggestions(e), f = v(Array.isArray(a) ? a : []);
|
|
101
|
+
return s(f), f;
|
|
103
102
|
}
|
|
104
|
-
const t = v(l.suggestions), n = e ? t.filter(
|
|
103
|
+
const t = v(l.suggestions), n = e ? t.filter(R(e)) : t;
|
|
105
104
|
return s(n), n;
|
|
106
105
|
}
|
|
107
|
-
async function
|
|
106
|
+
async function Q(e, t) {
|
|
108
107
|
g.value = e;
|
|
109
108
|
try {
|
|
110
|
-
const n = await
|
|
109
|
+
const n = await N(e);
|
|
111
110
|
t(n);
|
|
112
111
|
} catch (n) {
|
|
113
112
|
o("error", n), s([]), t([]);
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
|
-
function
|
|
115
|
+
function _() {
|
|
117
116
|
var e, t;
|
|
118
|
-
g.value && ((t = (e =
|
|
117
|
+
g.value && ((t = (e = u.value) == null ? void 0 : e.getData) == null || t.call(e, g.value));
|
|
119
118
|
}
|
|
120
|
-
function
|
|
119
|
+
function q(e) {
|
|
121
120
|
const t = h(e);
|
|
122
121
|
m(t);
|
|
123
122
|
}
|
|
124
|
-
function
|
|
123
|
+
function D(e) {
|
|
125
124
|
const t = h(e);
|
|
126
125
|
c.value = t, o("input", t);
|
|
127
126
|
}
|
|
128
127
|
function U(e) {
|
|
129
|
-
const t =
|
|
130
|
-
t !==
|
|
128
|
+
const t = k(h(e), "change");
|
|
129
|
+
t !== r(l.modelValue) && m(t), o("change", t);
|
|
131
130
|
}
|
|
132
131
|
function W(e) {
|
|
133
132
|
o("focus", e);
|
|
134
133
|
}
|
|
135
134
|
function j(e) {
|
|
136
|
-
const t =
|
|
137
|
-
t !==
|
|
135
|
+
const t = k(c.value, "blur");
|
|
136
|
+
t !== r(l.modelValue) && m(t), o("blur", e), o("visible-change", !1);
|
|
138
137
|
}
|
|
139
|
-
function
|
|
138
|
+
function G() {
|
|
140
139
|
c.value = "", o("update:modelValue", ""), o("clear"), s([]);
|
|
141
140
|
}
|
|
142
|
-
function
|
|
143
|
-
o("enter", e), l.searchOnEnter &&
|
|
141
|
+
function J(e) {
|
|
142
|
+
o("enter", e), l.searchOnEnter && S();
|
|
144
143
|
}
|
|
145
|
-
function
|
|
146
|
-
o("search",
|
|
144
|
+
function S() {
|
|
145
|
+
o("search", r(l.modelValue));
|
|
147
146
|
}
|
|
148
|
-
function
|
|
147
|
+
function X(e) {
|
|
149
148
|
o("select", e), l.searchOnSelect && o("search", e.value);
|
|
150
149
|
}
|
|
151
150
|
function C(e) {
|
|
152
151
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
153
152
|
}
|
|
154
|
-
function
|
|
153
|
+
function Y(e) {
|
|
155
154
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
156
155
|
}
|
|
157
|
-
function
|
|
156
|
+
function Z(e) {
|
|
158
157
|
const t = C(e || "");
|
|
159
|
-
if (!l.highlightKeyword || !
|
|
160
|
-
const n =
|
|
158
|
+
if (!l.highlightKeyword || !p.value) return t;
|
|
159
|
+
const n = Y(C(p.value));
|
|
161
160
|
return n ? t.replace(
|
|
162
161
|
new RegExp(`(${n})`, "ig"),
|
|
163
162
|
'<mark class="qy-search-input__mark">$1</mark>'
|
|
164
163
|
) : t;
|
|
165
164
|
}
|
|
166
|
-
function
|
|
165
|
+
function x() {
|
|
167
166
|
var e, t;
|
|
168
|
-
(t = (e =
|
|
167
|
+
(t = (e = u.value) == null ? void 0 : e.focus) == null || t.call(e);
|
|
169
168
|
}
|
|
170
169
|
function ee() {
|
|
171
170
|
var e, t;
|
|
172
|
-
(t = (e =
|
|
171
|
+
(t = (e = u.value) == null ? void 0 : e.blur) == null || t.call(e);
|
|
173
172
|
}
|
|
174
173
|
function te() {
|
|
175
174
|
var e, t, n;
|
|
176
|
-
(n = (t = (e =
|
|
175
|
+
(n = (t = (e = u.value) == null ? void 0 : e.inputRef) == null ? void 0 : t.select) == null || n.call(t);
|
|
177
176
|
}
|
|
178
177
|
function ne() {
|
|
179
178
|
var e, t;
|
|
180
|
-
(t = (e =
|
|
179
|
+
(t = (e = u.value) == null ? void 0 : e.clear) == null || t.call(e);
|
|
181
180
|
}
|
|
182
181
|
function le() {
|
|
183
182
|
var e, t;
|
|
184
|
-
(t = (e =
|
|
183
|
+
(t = (e = u.value) == null ? void 0 : e.close) == null || t.call(e);
|
|
185
184
|
}
|
|
186
|
-
return
|
|
187
|
-
|
|
185
|
+
return A({
|
|
186
|
+
// 暴露搜索框常用控制方法,供弹窗打开后聚焦或失败后重试建议项。
|
|
187
|
+
focus: x,
|
|
188
188
|
blur: ee,
|
|
189
189
|
select: te,
|
|
190
190
|
clear: ne,
|
|
191
191
|
closePanel: le,
|
|
192
|
-
retryFetch:
|
|
193
|
-
}), (e, t) => (V(),
|
|
192
|
+
retryFetch: _
|
|
193
|
+
}), (e, t) => (V(), M("div", {
|
|
194
194
|
class: se(["qy-search-input", { "is-disabled": e.disabled }])
|
|
195
195
|
}, [
|
|
196
|
-
ie(
|
|
196
|
+
ie(w(he), E({
|
|
197
197
|
ref_key: "autocompleteRef",
|
|
198
|
-
ref:
|
|
199
|
-
},
|
|
200
|
-
"model-value":
|
|
198
|
+
ref: u
|
|
199
|
+
}, w(O), {
|
|
200
|
+
"model-value": P.value,
|
|
201
201
|
disabled: e.disabled,
|
|
202
202
|
placeholder: e.placeholder,
|
|
203
203
|
clearable: e.clearable,
|
|
204
204
|
debounce: e.debounce,
|
|
205
|
-
"fetch-suggestions":
|
|
205
|
+
"fetch-suggestions": Q,
|
|
206
206
|
"trigger-on-focus": e.triggerOnFocus,
|
|
207
207
|
teleported: e.teleported,
|
|
208
208
|
"fit-input-width": e.fitInputWidth,
|
|
209
|
-
"popper-class":
|
|
209
|
+
"popper-class": z.value,
|
|
210
210
|
"append-to": e.appendTo,
|
|
211
211
|
"value-key": "value",
|
|
212
|
-
"onUpdate:modelValue":
|
|
213
|
-
onInput:
|
|
212
|
+
"onUpdate:modelValue": q,
|
|
213
|
+
onInput: D,
|
|
214
214
|
onChange: U,
|
|
215
215
|
onFocus: W,
|
|
216
216
|
onBlur: j,
|
|
217
|
-
onClear:
|
|
218
|
-
onSelect:
|
|
219
|
-
onKeydown: ce(
|
|
217
|
+
onClear: G,
|
|
218
|
+
onSelect: X,
|
|
219
|
+
onKeydown: ce(J, ["enter"])
|
|
220
220
|
}), de({
|
|
221
221
|
append: i(() => [
|
|
222
|
-
e.$slots.append ? d(e.$slots, "append", { key: 0 }, void 0, !0) : (V(),
|
|
222
|
+
e.$slots.append ? d(e.$slots, "append", { key: 0 }, void 0, !0) : (V(), pe(w(me), E({ key: 1 }, e.buttonProps, {
|
|
223
223
|
loading: e.loading,
|
|
224
224
|
disabled: e.disabled,
|
|
225
|
-
onClick:
|
|
225
|
+
onClick: S
|
|
226
226
|
}), {
|
|
227
227
|
default: i(() => [
|
|
228
|
-
ge(
|
|
228
|
+
ge(L(e.buttonText), 1)
|
|
229
229
|
]),
|
|
230
230
|
_: 1
|
|
231
231
|
}, 16, ["loading", "disabled"]))
|
|
@@ -233,14 +233,14 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
233
233
|
default: i(({ item: n }) => [
|
|
234
234
|
d(e.$slots, "item", {
|
|
235
235
|
item: n,
|
|
236
|
-
keyword:
|
|
236
|
+
keyword: p.value
|
|
237
237
|
}, () => [
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
F("div", ve, [
|
|
239
|
+
F("div", {
|
|
240
240
|
class: "qy-search-input__item-label",
|
|
241
|
-
innerHTML:
|
|
242
|
-
}, null, 8,
|
|
243
|
-
n.description ? (V(),
|
|
241
|
+
innerHTML: Z(n.label || n.value || "")
|
|
242
|
+
}, null, 8, ye),
|
|
243
|
+
n.description ? (V(), M("div", be, L(n.description), 1)) : fe("", !0)
|
|
244
244
|
])
|
|
245
245
|
], !0)
|
|
246
246
|
]),
|
|
@@ -270,7 +270,7 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
270
270
|
]), 1040, ["model-value", "disabled", "placeholder", "clearable", "debounce", "trigger-on-focus", "teleported", "fit-input-width", "popper-class", "append-to"])
|
|
271
271
|
], 2));
|
|
272
272
|
}
|
|
273
|
-
})
|
|
273
|
+
});
|
|
274
274
|
export {
|
|
275
|
-
|
|
275
|
+
ke as default
|
|
276
276
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),n=require("element-plus"),T=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},autoSelectSingle:{type:Boolean,default:!1},size:{default:"default"},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(o,{expose:f,emit:i}){const t=o,s=i,c=l.useAttrs(),p=l.useSlots(),r=l.ref(null),m=l.computed(()=>["qy-select__popper",t.popperClass].filter(Boolean).join(" ")),d=l.computed(()=>(t.options||[]).map(e=>({raw:e,label:(e==null?void 0:e[t.labelKey])??(e==null?void 0:e.label)??(e==null?void 0:e.value)??"",value:(e==null?void 0:e[t.valueKey])??(e==null?void 0:e.value)??(e==null?void 0:e.label),disabled:!!(e!=null&&e[t.disabledKey])}))),b=l.computed(()=>{const e=p.default;return e?e().some(a=>a.type!==l.Comment):!1});function g(e){return Array.isArray(e)?e.length===0:e===""||e===null||e===void 0}l.watch([d,()=>t.modelValue,()=>t.autoSelectSingle,()=>t.disabled,()=>t.multiple],([e])=>{if(!t.autoSelectSingle||t.disabled||!g(t.modelValue)||e.length!==1)return;const[a]=e;if(a.disabled)return;const u=t.multiple?[a.value]:a.value;s("update:modelValue",u),s("change",u)},{immediate:!0});function y(e,a){return`${String(e.value??e.label??"")}-${a}`}function h(e){s("update:modelValue",e)}function v(e){s("change",e)}function S(){s("clear")}function B(e){s("visible-change",e)}function C(e){s("focus",e)}function k(e){s("blur",e)}function V(){var e,a;(a=(e=r.value)==null?void 0:e.focus)==null||a.call(e)}function $(){var e,a;(a=(e=r.value)==null?void 0:e.blur)==null||a.call(e)}return f({focus:V,blur:$}),(e,a)=>(l.openBlock(),l.createBlock(l.unref(n.ElSelect),l.mergeProps({ref_key:"selectRef",ref:r},l.unref(c),{"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":m.value,"append-to":e.appendTo,"onUpdate:modelValue":h,onChange:v,onClear:S,onVisibleChange:B,onFocus:C,onBlur:k}),l.createSlots({default:l.withCtx(()=>[b.value?l.renderSlot(e.$slots,"default",{key:0}):(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:1},l.renderList(d.value,(u,w)=>(l.openBlock(),l.createBlock(l.unref(n.ElOption),{key:y(u,w),label:u.label,value:u.value,disabled:u.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(u=>[l.renderSlot(e.$slots,"tag",l.normalizeProps(l.guardReactiveProps(u)))]),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=T;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { defineComponent as E, useAttrs as P, useSlots as F, ref as O, computed as n, Comment as R, watch as I, createBlock as p, openBlock as o, unref as f, mergeProps as U, createSlots as W, withCtx as u, renderSlot as d, createElementBlock as j, Fragment as q, renderList as D, normalizeProps as L, guardReactiveProps as M } from "vue";
|
|
2
|
+
import { ElSelect as N, ElOption as Q } from "element-plus";
|
|
3
|
+
const J = /* @__PURE__ */ E({
|
|
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
|
+
autoSelectSingle: { type: Boolean, default: !1 },
|
|
21
|
+
size: { default: "default" },
|
|
22
|
+
teleported: { type: Boolean, default: !0 },
|
|
23
|
+
appendTo: { default: "body" },
|
|
24
|
+
fitInputWidth: { type: Boolean, default: !0 },
|
|
25
|
+
popperClass: { default: "" }
|
|
26
|
+
},
|
|
27
|
+
emits: ["update:modelValue", "change", "clear", "visible-change", "focus", "blur"],
|
|
28
|
+
setup(c, { expose: m, emit: b }) {
|
|
29
|
+
const a = c, s = b, y = P(), g = F(), r = O(null), h = n(
|
|
30
|
+
() => ["qy-select__popper", a.popperClass].filter(Boolean).join(" ")
|
|
31
|
+
), i = n(
|
|
32
|
+
() => (a.options || []).map((e) => ({
|
|
33
|
+
raw: e,
|
|
34
|
+
label: (e == null ? void 0 : e[a.labelKey]) ?? (e == null ? void 0 : e.label) ?? (e == null ? void 0 : e.value) ?? "",
|
|
35
|
+
value: (e == null ? void 0 : e[a.valueKey]) ?? (e == null ? void 0 : e.value) ?? (e == null ? void 0 : e.label),
|
|
36
|
+
disabled: !!(e != null && e[a.disabledKey])
|
|
37
|
+
}))
|
|
38
|
+
), v = n(() => {
|
|
39
|
+
const e = g.default;
|
|
40
|
+
return e ? e().some((l) => l.type !== R) : !1;
|
|
41
|
+
});
|
|
42
|
+
function B(e) {
|
|
43
|
+
return Array.isArray(e) ? e.length === 0 : e === "" || e === null || e === void 0;
|
|
44
|
+
}
|
|
45
|
+
I(
|
|
46
|
+
[
|
|
47
|
+
i,
|
|
48
|
+
() => a.modelValue,
|
|
49
|
+
() => a.autoSelectSingle,
|
|
50
|
+
() => a.disabled,
|
|
51
|
+
() => a.multiple
|
|
52
|
+
],
|
|
53
|
+
([e]) => {
|
|
54
|
+
if (!a.autoSelectSingle || a.disabled || !B(a.modelValue) || e.length !== 1) return;
|
|
55
|
+
const [l] = e;
|
|
56
|
+
if (l.disabled) return;
|
|
57
|
+
const t = a.multiple ? [l.value] : l.value;
|
|
58
|
+
s("update:modelValue", t), s("change", t);
|
|
59
|
+
},
|
|
60
|
+
{ immediate: !0 }
|
|
61
|
+
);
|
|
62
|
+
function S(e, l) {
|
|
63
|
+
return `${String(e.value ?? e.label ?? "")}-${l}`;
|
|
64
|
+
}
|
|
65
|
+
function C(e) {
|
|
66
|
+
s("update:modelValue", e);
|
|
67
|
+
}
|
|
68
|
+
function V(e) {
|
|
69
|
+
s("change", e);
|
|
70
|
+
}
|
|
71
|
+
function k() {
|
|
72
|
+
s("clear");
|
|
73
|
+
}
|
|
74
|
+
function $(e) {
|
|
75
|
+
s("visible-change", e);
|
|
76
|
+
}
|
|
77
|
+
function T(e) {
|
|
78
|
+
s("focus", e);
|
|
79
|
+
}
|
|
80
|
+
function K(e) {
|
|
81
|
+
s("blur", e);
|
|
82
|
+
}
|
|
83
|
+
function z() {
|
|
84
|
+
var e, l;
|
|
85
|
+
(l = (e = r.value) == null ? void 0 : e.focus) == null || l.call(e);
|
|
86
|
+
}
|
|
87
|
+
function w() {
|
|
88
|
+
var e, l;
|
|
89
|
+
(l = (e = r.value) == null ? void 0 : e.blur) == null || l.call(e);
|
|
90
|
+
}
|
|
91
|
+
return m({
|
|
92
|
+
// 仅暴露业务常用焦点方法,复杂下拉行为仍交给 Element Plus 自身处理。
|
|
93
|
+
focus: z,
|
|
94
|
+
blur: w
|
|
95
|
+
}), (e, l) => (o(), p(f(N), U({
|
|
96
|
+
ref_key: "selectRef",
|
|
97
|
+
ref: r
|
|
98
|
+
}, f(y), {
|
|
99
|
+
"model-value": e.modelValue,
|
|
100
|
+
placeholder: e.placeholder,
|
|
101
|
+
disabled: e.disabled,
|
|
102
|
+
clearable: e.clearable,
|
|
103
|
+
filterable: e.filterable,
|
|
104
|
+
multiple: e.multiple,
|
|
105
|
+
"collapse-tags": e.collapseTags,
|
|
106
|
+
"collapse-tags-tooltip": e.collapseTagsTooltip,
|
|
107
|
+
size: e.size,
|
|
108
|
+
teleported: e.teleported,
|
|
109
|
+
"fit-input-width": e.fitInputWidth,
|
|
110
|
+
"popper-class": h.value,
|
|
111
|
+
"append-to": e.appendTo,
|
|
112
|
+
"onUpdate:modelValue": C,
|
|
113
|
+
onChange: V,
|
|
114
|
+
onClear: k,
|
|
115
|
+
onVisibleChange: $,
|
|
116
|
+
onFocus: T,
|
|
117
|
+
onBlur: K
|
|
118
|
+
}), W({
|
|
119
|
+
default: u(() => [
|
|
120
|
+
v.value ? d(e.$slots, "default", { key: 0 }) : (o(!0), j(q, { key: 1 }, D(i.value, (t, A) => (o(), p(f(Q), {
|
|
121
|
+
key: S(t, A),
|
|
122
|
+
label: t.label,
|
|
123
|
+
value: t.value,
|
|
124
|
+
disabled: t.disabled
|
|
125
|
+
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
126
|
+
]),
|
|
127
|
+
_: 2
|
|
128
|
+
}, [
|
|
129
|
+
e.$slots.prefix ? {
|
|
130
|
+
name: "prefix",
|
|
131
|
+
fn: u(() => [
|
|
132
|
+
d(e.$slots, "prefix")
|
|
133
|
+
]),
|
|
134
|
+
key: "0"
|
|
135
|
+
} : void 0,
|
|
136
|
+
e.$slots.empty ? {
|
|
137
|
+
name: "empty",
|
|
138
|
+
fn: u(() => [
|
|
139
|
+
d(e.$slots, "empty")
|
|
140
|
+
]),
|
|
141
|
+
key: "1"
|
|
142
|
+
} : void 0,
|
|
143
|
+
e.$slots.loading ? {
|
|
144
|
+
name: "loading",
|
|
145
|
+
fn: u(() => [
|
|
146
|
+
d(e.$slots, "loading")
|
|
147
|
+
]),
|
|
148
|
+
key: "2"
|
|
149
|
+
} : void 0,
|
|
150
|
+
e.$slots.tag ? {
|
|
151
|
+
name: "tag",
|
|
152
|
+
fn: u((t) => [
|
|
153
|
+
d(e.$slots, "tag", L(M(t)))
|
|
154
|
+
]),
|
|
155
|
+
key: "3"
|
|
156
|
+
} : void 0
|
|
157
|
+
]), 1040, ["model-value", "placeholder", "disabled", "clearable", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "size", "teleported", "fit-input-width", "popper-class", "append-to"]));
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
export {
|
|
161
|
+
J as default
|
|
162
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index.vue.cjs");exports.default=e.default;
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { useAttrs as b, ref as k, createBlock as S, openBlock as V, mergeProps as x, unref as z } from "vue";
|
|
2
|
+
import B from "../upload/index.vue.mjs";
|
|
3
|
+
const w = /* @__PURE__ */ Object.assign({
|
|
4
|
+
name: "QyVoucherUpload",
|
|
5
|
+
inheritAttrs: !1
|
|
6
|
+
}, {
|
|
7
|
+
__name: "index",
|
|
8
|
+
props: {
|
|
9
|
+
/** 凭证图片 URL 数组。 */
|
|
10
|
+
modelValue: { type: Array, default: () => [] },
|
|
11
|
+
/** 上传接口路径。 */
|
|
12
|
+
api: { type: String, default: "/permission-api/common/uploads" },
|
|
13
|
+
/** 凭证上传沿用老业务字段名 files。 */
|
|
14
|
+
name: { type: String, default: "files" },
|
|
15
|
+
/** 是否多选。 */
|
|
16
|
+
multiple: { type: Boolean, default: !0 },
|
|
17
|
+
/** 是否禁用。 */
|
|
18
|
+
disabled: { type: Boolean, default: !1 },
|
|
19
|
+
/** 允许的文件类型后缀。 */
|
|
20
|
+
fileType: { type: Array, default: () => [] },
|
|
21
|
+
/** 单个文件大小限制(MB)。 */
|
|
22
|
+
fileSize: { type: Number, default: 10 },
|
|
23
|
+
/** 文件数量限制。 */
|
|
24
|
+
limit: { type: Number, default: 9 },
|
|
25
|
+
/** 是否显示格式/大小提示。 */
|
|
26
|
+
isShowTip: { type: Boolean, default: !1 },
|
|
27
|
+
/** token 读取 key。 */
|
|
28
|
+
tokenKey: { type: String, default: "Admin-Token" },
|
|
29
|
+
/** 是否支持视频模式。 */
|
|
30
|
+
supportVideo: { type: Boolean, default: !1 },
|
|
31
|
+
/** 凭证默认尺寸,贴近财审凭证里的紧凑图片格。 */
|
|
32
|
+
size: { type: String, default: "90px" },
|
|
33
|
+
/** 禁用拖拽。 */
|
|
34
|
+
disableDrag: { type: Boolean, default: !1 },
|
|
35
|
+
/** 成功回调。 */
|
|
36
|
+
callBack: { type: Function, default: null },
|
|
37
|
+
/** 上传时附加的额外 FormData 字段。 */
|
|
38
|
+
extraData: { type: Object, default: () => ({}) },
|
|
39
|
+
/** 凭证上传底部提示文案,默认对齐 CopyImgUpload 的旧交互。 */
|
|
40
|
+
pastePlaceholder: { type: String, default: "粘贴图片上传" }
|
|
41
|
+
},
|
|
42
|
+
emits: [
|
|
43
|
+
"update:modelValue",
|
|
44
|
+
"change",
|
|
45
|
+
"success",
|
|
46
|
+
"error",
|
|
47
|
+
"remove"
|
|
48
|
+
],
|
|
49
|
+
setup(a, { expose: u, emit: r }) {
|
|
50
|
+
const l = r, d = b(), i = k(null);
|
|
51
|
+
function n(e) {
|
|
52
|
+
return Array.isArray(e) ? e : [];
|
|
53
|
+
}
|
|
54
|
+
function s(e) {
|
|
55
|
+
l("update:modelValue", n(e));
|
|
56
|
+
}
|
|
57
|
+
function f(e) {
|
|
58
|
+
const t = n(e == null ? void 0 : e.files);
|
|
59
|
+
l("change", t);
|
|
60
|
+
}
|
|
61
|
+
function c(e) {
|
|
62
|
+
l("success", e);
|
|
63
|
+
}
|
|
64
|
+
function m(e) {
|
|
65
|
+
l("error", e);
|
|
66
|
+
}
|
|
67
|
+
function p(e, t) {
|
|
68
|
+
l("remove", e, t);
|
|
69
|
+
}
|
|
70
|
+
function y() {
|
|
71
|
+
var e, t;
|
|
72
|
+
(t = (e = i.value) == null ? void 0 : e.openFileDialog) == null || t.call(e);
|
|
73
|
+
}
|
|
74
|
+
function o() {
|
|
75
|
+
var e, t;
|
|
76
|
+
return ((t = (e = i.value) == null ? void 0 : e.getPathList) == null ? void 0 : t.call(e)) || [];
|
|
77
|
+
}
|
|
78
|
+
function h() {
|
|
79
|
+
var e, t;
|
|
80
|
+
(t = (e = i.value) == null ? void 0 : e.clearFiles) == null || t.call(e);
|
|
81
|
+
}
|
|
82
|
+
function g() {
|
|
83
|
+
return o();
|
|
84
|
+
}
|
|
85
|
+
return u({
|
|
86
|
+
openFileDialog: y,
|
|
87
|
+
getPathList: o,
|
|
88
|
+
clearFiles: h,
|
|
89
|
+
getValue: g
|
|
90
|
+
}), (e, t) => (V(), S(B, x({
|
|
91
|
+
ref_key: "uploadRef",
|
|
92
|
+
ref: i
|
|
93
|
+
}, z(d), {
|
|
94
|
+
"model-value": a.modelValue,
|
|
95
|
+
"value-format": "array",
|
|
96
|
+
api: a.api,
|
|
97
|
+
name: a.name,
|
|
98
|
+
multiple: a.multiple,
|
|
99
|
+
disabled: a.disabled,
|
|
100
|
+
"file-type": a.fileType,
|
|
101
|
+
"file-size": a.fileSize,
|
|
102
|
+
limit: a.limit,
|
|
103
|
+
"is-show-tip": a.isShowTip,
|
|
104
|
+
"token-key": a.tokenKey,
|
|
105
|
+
"support-video": a.supportVideo,
|
|
106
|
+
size: a.size,
|
|
107
|
+
"disable-drag": a.disableDrag,
|
|
108
|
+
"call-back": a.callBack,
|
|
109
|
+
"extra-data": a.extraData,
|
|
110
|
+
"show-text": !1,
|
|
111
|
+
"show-paste-input": !0,
|
|
112
|
+
"paste-placeholder": a.pastePlaceholder,
|
|
113
|
+
"onUpdate:modelValue": s,
|
|
114
|
+
onChange: f,
|
|
115
|
+
onSuccess: c,
|
|
116
|
+
onError: m,
|
|
117
|
+
onRemove: p
|
|
118
|
+
}), 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"]));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
export {
|
|
122
|
+
w as default
|
|
123
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
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;
|