@qynpm/ui 1.0.4 → 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/index.cjs +1 -1
- package/dist/index.mjs +19 -15
- package/dist/lib/dialog/index.vue.cjs +1 -1
- package/dist/lib/dialog/index.vue.mjs +24 -25
- package/dist/lib/dialog/index.vue3.cjs +1 -0
- package/dist/lib/dialog/index.vue3.mjs +5 -0
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.mjs +43 -30
- package/dist/lib/qy-action-bar/index.vue.cjs +1 -1
- package/dist/lib/qy-action-bar/index.vue.mjs +4 -53
- package/dist/lib/qy-action-bar/index.vue2.cjs +1 -0
- package/dist/lib/qy-action-bar/index.vue2.mjs +55 -0
- package/dist/lib/qy-form-section/index.vue.cjs +1 -1
- package/dist/lib/qy-form-section/index.vue.mjs +4 -86
- package/dist/lib/qy-form-section/index.vue2.cjs +1 -0
- package/dist/lib/qy-form-section/index.vue2.mjs +87 -0
- package/dist/lib/qy-input/index.vue.mjs +2 -1
- 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 -1
- package/dist/lib/qy-record-quote-search/index.vue.mjs +4 -203
- package/dist/lib/qy-record-quote-search/index.vue2.cjs +1 -0
- package/dist/lib/qy-record-quote-search/index.vue2.mjs +204 -0
- 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 -1
- package/dist/lib/qy-search-input/index.vue.mjs +4 -274
- package/dist/lib/qy-search-input/index.vue2.cjs +1 -0
- package/dist/lib/qy-search-input/index.vue2.mjs +276 -0
- package/dist/lib/qy-select/index.vue.cjs +1 -1
- package/dist/lib/qy-select/index.vue.mjs +80 -55
- 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 -1
- package/dist/lib/remark-image/index.vue.mjs +4 -195
- package/dist/lib/remark-image/index.vue2.cjs +1 -0
- package/dist/lib/remark-image/index.vue2.mjs +197 -0
- package/dist/lib/upload/index.vue.cjs +1 -1
- package/dist/lib/upload/index.vue.mjs +317 -217
- package/dist/lib/utils/auth.cjs +1 -1
- package/dist/lib/utils/auth.mjs +1 -1
- package/dist/node_modules/.pnpm/{js-cookie@3.0.1 → js-cookie@3.0.5}/node_modules/js-cookie/dist/js.cookie.cjs +1 -1
- package/dist/node_modules/.pnpm/{js-cookie@3.0.1 → js-cookie@3.0.5}/node_modules/js-cookie/dist/js.cookie.mjs +6 -6
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +3 -2
- package/dist/qy-input/index.cjs +1 -1
- 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-remark-image/index.cjs +1 -1
- package/dist/qy-remark-image/index.mjs +1 -1
- package/dist/qy-remote-select/index.cjs +1 -0
- package/dist/qy-remote-select/index.mjs +6 -0
- package/dist/qy-select/index.cjs +1 -1
- 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 +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 → _plugin-vue_export-helper.cjs} +0 -0
- /package/dist/_virtual/{plugin-vue_export-helper.mjs → _plugin-vue_export-helper.mjs} +0 -0
|
@@ -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 ee from "../qy-select/index.vue.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 default
|
|
214
|
+
};
|
|
@@ -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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
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-9fedf1a9"]]);exports.default=u;
|
|
@@ -1,277 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ElAutocomplete as he, ElButton as me } from "element-plus";
|
|
1
|
+
import o from "./index.vue2.mjs";
|
|
3
2
|
/* empty css */
|
|
4
|
-
import
|
|
5
|
-
const
|
|
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"]]);
|
|
3
|
+
import t from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9fedf1a9"]]);
|
|
275
5
|
export {
|
|
276
|
-
|
|
6
|
+
p as default
|
|
277
7
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),w=require("element-plus"),X={class:"qy-search-input__item"},Y=["innerHTML"],Z={key:0,class:"qy-search-input__item-description"},ee=n.defineComponent({name:"QySearchInput",inheritAttrs:!1,__name:"index",props:{modelValue:{default:""},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{default:"请输入搜索内容"},removeSpace:{type:Boolean,default:!1},trimMode:{default:"none"},clearable:{type:Boolean,default:!0},buttonText:{default:"搜索"},buttonProps:{default:()=>({})},suggestions:{default:()=>[]},fetchSuggestions:{type:[Function,null],default:null},fetchSuggestionsMethod:{type:[Function,null],default:null},debounce:{default:300},minLength:{default:1},triggerOnFocus:{type:Boolean,default:!1},searchOnEnter:{type:Boolean,default:!0},searchOnSelect:{type:Boolean,default:!1},highlightKeyword:{type:Boolean,default:!0},teleported:{type:Boolean,default:!0},appendTo:{default:"body"},popperClass:{default:""},fitInputWidth:{type:Boolean,default:!0}},emits:["update:modelValue","search","clear","input","change","focus","blur","enter","select","visible-change","suggestions-change","error"],setup(k,{expose:B,emit:C}){const o=k,a=C,$=n.useAttrs(),s=n.ref(null),c=n.ref(u(o.modelValue)),f=n.computed(()=>u(o.modelValue)),M=n.computed(()=>["qy-search-input__popper",o.popperClass].filter(Boolean).join(" ")),E=n.computed(()=>u(o.modelValue)),p=n.ref("");n.watch(()=>o.modelValue,e=>{c.value=u(e)});function u(e){return e==null?"":String(e)}function T(e){return o.removeSpace?e.replace(/\s+/g,""):e}function v(e,t){return o.trimMode!==t?e:e.trim()}function g(e){return T(u(e))}function h(e){c.value=e,a("update:modelValue",e)}function y(e,t=""){return{...e,label:e.label||e.value,value:e.value||e.label,description:e.description||t}}function m(e=[]){return e.flatMap(t=>{if(Array.isArray(t.items)){const l=t;return l.items.map(r=>y(r,l.groupLabel))}return y(t)})}function F(e){const t=e.toLowerCase();return l=>[l.label,l.value,l.description].filter(Boolean).some(r=>String(r).toLowerCase().includes(t))}function L(e){return e?e.length>=o.minLength:o.triggerOnFocus}function i(e){a("suggestions-change",e),a("visible-change",e.length>0)}async function P(e){if(!L(e))return i([]),[];if(o.fetchSuggestionsMethod){const r=await new Promise(d=>{var S;(S=o.fetchSuggestionsMethod)==null||S.call(o,e,J=>{d(m(J))})});return i(r),r}if(o.fetchSuggestions){const r=await o.fetchSuggestions(e),d=m(Array.isArray(r)?r:[]);return i(d),d}const t=m(o.suggestions),l=e?t.filter(F(e)):t;return i(l),l}async function O(e,t){p.value=e;try{const l=await P(e);t(l)}catch(l){a("error",l),i([]),t([])}}function A(){var e,t;p.value&&((t=(e=s.value)==null?void 0:e.getData)==null||t.call(e,p.value))}function I(e){const t=g(e);h(t)}function z(e){const t=g(e);c.value=t,a("input",t)}function K(e){const t=v(g(e),"change");t!==u(o.modelValue)&&h(t),a("change",t)}function N(e){a("focus",e)}function R(e){const t=v(c.value,"blur");t!==u(o.modelValue)&&h(t),a("blur",e),a("visible-change",!1)}function _(){c.value="",a("update:modelValue",""),a("clear"),i([])}function q(e){a("enter",e),o.searchOnEnter&&b()}function b(){a("search",u(o.modelValue))}function H(e){a("select",e),o.searchOnSelect&&a("search",e.value)}function V(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function x(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function D(e){const t=V(e||"");if(!o.highlightKeyword||!f.value)return t;const l=x(V(f.value));return l?t.replace(new RegExp(`(${l})`,"ig"),'<mark class="qy-search-input__mark">$1</mark>'):t}function Q(){var e,t;(t=(e=s.value)==null?void 0:e.focus)==null||t.call(e)}function j(){var e,t;(t=(e=s.value)==null?void 0:e.blur)==null||t.call(e)}function U(){var e,t,l;(l=(t=(e=s.value)==null?void 0:e.inputRef)==null?void 0:t.select)==null||l.call(t)}function W(){var e,t;(t=(e=s.value)==null?void 0:e.clear)==null||t.call(e)}function G(){var e,t;(t=(e=s.value)==null?void 0:e.close)==null||t.call(e)}return B({focus:Q,blur:j,select:U,clear:W,closePanel:G,retryFetch:A}),(e,t)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["qy-search-input",{"is-disabled":e.disabled}])},[n.createVNode(n.unref(w.ElAutocomplete),n.mergeProps({ref_key:"autocompleteRef",ref:s},n.unref($),{"model-value":E.value,disabled:e.disabled,placeholder:e.placeholder,clearable:e.clearable,debounce:e.debounce,"fetch-suggestions":O,"trigger-on-focus":e.triggerOnFocus,teleported:e.teleported,"fit-input-width":e.fitInputWidth,"popper-class":M.value,"append-to":e.appendTo,"value-key":"value","onUpdate:modelValue":I,onInput:z,onChange:K,onFocus:N,onBlur:R,onClear:_,onSelect:H,onKeydown:n.withKeys(q,["enter"])}),n.createSlots({append:n.withCtx(()=>[e.$slots.append?n.renderSlot(e.$slots,"append",{key:0},void 0,!0):(n.openBlock(),n.createBlock(n.unref(w.ElButton),n.mergeProps({key:1},e.buttonProps,{loading:e.loading,disabled:e.disabled,onClick:b}),{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(e.buttonText),1)]),_:1},16,["loading","disabled"]))]),default:n.withCtx(({item:l})=>[n.renderSlot(e.$slots,"item",{item:l,keyword:f.value},()=>[n.createElementVNode("div",X,[n.createElementVNode("div",{class:"qy-search-input__item-label",innerHTML:D(l.label||l.value||"")},null,8,Y),l.description?(n.openBlock(),n.createElementBlock("div",Z,n.toDisplayString(l.description),1)):n.createCommentVNode("",!0)])],!0)]),_:2},[e.$slots.prefix?{name:"prefix",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"prefix",{},void 0,!0)]),key:"0"}:void 0,e.$slots.suffix?{name:"suffix",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"suffix",{},void 0,!0)]),key:"1"}:void 0,e.$slots.prepend?{name:"prepend",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"prepend",{},void 0,!0)]),key:"2"}:void 0]),1040,["model-value","disabled","placeholder","clearable","debounce","trigger-on-focus","teleported","fit-input-width","popper-class","append-to"])],2))}});exports.default=ee;
|