@qynpm/ui 1.0.4 → 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 +169 -0
- package/dist/index.cjs +2 -1
- package/dist/index.mjs +54 -15
- 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 -4
- 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 -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 +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 -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 +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 -0
- package/dist/qy-voucher-upload/index.mjs +6 -0
- 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.vue.mjs → shared/index-Bw9kVFsm.mjs} +13 -13
- package/dist/{lib/qy-record-quote-search/index.vue.mjs → shared/index-BzV4959-.mjs} +42 -43
- package/dist/{lib/qy-form-section/index.vue.mjs → shared/index-C0ADdL4S.mjs} +11 -12
- 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/shared/index-DeWkPj3O.mjs +484 -0
- package/dist/shared/index-PUYQxK94.mjs +123 -0
- package/dist/shared/index-UzZbxoqZ.cjs +1 -0
- package/dist/shared/index-a90QeEC4.cjs +1 -0
- package/dist/{lib/qy-search-input/index.vue.mjs → shared/index-wW02nNOp.mjs} +55 -55
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-BcZg8D-y.mjs +214 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-BmeBeCu0.mjs +162 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-C85575cL.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DkYwdYdF.mjs +90 -0
- 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} +8 -7
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-RtfqJ73A.mjs +171 -0
- 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} +24 -25
- 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.1/node_modules/js-cookie/dist/js.cookie.mjs → shared/js.cookie-OLEfuq_g.mjs} +16 -16
- package/index.d.ts +9 -0
- package/package.json +25 -1
- 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/_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/index.cjs +0 -1
- package/dist/lib/index.mjs +0 -40
- package/dist/lib/qy-action-bar/index.vue.cjs +0 -1
- package/dist/lib/qy-form-section/index.vue.cjs +0 -1
- package/dist/lib/qy-input/index.vue.cjs +0 -1
- package/dist/lib/qy-record-quote-search/index.vue.cjs +0 -1
- package/dist/lib/qy-search-input/index.vue.cjs +0 -1
- package/dist/lib/qy-select/index.vue.cjs +0 -1
- package/dist/lib/qy-select/index.vue.mjs +0 -137
- package/dist/lib/remark-image/index.vue.cjs +0 -1
- package/dist/lib/remark-image/index.vue.mjs +0 -198
- 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/upload/index.vue.mjs +0 -382
- 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.1/node_modules/js-cookie/dist/js.cookie.cjs +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
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 I, createBlock as pe, createTextVNode as ge } from "vue";
|
|
2
2
|
import { ElAutocomplete as he, ElButton as me } from "element-plus";
|
|
3
|
-
|
|
4
|
-
import ve from "../../_virtual/plugin-vue_export-helper.mjs";
|
|
3
|
+
import { _ as ve } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
5
4
|
const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
6
5
|
key: 0,
|
|
7
6
|
class: "qy-search-input__item-description"
|
|
8
|
-
},
|
|
7
|
+
}, we = /* @__PURE__ */ ae({
|
|
9
8
|
name: "QySearchInput",
|
|
10
9
|
inheritAttrs: !1,
|
|
11
10
|
__name: "index",
|
|
@@ -34,32 +33,32 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
34
33
|
fitInputWidth: { type: Boolean, default: !0 }
|
|
35
34
|
},
|
|
36
35
|
emits: ["update:modelValue", "search", "clear", "input", "change", "focus", "blur", "enter", "select", "visible-change", "suggestions-change", "error"],
|
|
37
|
-
setup(L, { expose: T, emit:
|
|
38
|
-
const l = L, o =
|
|
36
|
+
setup(L, { expose: T, emit: _ }) {
|
|
37
|
+
const l = L, o = _, A = re(), u = y(null), c = y(r(l.modelValue)), p = b(() => r(l.modelValue)), O = b(
|
|
39
38
|
() => ["qy-search-input__popper", l.popperClass].filter(Boolean).join(" ")
|
|
40
|
-
), z = b(() =>
|
|
41
|
-
|
|
39
|
+
), z = b(() => r(l.modelValue)), g = y("");
|
|
40
|
+
ue(
|
|
42
41
|
() => l.modelValue,
|
|
43
42
|
(e) => {
|
|
44
|
-
c.value =
|
|
43
|
+
c.value = r(e);
|
|
45
44
|
}
|
|
46
45
|
);
|
|
47
|
-
function
|
|
46
|
+
function r(e) {
|
|
48
47
|
return e == null ? "" : String(e);
|
|
49
48
|
}
|
|
50
49
|
function P(e) {
|
|
51
50
|
return l.removeSpace ? e.replace(/\s+/g, "") : e;
|
|
52
51
|
}
|
|
53
|
-
function
|
|
52
|
+
function S(e, t) {
|
|
54
53
|
return l.trimMode !== t ? e : e.trim();
|
|
55
54
|
}
|
|
56
55
|
function h(e) {
|
|
57
|
-
return P(
|
|
56
|
+
return P(r(e));
|
|
58
57
|
}
|
|
59
58
|
function m(e) {
|
|
60
59
|
c.value = e, o("update:modelValue", e);
|
|
61
60
|
}
|
|
62
|
-
function
|
|
61
|
+
function k(e, t = "") {
|
|
63
62
|
return {
|
|
64
63
|
...e,
|
|
65
64
|
label: e.label || e.value,
|
|
@@ -71,36 +70,36 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
71
70
|
return e.flatMap((t) => {
|
|
72
71
|
if (Array.isArray(t.items)) {
|
|
73
72
|
const n = t;
|
|
74
|
-
return n.items.map((a) =>
|
|
73
|
+
return n.items.map((a) => k(a, n.groupLabel));
|
|
75
74
|
}
|
|
76
|
-
return
|
|
75
|
+
return k(t);
|
|
77
76
|
});
|
|
78
77
|
}
|
|
79
78
|
function K(e) {
|
|
80
79
|
const t = e.toLowerCase();
|
|
81
80
|
return (n) => [n.label, n.value, n.description].filter(Boolean).some((a) => String(a).toLowerCase().includes(t));
|
|
82
81
|
}
|
|
83
|
-
function
|
|
82
|
+
function Q(e) {
|
|
84
83
|
return e ? e.length >= l.minLength : l.triggerOnFocus;
|
|
85
84
|
}
|
|
86
85
|
function s(e) {
|
|
87
86
|
o("suggestions-change", e), o("visible-change", e.length > 0);
|
|
88
87
|
}
|
|
89
|
-
async function
|
|
90
|
-
if (!
|
|
88
|
+
async function R(e) {
|
|
89
|
+
if (!Q(e))
|
|
91
90
|
return s([]), [];
|
|
92
91
|
if (l.fetchSuggestionsMethod) {
|
|
93
|
-
const a = await new Promise((
|
|
92
|
+
const a = await new Promise((f) => {
|
|
94
93
|
var $;
|
|
95
94
|
($ = l.fetchSuggestionsMethod) == null || $.call(l, e, (oe) => {
|
|
96
|
-
|
|
95
|
+
f(v(oe));
|
|
97
96
|
});
|
|
98
97
|
});
|
|
99
98
|
return s(a), a;
|
|
100
99
|
}
|
|
101
100
|
if (l.fetchSuggestions) {
|
|
102
|
-
const a = await l.fetchSuggestions(e),
|
|
103
|
-
return s(
|
|
101
|
+
const a = await l.fetchSuggestions(e), f = v(Array.isArray(a) ? a : []);
|
|
102
|
+
return s(f), f;
|
|
104
103
|
}
|
|
105
104
|
const t = v(l.suggestions), n = e ? t.filter(K(e)) : t;
|
|
106
105
|
return s(n), n;
|
|
@@ -108,7 +107,7 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
108
107
|
async function H(e, t) {
|
|
109
108
|
g.value = e;
|
|
110
109
|
try {
|
|
111
|
-
const n = await
|
|
110
|
+
const n = await R(e);
|
|
112
111
|
t(n);
|
|
113
112
|
} catch (n) {
|
|
114
113
|
o("error", n), s([]), t([]);
|
|
@@ -116,35 +115,35 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
116
115
|
}
|
|
117
116
|
function N() {
|
|
118
117
|
var e, t;
|
|
119
|
-
g.value && ((t = (e =
|
|
118
|
+
g.value && ((t = (e = u.value) == null ? void 0 : e.getData) == null || t.call(e, g.value));
|
|
120
119
|
}
|
|
121
|
-
function
|
|
120
|
+
function q(e) {
|
|
122
121
|
const t = h(e);
|
|
123
122
|
m(t);
|
|
124
123
|
}
|
|
125
|
-
function
|
|
124
|
+
function D(e) {
|
|
126
125
|
const t = h(e);
|
|
127
126
|
c.value = t, o("input", t);
|
|
128
127
|
}
|
|
129
128
|
function U(e) {
|
|
130
|
-
const t =
|
|
131
|
-
t !==
|
|
129
|
+
const t = S(h(e), "change");
|
|
130
|
+
t !== r(l.modelValue) && m(t), o("change", t);
|
|
132
131
|
}
|
|
133
132
|
function W(e) {
|
|
134
133
|
o("focus", e);
|
|
135
134
|
}
|
|
136
135
|
function j(e) {
|
|
137
|
-
const t =
|
|
138
|
-
t !==
|
|
136
|
+
const t = S(c.value, "blur");
|
|
137
|
+
t !== r(l.modelValue) && m(t), o("blur", e), o("visible-change", !1);
|
|
139
138
|
}
|
|
140
139
|
function x() {
|
|
141
140
|
c.value = "", o("update:modelValue", ""), o("clear"), s([]);
|
|
142
141
|
}
|
|
143
142
|
function G(e) {
|
|
144
|
-
o("enter", e), l.searchOnEnter &&
|
|
143
|
+
o("enter", e), l.searchOnEnter && B();
|
|
145
144
|
}
|
|
146
|
-
function
|
|
147
|
-
o("search",
|
|
145
|
+
function B() {
|
|
146
|
+
o("search", r(l.modelValue));
|
|
148
147
|
}
|
|
149
148
|
function J(e) {
|
|
150
149
|
o("select", e), l.searchOnSelect && o("search", e.value);
|
|
@@ -157,8 +156,8 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
157
156
|
}
|
|
158
157
|
function Y(e) {
|
|
159
158
|
const t = C(e || "");
|
|
160
|
-
if (!l.highlightKeyword || !
|
|
161
|
-
const n = X(C(
|
|
159
|
+
if (!l.highlightKeyword || !p.value) return t;
|
|
160
|
+
const n = X(C(p.value));
|
|
162
161
|
return n ? t.replace(
|
|
163
162
|
new RegExp(`(${n})`, "ig"),
|
|
164
163
|
'<mark class="qy-search-input__mark">$1</mark>'
|
|
@@ -166,38 +165,39 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
166
165
|
}
|
|
167
166
|
function Z() {
|
|
168
167
|
var e, t;
|
|
169
|
-
(t = (e =
|
|
168
|
+
(t = (e = u.value) == null ? void 0 : e.focus) == null || t.call(e);
|
|
170
169
|
}
|
|
171
170
|
function ee() {
|
|
172
171
|
var e, t;
|
|
173
|
-
(t = (e =
|
|
172
|
+
(t = (e = u.value) == null ? void 0 : e.blur) == null || t.call(e);
|
|
174
173
|
}
|
|
175
174
|
function te() {
|
|
176
175
|
var e, t, n;
|
|
177
|
-
(n = (t = (e =
|
|
176
|
+
(n = (t = (e = u.value) == null ? void 0 : e.inputRef) == null ? void 0 : t.select) == null || n.call(t);
|
|
178
177
|
}
|
|
179
178
|
function ne() {
|
|
180
179
|
var e, t;
|
|
181
|
-
(t = (e =
|
|
180
|
+
(t = (e = u.value) == null ? void 0 : e.clear) == null || t.call(e);
|
|
182
181
|
}
|
|
183
182
|
function le() {
|
|
184
183
|
var e, t;
|
|
185
|
-
(t = (e =
|
|
184
|
+
(t = (e = u.value) == null ? void 0 : e.close) == null || t.call(e);
|
|
186
185
|
}
|
|
187
186
|
return T({
|
|
187
|
+
// 暴露搜索框常用控制方法,供弹窗打开后聚焦或失败后重试建议项。
|
|
188
188
|
focus: Z,
|
|
189
189
|
blur: ee,
|
|
190
190
|
select: te,
|
|
191
191
|
clear: ne,
|
|
192
192
|
closePanel: le,
|
|
193
193
|
retryFetch: N
|
|
194
|
-
}), (e, t) => (V(),
|
|
194
|
+
}), (e, t) => (V(), M("div", {
|
|
195
195
|
class: se(["qy-search-input", { "is-disabled": e.disabled }])
|
|
196
196
|
}, [
|
|
197
|
-
ie(
|
|
197
|
+
ie(w(he), E({
|
|
198
198
|
ref_key: "autocompleteRef",
|
|
199
|
-
ref:
|
|
200
|
-
},
|
|
199
|
+
ref: u
|
|
200
|
+
}, w(A), {
|
|
201
201
|
"model-value": z.value,
|
|
202
202
|
disabled: e.disabled,
|
|
203
203
|
placeholder: e.placeholder,
|
|
@@ -207,11 +207,11 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
207
207
|
"trigger-on-focus": e.triggerOnFocus,
|
|
208
208
|
teleported: e.teleported,
|
|
209
209
|
"fit-input-width": e.fitInputWidth,
|
|
210
|
-
"popper-class":
|
|
210
|
+
"popper-class": O.value,
|
|
211
211
|
"append-to": e.appendTo,
|
|
212
212
|
"value-key": "value",
|
|
213
|
-
"onUpdate:modelValue":
|
|
214
|
-
onInput:
|
|
213
|
+
"onUpdate:modelValue": q,
|
|
214
|
+
onInput: D,
|
|
215
215
|
onChange: U,
|
|
216
216
|
onFocus: W,
|
|
217
217
|
onBlur: j,
|
|
@@ -220,10 +220,10 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
220
220
|
onKeydown: ce(G, ["enter"])
|
|
221
221
|
}), de({
|
|
222
222
|
append: i(() => [
|
|
223
|
-
e.$slots.append ? d(e.$slots, "append", { key: 0 }, void 0, !0) : (V(),
|
|
223
|
+
e.$slots.append ? d(e.$slots, "append", { key: 0 }, void 0, !0) : (V(), pe(w(me), E({ key: 1 }, e.buttonProps, {
|
|
224
224
|
loading: e.loading,
|
|
225
225
|
disabled: e.disabled,
|
|
226
|
-
onClick:
|
|
226
|
+
onClick: B
|
|
227
227
|
}), {
|
|
228
228
|
default: i(() => [
|
|
229
229
|
ge(I(e.buttonText), 1)
|
|
@@ -234,14 +234,14 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
234
234
|
default: i(({ item: n }) => [
|
|
235
235
|
d(e.$slots, "item", {
|
|
236
236
|
item: n,
|
|
237
|
-
keyword:
|
|
237
|
+
keyword: p.value
|
|
238
238
|
}, () => [
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
F("div", ye, [
|
|
240
|
+
F("div", {
|
|
241
241
|
class: "qy-search-input__item-label",
|
|
242
242
|
innerHTML: Y(n.label || n.value || "")
|
|
243
243
|
}, null, 8, be),
|
|
244
|
-
n.description ? (V(),
|
|
244
|
+
n.description ? (V(), M("div", Ve, I(n.description), 1)) : fe("", !0)
|
|
245
245
|
])
|
|
246
246
|
], !0)
|
|
247
247
|
]),
|
|
@@ -271,7 +271,7 @@ const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
|
271
271
|
]), 1040, ["model-value", "disabled", "placeholder", "clearable", "debounce", "trigger-on-focus", "teleported", "fit-input-width", "popper-class", "append-to"])
|
|
272
272
|
], 2));
|
|
273
273
|
}
|
|
274
|
-
}),
|
|
274
|
+
}), Ce = /* @__PURE__ */ ve(we, [["__scopeId", "data-v-f1f0e1f9"]]);
|
|
275
275
|
export {
|
|
276
|
-
|
|
276
|
+
Ce as Q
|
|
277
277
|
};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { defineComponent as W, useAttrs as Q, ref as r, computed as S, watch as V, onBeforeUnmount as j, createBlock as G, openBlock as H, mergeProps as J, unref as X, createSlots as Y, withCtx as d, renderSlot as f, createCommentVNode as Z, normalizeProps as x, guardReactiveProps as _ } from "vue";
|
|
2
|
+
import { _ as ee } from "./index.vue_vue_type_script_setup_true_lang-BmeBeCu0.mjs";
|
|
3
|
+
const te = /* @__PURE__ */ W({
|
|
4
|
+
name: "QyRemoteSelect",
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "index",
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: { type: [String, Number, Boolean, Array, null], default: void 0 },
|
|
9
|
+
fetchMethod: {},
|
|
10
|
+
defaultOptions: { default: () => [] },
|
|
11
|
+
labelKey: { default: "label" },
|
|
12
|
+
valueKey: { default: "value" },
|
|
13
|
+
disabledKey: { default: "disabled" },
|
|
14
|
+
placeholder: { default: "请选择" },
|
|
15
|
+
disabled: { type: Boolean, default: !1 },
|
|
16
|
+
clearable: { type: Boolean, default: !0 },
|
|
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
|
+
debounce: { default: 300 },
|
|
27
|
+
minLength: { default: 1 },
|
|
28
|
+
remoteOnFocus: { type: Boolean, default: !1 },
|
|
29
|
+
remoteShowSuffix: { type: Boolean, default: !0 },
|
|
30
|
+
loading: { type: Boolean, default: !1 },
|
|
31
|
+
reserveSelectedOption: { type: Boolean, default: !0 }
|
|
32
|
+
},
|
|
33
|
+
emits: ["update:modelValue", "change", "clear", "visible-change", "focus", "blur", "options-change", "loading-change", "error"],
|
|
34
|
+
setup(T, { expose: k, emit: C }) {
|
|
35
|
+
const l = T, t = C, $ = Q(), h = r(null), s = r([]), b = r(/* @__PURE__ */ new Map()), g = r(!1), c = r("");
|
|
36
|
+
let i = 0, n = null;
|
|
37
|
+
const F = S(() => l.loading || g.value), y = r(!1), u = S(() => {
|
|
38
|
+
const e = /* @__PURE__ */ new Map(), a = (o) => {
|
|
39
|
+
e.set(O(o), o);
|
|
40
|
+
};
|
|
41
|
+
return l.defaultOptions.forEach(a), l.reserveSelectedOption && b.value.forEach((o) => a(o)), s.value.forEach(a), Array.from(e.values());
|
|
42
|
+
});
|
|
43
|
+
V(
|
|
44
|
+
() => l.defaultOptions,
|
|
45
|
+
(e) => {
|
|
46
|
+
e.forEach(p);
|
|
47
|
+
},
|
|
48
|
+
{ immediate: !0 }
|
|
49
|
+
), V(
|
|
50
|
+
() => l.modelValue,
|
|
51
|
+
() => {
|
|
52
|
+
u.value.forEach(p);
|
|
53
|
+
},
|
|
54
|
+
{ immediate: !0 }
|
|
55
|
+
);
|
|
56
|
+
function O(e) {
|
|
57
|
+
return (e == null ? void 0 : e[l.valueKey]) ?? (e == null ? void 0 : e.value) ?? (e == null ? void 0 : e.label);
|
|
58
|
+
}
|
|
59
|
+
function w(e) {
|
|
60
|
+
return Array.isArray(l.modelValue) ? l.modelValue.includes(e) : l.modelValue === e;
|
|
61
|
+
}
|
|
62
|
+
function p(e) {
|
|
63
|
+
if (!l.reserveSelectedOption) return;
|
|
64
|
+
const a = O(e);
|
|
65
|
+
w(a) && b.value.set(a, e);
|
|
66
|
+
}
|
|
67
|
+
function A(e) {
|
|
68
|
+
return l.disabled ? !1 : e ? e.length >= l.minLength : l.remoteOnFocus;
|
|
69
|
+
}
|
|
70
|
+
function v(e) {
|
|
71
|
+
g.value !== e && (g.value = e, t("loading-change", e));
|
|
72
|
+
}
|
|
73
|
+
async function m(e) {
|
|
74
|
+
if (c.value = e, !A(e)) {
|
|
75
|
+
i += 1, s.value = [], v(!1), t("options-change", u.value);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const a = ++i;
|
|
79
|
+
v(!0);
|
|
80
|
+
try {
|
|
81
|
+
const o = await l.fetchMethod(e);
|
|
82
|
+
if (a !== i) return;
|
|
83
|
+
s.value = Array.isArray(o) ? o : [], s.value.forEach(p), t("options-change", u.value);
|
|
84
|
+
} catch (o) {
|
|
85
|
+
if (a !== i) return;
|
|
86
|
+
s.value = [], t("error", o), t("options-change", u.value);
|
|
87
|
+
} finally {
|
|
88
|
+
a === i && v(!1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function B() {
|
|
92
|
+
y.value || (y.value = !0, m(""));
|
|
93
|
+
}
|
|
94
|
+
function K(e) {
|
|
95
|
+
n && (clearTimeout(n), n = null), n = setTimeout(() => {
|
|
96
|
+
m(e);
|
|
97
|
+
}, l.debounce);
|
|
98
|
+
}
|
|
99
|
+
function E() {
|
|
100
|
+
y.value = !0, m("");
|
|
101
|
+
}
|
|
102
|
+
function M() {
|
|
103
|
+
m(c.value);
|
|
104
|
+
}
|
|
105
|
+
function I(e) {
|
|
106
|
+
t("update:modelValue", e);
|
|
107
|
+
}
|
|
108
|
+
function R(e) {
|
|
109
|
+
u.value.forEach(p), t("change", e);
|
|
110
|
+
}
|
|
111
|
+
function z() {
|
|
112
|
+
t("clear");
|
|
113
|
+
}
|
|
114
|
+
function L(e) {
|
|
115
|
+
e && l.remoteOnFocus && !c.value && B(), t("visible-change", e);
|
|
116
|
+
}
|
|
117
|
+
function P(e) {
|
|
118
|
+
l.remoteOnFocus && !c.value && B(), t("focus", e);
|
|
119
|
+
}
|
|
120
|
+
function U(e) {
|
|
121
|
+
t("blur", e);
|
|
122
|
+
}
|
|
123
|
+
function q() {
|
|
124
|
+
var e, a;
|
|
125
|
+
(a = (e = h.value) == null ? void 0 : e.focus) == null || a.call(e);
|
|
126
|
+
}
|
|
127
|
+
function D() {
|
|
128
|
+
var e, a;
|
|
129
|
+
(a = (e = h.value) == null ? void 0 : e.blur) == null || a.call(e);
|
|
130
|
+
}
|
|
131
|
+
function N() {
|
|
132
|
+
t("update:modelValue", l.multiple ? [] : ""), t("clear");
|
|
133
|
+
}
|
|
134
|
+
return j(() => {
|
|
135
|
+
n && clearTimeout(n);
|
|
136
|
+
}), k({
|
|
137
|
+
// 暴露远程选择常用控制方法,供弹窗打开后聚焦或请求失败后重试。
|
|
138
|
+
focus: q,
|
|
139
|
+
blur: D,
|
|
140
|
+
clear: N,
|
|
141
|
+
retryFetch: M,
|
|
142
|
+
fetchDefaultOptions: E
|
|
143
|
+
}), (e, a) => (H(), G(ee, J({
|
|
144
|
+
ref_key: "selectRef",
|
|
145
|
+
ref: h
|
|
146
|
+
}, X($), {
|
|
147
|
+
"model-value": e.modelValue,
|
|
148
|
+
options: u.value,
|
|
149
|
+
"label-key": e.labelKey,
|
|
150
|
+
"value-key": e.valueKey,
|
|
151
|
+
"disabled-key": e.disabledKey,
|
|
152
|
+
placeholder: e.placeholder,
|
|
153
|
+
disabled: e.disabled,
|
|
154
|
+
clearable: e.clearable,
|
|
155
|
+
filterable: !0,
|
|
156
|
+
multiple: e.multiple,
|
|
157
|
+
"collapse-tags": e.collapseTags,
|
|
158
|
+
"collapse-tags-tooltip": e.collapseTagsTooltip,
|
|
159
|
+
"auto-select-single": e.autoSelectSingle,
|
|
160
|
+
size: e.size,
|
|
161
|
+
teleported: e.teleported,
|
|
162
|
+
"append-to": e.appendTo,
|
|
163
|
+
"fit-input-width": e.fitInputWidth,
|
|
164
|
+
"popper-class": e.popperClass,
|
|
165
|
+
remote: "",
|
|
166
|
+
"remote-show-suffix": e.remoteShowSuffix,
|
|
167
|
+
"remote-method": K,
|
|
168
|
+
loading: F.value,
|
|
169
|
+
"onUpdate:modelValue": I,
|
|
170
|
+
onChange: R,
|
|
171
|
+
onClear: z,
|
|
172
|
+
onVisibleChange: L,
|
|
173
|
+
onFocus: P,
|
|
174
|
+
onBlur: U
|
|
175
|
+
}), Y({
|
|
176
|
+
default: d(() => [
|
|
177
|
+
e.$slots.default ? f(e.$slots, "default", { key: 0 }) : Z("", !0)
|
|
178
|
+
]),
|
|
179
|
+
_: 2
|
|
180
|
+
}, [
|
|
181
|
+
e.$slots.prefix ? {
|
|
182
|
+
name: "prefix",
|
|
183
|
+
fn: d(() => [
|
|
184
|
+
f(e.$slots, "prefix")
|
|
185
|
+
]),
|
|
186
|
+
key: "0"
|
|
187
|
+
} : void 0,
|
|
188
|
+
e.$slots.empty ? {
|
|
189
|
+
name: "empty",
|
|
190
|
+
fn: d(() => [
|
|
191
|
+
f(e.$slots, "empty")
|
|
192
|
+
]),
|
|
193
|
+
key: "1"
|
|
194
|
+
} : void 0,
|
|
195
|
+
e.$slots.loading ? {
|
|
196
|
+
name: "loading",
|
|
197
|
+
fn: d(() => [
|
|
198
|
+
f(e.$slots, "loading")
|
|
199
|
+
]),
|
|
200
|
+
key: "2"
|
|
201
|
+
} : void 0,
|
|
202
|
+
e.$slots.tag ? {
|
|
203
|
+
name: "tag",
|
|
204
|
+
fn: d((o) => [
|
|
205
|
+
f(e.$slots, "tag", x(_(o)))
|
|
206
|
+
]),
|
|
207
|
+
key: "3"
|
|
208
|
+
} : void 0
|
|
209
|
+
]), 1040, ["model-value", "options", "label-key", "value-key", "disabled-key", "placeholder", "disabled", "clearable", "multiple", "collapse-tags", "collapse-tags-tooltip", "auto-select-single", "size", "teleported", "append-to", "fit-input-width", "popper-class", "remote-show-suffix", "loading"]));
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
export {
|
|
213
|
+
te as _
|
|
214
|
+
};
|
|
@@ -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 _
|
|
162
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("vue"),r=require("element-plus"),k=l.defineComponent({name:"QyRadioGroup",inheritAttrs:!1,__name:"index",props:{modelValue:{type:[String,Number,Boolean,null],default:void 0},options:{default:()=>[]},labelKey:{default:"label"},valueKey:{default:"value"},disabledKey:{default:"disabled"},disabled:{type:Boolean,default:!1},size:{default:"default"},name:{default:void 0},type:{default:"radio"},border:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(n,{expose:f,emit:m}){const a=n,s=m,b=l.useAttrs(),t=l.ref(null),c=l.computed(()=>a.type==="button"?r.ElRadioButton:r.ElRadio),v=l.computed(()=>(a.options||[]).map(e=>({raw:e,label:(e==null?void 0:e[a.labelKey])??(e==null?void 0:e.label)??(e==null?void 0:e.value)??"",value:(e==null?void 0:e[a.valueKey])??(e==null?void 0:e.value)??(e==null?void 0:e.label),disabled:!!(e!=null&&e[a.disabledKey])})));function y(e){const u={value:e.value,label:e.value,disabled:e.disabled};return a.type==="button"?u:{...u,border:a.border}}function i(e,u){return`${String(e.value??e.label??"")}-${u}`}function g(e){s("update:modelValue",e)}function o(e){s("change",e)}function B(){return t.value}return f({getRadioGroupInstance:B}),(e,u)=>(l.openBlock(),l.createBlock(l.unref(r.ElRadioGroup),l.mergeProps({ref_key:"radioGroupRef",ref:t},l.unref(b),{"model-value":e.modelValue,disabled:e.disabled,size:e.size,name:e.name,"onUpdate:modelValue":g,onChange:o}),{default:l.withCtx(()=>[e.$slots.default?l.renderSlot(e.$slots,"default",{key:0}):(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:1},l.renderList(v.value,(d,h)=>(l.openBlock(),l.createBlock(l.resolveDynamicComponent(c.value),l.mergeProps({key:i(d,h)},{ref_for:!0},y(d)),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"option",{option:d.raw,label:d.label,value:d.value,disabled:d.disabled},()=>[l.createTextVNode(l.toDisplayString(d.label),1)])]),_:2},1040))),128))]),_:3},16,["model-value","disabled","size","name"]))}});exports._sfc_main=k;
|