@qynpm/ui 0.0.2 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +183 -8
- package/dist/index-1ocyh-Ge.js +1 -0
- package/dist/index-BYAIkGVF.js +1 -0
- package/dist/index-BaU5rDMh.js +1 -0
- package/dist/index-BddPsC3s.mjs +384 -0
- package/dist/index-BzzxlJ2O.mjs +205 -0
- package/dist/index-C02naY8D.mjs +276 -0
- package/dist/index-CEg8yYrg.mjs +142 -0
- package/dist/index-CibtL3Up.mjs +325 -0
- package/dist/index-Cuwe7RLf.mjs +88 -0
- package/dist/index-CzJWU89H.js +1 -0
- package/dist/index-DQ-EEZgS.js +1 -0
- package/dist/index-Dg93AsO_.mjs +216 -0
- package/dist/index-Djj-T8oy.mjs +137 -0
- package/dist/index-DlwgfuD9.mjs +55 -0
- package/dist/index-Do5SZ8yS.js +1 -0
- package/dist/index-DooOsQ9d.js +1 -0
- package/dist/index-DzX3lxdp.js +1 -0
- package/dist/index-tC70xKe_.js +1 -0
- package/dist/index.cjs +1 -0
- package/dist/install-CxBnxbuN.mjs +8 -0
- package/dist/install-c8il9DQv.js +1 -0
- package/dist/js.cookie-XvHV2tha.js +1 -0
- package/dist/js.cookie-tagl12-O.mjs +74 -0
- package/dist/plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/dist/plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/dist/qy-action-bar/index.cjs +1 -0
- package/dist/qy-dialog/index.cjs +1 -0
- package/dist/qy-form-section/index.cjs +1 -0
- package/dist/qy-input/index.cjs +1 -0
- package/dist/qy-record-quote-search/index.cjs +1 -0
- package/dist/qy-remark-image/index.cjs +2 -0
- package/dist/qy-search-input/index.cjs +1 -0
- package/dist/qy-select/index.cjs +1 -0
- package/dist/qy-upload/index.cjs +1 -0
- package/index.d.ts +16 -4
- package/package.json +60 -7
- package/qy-action-bar/index.d.ts +5 -0
- package/qy-action-bar/index.js +4 -0
- package/qy-dialog/index.d.ts +5 -0
- package/qy-dialog/index.js +4 -0
- package/qy-form-section/index.d.ts +5 -0
- package/qy-form-section/index.js +4 -0
- package/qy-input/index.d.ts +5 -0
- package/qy-input/index.js +4 -0
- package/qy-record-quote-search/index.d.ts +5 -0
- package/qy-record-quote-search/index.js +4 -0
- package/qy-remark-image/index.d.ts +5 -0
- package/qy-remark-image/index.js +4 -0
- package/qy-search-input/index.d.ts +5 -0
- package/qy-search-input/index.js +4 -0
- package/qy-select/index.d.ts +5 -0
- package/qy-select/index.js +4 -0
- package/qy-upload/index.d.ts +5 -0
- package/qy-upload/index.js +4 -0
- package/dist/ui.es.js +0 -994
- package/dist/ui.umd.js +0 -2
- package/index.js +0 -9
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { defineComponent as U, useAttrs as I, ref as M, computed as $, createElementBlock as i, openBlock as c, renderSlot as r, createVNode as D, createCommentVNode as f, toDisplayString as p, mergeProps as J, unref as Z, createSlots as j, withCtx as d, normalizeProps as G, guardReactiveProps as H, createElementVNode as K, normalizeClass as W } from "vue";
|
|
2
|
+
import { Q as X } from "./index-C02naY8D.mjs";
|
|
3
|
+
import { _ as Y } from "./plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
4
|
+
const _ = { class: "qy-record-quote-search" }, x = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "qy-record-quote-search__header"
|
|
7
|
+
}, ee = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "qy-record-quote-search__label"
|
|
10
|
+
}, te = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "qy-record-quote-search__description"
|
|
13
|
+
}, oe = U({
|
|
14
|
+
name: "QyRecordQuoteSearch",
|
|
15
|
+
inheritAttrs: !1,
|
|
16
|
+
__name: "index",
|
|
17
|
+
props: {
|
|
18
|
+
modelValue: { default: "" },
|
|
19
|
+
loading: { type: Boolean, default: !1 },
|
|
20
|
+
disabled: { type: Boolean, default: !1 },
|
|
21
|
+
placeholder: { default: "请输入报价单号" },
|
|
22
|
+
buttonText: { default: "查询报价单" },
|
|
23
|
+
autoNormalize: { type: Boolean, default: !0 },
|
|
24
|
+
showStatus: { type: Boolean, default: !0 },
|
|
25
|
+
status: { default: "default" },
|
|
26
|
+
statusText: { default: "" },
|
|
27
|
+
suggestions: { default: () => [] },
|
|
28
|
+
fetchSuggestions: { type: [Function, null], default: null },
|
|
29
|
+
fetchSuggestionsMethod: { type: [Function, null], default: null },
|
|
30
|
+
debounce: { default: 300 },
|
|
31
|
+
minLength: { default: 1 },
|
|
32
|
+
searchOnSelect: { type: Boolean, default: !0 },
|
|
33
|
+
searchMethod: { type: [Function, null], default: null },
|
|
34
|
+
extractMethod: { type: [Function, null], default: null },
|
|
35
|
+
normalizeMethod: { type: [Function, null], default: null },
|
|
36
|
+
label: { default: "报价单号" },
|
|
37
|
+
description: { default: "" },
|
|
38
|
+
trimMode: { default: "blur" }
|
|
39
|
+
},
|
|
40
|
+
emits: ["update:modelValue", "search", "clear", "normalize", "enter", "select", "error", "success"],
|
|
41
|
+
setup(k, { expose: z, emit: E }) {
|
|
42
|
+
const o = k, a = E, F = I(), l = M(null), h = M(!1), m = $(() => o.statusText || ""), C = $(() => o.loading || h.value);
|
|
43
|
+
function u(e) {
|
|
44
|
+
return e == null ? "" : String(e);
|
|
45
|
+
}
|
|
46
|
+
function Q(e) {
|
|
47
|
+
const t = u(e).trim(), n = g(t), s = n.match(/BJ\d{8}[A-Z0-9]{4}/i);
|
|
48
|
+
return s ? s[0] : n;
|
|
49
|
+
}
|
|
50
|
+
function g(e) {
|
|
51
|
+
return u(e).replace(/\s+/g, "").trim().toUpperCase();
|
|
52
|
+
}
|
|
53
|
+
function y(e) {
|
|
54
|
+
return o.extractMethod ? o.extractMethod(e) : Q(e);
|
|
55
|
+
}
|
|
56
|
+
function v(e) {
|
|
57
|
+
return o.normalizeMethod ? o.normalizeMethod(e) : g(e);
|
|
58
|
+
}
|
|
59
|
+
function b(e, t) {
|
|
60
|
+
const n = u(e), s = y(n), V = o.autoNormalize ? v(s) : s;
|
|
61
|
+
return a("normalize", { rawValue: n, code: V }), {
|
|
62
|
+
rawValue: n,
|
|
63
|
+
code: V,
|
|
64
|
+
item: t
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function q(e) {
|
|
68
|
+
a("update:modelValue", e);
|
|
69
|
+
}
|
|
70
|
+
async function S(e) {
|
|
71
|
+
if (a("search", e), !!o.searchMethod) {
|
|
72
|
+
h.value = !0;
|
|
73
|
+
try {
|
|
74
|
+
const t = await o.searchMethod(e);
|
|
75
|
+
a("success", t);
|
|
76
|
+
} catch (t) {
|
|
77
|
+
a("error", t);
|
|
78
|
+
} finally {
|
|
79
|
+
h.value = !1;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function B(e) {
|
|
84
|
+
const t = b(e);
|
|
85
|
+
t.code !== u(o.modelValue) && a("update:modelValue", t.code), S(t);
|
|
86
|
+
}
|
|
87
|
+
function A() {
|
|
88
|
+
a("clear");
|
|
89
|
+
}
|
|
90
|
+
function N(e) {
|
|
91
|
+
a("enter", e);
|
|
92
|
+
}
|
|
93
|
+
function O(e) {
|
|
94
|
+
if (a("select", e), !o.searchOnSelect) return;
|
|
95
|
+
const t = b(e.value, e);
|
|
96
|
+
t.code !== u(o.modelValue) && a("update:modelValue", t.code), S(t);
|
|
97
|
+
}
|
|
98
|
+
function T(e) {
|
|
99
|
+
a("error", e);
|
|
100
|
+
}
|
|
101
|
+
function w() {
|
|
102
|
+
var e, t;
|
|
103
|
+
(t = (e = l.value) == null ? void 0 : e.focus) == null || t.call(e);
|
|
104
|
+
}
|
|
105
|
+
function R() {
|
|
106
|
+
var e, t;
|
|
107
|
+
(t = (e = l.value) == null ? void 0 : e.blur) == null || t.call(e);
|
|
108
|
+
}
|
|
109
|
+
function L() {
|
|
110
|
+
var e, t;
|
|
111
|
+
(t = (e = l.value) == null ? void 0 : e.select) == null || t.call(e);
|
|
112
|
+
}
|
|
113
|
+
function P() {
|
|
114
|
+
var e, t;
|
|
115
|
+
(t = (e = l.value) == null ? void 0 : e.clear) == null || t.call(e);
|
|
116
|
+
}
|
|
117
|
+
return z({
|
|
118
|
+
focus: w,
|
|
119
|
+
blur: R,
|
|
120
|
+
select: L,
|
|
121
|
+
clear: P,
|
|
122
|
+
extractQuoteOrderCode: y,
|
|
123
|
+
normalizeQuoteOrderCode: v
|
|
124
|
+
}), (e, t) => (c(), i("div", _, [
|
|
125
|
+
r(e.$slots, "label", {}, () => [
|
|
126
|
+
e.label || e.description ? (c(), i("div", x, [
|
|
127
|
+
e.label ? (c(), i("div", ee, p(e.label), 1)) : f("", !0),
|
|
128
|
+
e.description ? (c(), i("div", te, p(e.description), 1)) : f("", !0)
|
|
129
|
+
])) : f("", !0)
|
|
130
|
+
], !0),
|
|
131
|
+
D(X, J({
|
|
132
|
+
ref_key: "searchRef",
|
|
133
|
+
ref: l
|
|
134
|
+
}, Z(F), {
|
|
135
|
+
"model-value": e.modelValue,
|
|
136
|
+
loading: C.value,
|
|
137
|
+
disabled: e.disabled,
|
|
138
|
+
placeholder: e.placeholder,
|
|
139
|
+
"remove-space": !0,
|
|
140
|
+
"trim-mode": e.trimMode,
|
|
141
|
+
"button-text": e.buttonText,
|
|
142
|
+
suggestions: e.suggestions,
|
|
143
|
+
"fetch-suggestions": e.fetchSuggestions,
|
|
144
|
+
"fetch-suggestions-method": e.fetchSuggestionsMethod,
|
|
145
|
+
debounce: e.debounce,
|
|
146
|
+
"min-length": e.minLength,
|
|
147
|
+
"search-on-select": !1,
|
|
148
|
+
"onUpdate:modelValue": q,
|
|
149
|
+
onSearch: B,
|
|
150
|
+
onClear: A,
|
|
151
|
+
onEnter: N,
|
|
152
|
+
onSelect: O,
|
|
153
|
+
onError: T
|
|
154
|
+
}), j({ _: 2 }, [
|
|
155
|
+
e.$slots.prefix ? {
|
|
156
|
+
name: "prefix",
|
|
157
|
+
fn: d(() => [
|
|
158
|
+
r(e.$slots, "prefix", {}, void 0, !0)
|
|
159
|
+
]),
|
|
160
|
+
key: "0"
|
|
161
|
+
} : void 0,
|
|
162
|
+
e.$slots.suffix ? {
|
|
163
|
+
name: "suffix",
|
|
164
|
+
fn: d(() => [
|
|
165
|
+
r(e.$slots, "suffix", {}, void 0, !0)
|
|
166
|
+
]),
|
|
167
|
+
key: "1"
|
|
168
|
+
} : void 0,
|
|
169
|
+
e.$slots.item ? {
|
|
170
|
+
name: "item",
|
|
171
|
+
fn: d((n) => [
|
|
172
|
+
r(e.$slots, "item", G(H(n)), void 0, !0)
|
|
173
|
+
]),
|
|
174
|
+
key: "2"
|
|
175
|
+
} : void 0,
|
|
176
|
+
e.$slots.empty ? {
|
|
177
|
+
name: "empty",
|
|
178
|
+
fn: d(() => [
|
|
179
|
+
r(e.$slots, "empty", {}, void 0, !0)
|
|
180
|
+
]),
|
|
181
|
+
key: "3"
|
|
182
|
+
} : void 0,
|
|
183
|
+
e.$slots.loading ? {
|
|
184
|
+
name: "loading",
|
|
185
|
+
fn: d(() => [
|
|
186
|
+
r(e.$slots, "loading", {}, void 0, !0)
|
|
187
|
+
]),
|
|
188
|
+
key: "4"
|
|
189
|
+
} : void 0
|
|
190
|
+
]), 1040, ["model-value", "loading", "disabled", "placeholder", "trim-mode", "button-text", "suggestions", "fetch-suggestions", "fetch-suggestions-method", "debounce", "min-length"]),
|
|
191
|
+
e.showStatus && m.value ? r(e.$slots, "status", {
|
|
192
|
+
key: 0,
|
|
193
|
+
status: e.status,
|
|
194
|
+
statusText: m.value
|
|
195
|
+
}, () => [
|
|
196
|
+
K("div", {
|
|
197
|
+
class: W(["qy-record-quote-search__status", `is-${e.status}`])
|
|
198
|
+
}, p(m.value), 3)
|
|
199
|
+
], !0) : f("", !0)
|
|
200
|
+
]));
|
|
201
|
+
}
|
|
202
|
+
}), le = /* @__PURE__ */ Y(oe, [["__scopeId", "data-v-8bc26d3a"]]);
|
|
203
|
+
export {
|
|
204
|
+
le as Q
|
|
205
|
+
};
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { defineComponent as ae, useAttrs as ue, ref as y, computed as b, watch as re, createElementBlock as F, openBlock as V, normalizeClass as se, createVNode as ie, unref as B, mergeProps as M, withKeys as ce, createSlots as de, withCtx as i, renderSlot as d, createElementVNode as E, createCommentVNode as pe, toDisplayString as I, createBlock as fe, createTextVNode as ge } from "vue";
|
|
2
|
+
import { ElAutocomplete as he, ElButton as me } from "element-plus";
|
|
3
|
+
import { _ as ve } from "./plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
4
|
+
const ye = { class: "qy-search-input__item" }, be = ["innerHTML"], Ve = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "qy-search-input__item-description"
|
|
7
|
+
}, Be = ae({
|
|
8
|
+
name: "QySearchInput",
|
|
9
|
+
inheritAttrs: !1,
|
|
10
|
+
__name: "index",
|
|
11
|
+
props: {
|
|
12
|
+
modelValue: { default: "" },
|
|
13
|
+
loading: { type: Boolean, default: !1 },
|
|
14
|
+
disabled: { type: Boolean, default: !1 },
|
|
15
|
+
placeholder: { default: "请输入搜索内容" },
|
|
16
|
+
removeSpace: { type: Boolean, default: !1 },
|
|
17
|
+
trimMode: { default: "none" },
|
|
18
|
+
clearable: { type: Boolean, default: !0 },
|
|
19
|
+
buttonText: { default: "搜索" },
|
|
20
|
+
buttonProps: { default: () => ({}) },
|
|
21
|
+
suggestions: { default: () => [] },
|
|
22
|
+
fetchSuggestions: { type: [Function, null], default: null },
|
|
23
|
+
fetchSuggestionsMethod: { type: [Function, null], default: null },
|
|
24
|
+
debounce: { default: 300 },
|
|
25
|
+
minLength: { default: 1 },
|
|
26
|
+
triggerOnFocus: { type: Boolean, default: !1 },
|
|
27
|
+
searchOnEnter: { type: Boolean, default: !0 },
|
|
28
|
+
searchOnSelect: { type: Boolean, default: !1 },
|
|
29
|
+
highlightKeyword: { type: Boolean, default: !0 },
|
|
30
|
+
teleported: { type: Boolean, default: !0 },
|
|
31
|
+
appendTo: { default: "body" },
|
|
32
|
+
popperClass: { default: "" },
|
|
33
|
+
fitInputWidth: { type: Boolean, default: !0 }
|
|
34
|
+
},
|
|
35
|
+
emits: ["update:modelValue", "search", "clear", "input", "change", "focus", "blur", "enter", "select", "visible-change", "suggestions-change", "error"],
|
|
36
|
+
setup(L, { expose: T, emit: _ }) {
|
|
37
|
+
const l = L, o = _, A = ue(), r = y(null), c = y(u(l.modelValue)), f = b(() => u(l.modelValue)), O = b(
|
|
38
|
+
() => ["qy-search-input__popper", l.popperClass].filter(Boolean).join(" ")
|
|
39
|
+
), z = b(() => u(l.modelValue)), g = y("");
|
|
40
|
+
re(
|
|
41
|
+
() => l.modelValue,
|
|
42
|
+
(e) => {
|
|
43
|
+
c.value = u(e);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
function u(e) {
|
|
47
|
+
return e == null ? "" : String(e);
|
|
48
|
+
}
|
|
49
|
+
function P(e) {
|
|
50
|
+
return l.removeSpace ? e.replace(/\s+/g, "") : e;
|
|
51
|
+
}
|
|
52
|
+
function w(e, t) {
|
|
53
|
+
return l.trimMode !== t ? e : e.trim();
|
|
54
|
+
}
|
|
55
|
+
function h(e) {
|
|
56
|
+
return P(u(e));
|
|
57
|
+
}
|
|
58
|
+
function m(e) {
|
|
59
|
+
c.value = e, o("update:modelValue", e);
|
|
60
|
+
}
|
|
61
|
+
function S(e, t = "") {
|
|
62
|
+
return {
|
|
63
|
+
...e,
|
|
64
|
+
label: e.label || e.value,
|
|
65
|
+
value: e.value || e.label,
|
|
66
|
+
description: e.description || t
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function v(e = []) {
|
|
70
|
+
return e.flatMap((t) => {
|
|
71
|
+
if (Array.isArray(t.items)) {
|
|
72
|
+
const n = t;
|
|
73
|
+
return n.items.map((a) => S(a, n.groupLabel));
|
|
74
|
+
}
|
|
75
|
+
return S(t);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function K(e) {
|
|
79
|
+
const t = e.toLowerCase();
|
|
80
|
+
return (n) => [n.label, n.value, n.description].filter(Boolean).some((a) => String(a).toLowerCase().includes(t));
|
|
81
|
+
}
|
|
82
|
+
function Q(e) {
|
|
83
|
+
return e ? e.length >= l.minLength : l.triggerOnFocus;
|
|
84
|
+
}
|
|
85
|
+
function s(e) {
|
|
86
|
+
o("suggestions-change", e), o("visible-change", e.length > 0);
|
|
87
|
+
}
|
|
88
|
+
async function R(e) {
|
|
89
|
+
if (!Q(e))
|
|
90
|
+
return s([]), [];
|
|
91
|
+
if (l.fetchSuggestionsMethod) {
|
|
92
|
+
const a = await new Promise((p) => {
|
|
93
|
+
var $;
|
|
94
|
+
($ = l.fetchSuggestionsMethod) == null || $.call(l, e, (oe) => {
|
|
95
|
+
p(v(oe));
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
return s(a), a;
|
|
99
|
+
}
|
|
100
|
+
if (l.fetchSuggestions) {
|
|
101
|
+
const a = await l.fetchSuggestions(e), p = v(Array.isArray(a) ? a : []);
|
|
102
|
+
return s(p), p;
|
|
103
|
+
}
|
|
104
|
+
const t = v(l.suggestions), n = e ? t.filter(K(e)) : t;
|
|
105
|
+
return s(n), n;
|
|
106
|
+
}
|
|
107
|
+
async function D(e, t) {
|
|
108
|
+
g.value = e;
|
|
109
|
+
try {
|
|
110
|
+
const n = await R(e);
|
|
111
|
+
t(n);
|
|
112
|
+
} catch (n) {
|
|
113
|
+
o("error", n), s([]), t([]);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function H() {
|
|
117
|
+
var e, t;
|
|
118
|
+
g.value && ((t = (e = r.value) == null ? void 0 : e.getData) == null || t.call(e, g.value));
|
|
119
|
+
}
|
|
120
|
+
function N(e) {
|
|
121
|
+
const t = h(e);
|
|
122
|
+
m(t);
|
|
123
|
+
}
|
|
124
|
+
function q(e) {
|
|
125
|
+
const t = h(e);
|
|
126
|
+
c.value = t, o("input", t);
|
|
127
|
+
}
|
|
128
|
+
function U(e) {
|
|
129
|
+
const t = w(h(e), "change");
|
|
130
|
+
t !== u(l.modelValue) && m(t), o("change", t);
|
|
131
|
+
}
|
|
132
|
+
function W(e) {
|
|
133
|
+
o("focus", e);
|
|
134
|
+
}
|
|
135
|
+
function j(e) {
|
|
136
|
+
const t = w(c.value, "blur");
|
|
137
|
+
t !== u(l.modelValue) && m(t), o("blur", e), o("visible-change", !1);
|
|
138
|
+
}
|
|
139
|
+
function x() {
|
|
140
|
+
c.value = "", o("update:modelValue", ""), o("clear"), s([]);
|
|
141
|
+
}
|
|
142
|
+
function G(e) {
|
|
143
|
+
o("enter", e), l.searchOnEnter && k();
|
|
144
|
+
}
|
|
145
|
+
function k() {
|
|
146
|
+
o("search", u(l.modelValue));
|
|
147
|
+
}
|
|
148
|
+
function J(e) {
|
|
149
|
+
o("select", e), l.searchOnSelect && o("search", e.value);
|
|
150
|
+
}
|
|
151
|
+
function C(e) {
|
|
152
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
153
|
+
}
|
|
154
|
+
function X(e) {
|
|
155
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
156
|
+
}
|
|
157
|
+
function Y(e) {
|
|
158
|
+
const t = C(e || "");
|
|
159
|
+
if (!l.highlightKeyword || !f.value) return t;
|
|
160
|
+
const n = X(C(f.value));
|
|
161
|
+
return n ? t.replace(
|
|
162
|
+
new RegExp(`(${n})`, "ig"),
|
|
163
|
+
'<mark class="qy-search-input__mark">$1</mark>'
|
|
164
|
+
) : t;
|
|
165
|
+
}
|
|
166
|
+
function Z() {
|
|
167
|
+
var e, t;
|
|
168
|
+
(t = (e = r.value) == null ? void 0 : e.focus) == null || t.call(e);
|
|
169
|
+
}
|
|
170
|
+
function ee() {
|
|
171
|
+
var e, t;
|
|
172
|
+
(t = (e = r.value) == null ? void 0 : e.blur) == null || t.call(e);
|
|
173
|
+
}
|
|
174
|
+
function te() {
|
|
175
|
+
var e, t, n;
|
|
176
|
+
(n = (t = (e = r.value) == null ? void 0 : e.inputRef) == null ? void 0 : t.select) == null || n.call(t);
|
|
177
|
+
}
|
|
178
|
+
function ne() {
|
|
179
|
+
var e, t;
|
|
180
|
+
(t = (e = r.value) == null ? void 0 : e.clear) == null || t.call(e);
|
|
181
|
+
}
|
|
182
|
+
function le() {
|
|
183
|
+
var e, t;
|
|
184
|
+
(t = (e = r.value) == null ? void 0 : e.close) == null || t.call(e);
|
|
185
|
+
}
|
|
186
|
+
return T({
|
|
187
|
+
focus: Z,
|
|
188
|
+
blur: ee,
|
|
189
|
+
select: te,
|
|
190
|
+
clear: ne,
|
|
191
|
+
closePanel: le,
|
|
192
|
+
retryFetch: H
|
|
193
|
+
}), (e, t) => (V(), F("div", {
|
|
194
|
+
class: se(["qy-search-input", { "is-disabled": e.disabled }])
|
|
195
|
+
}, [
|
|
196
|
+
ie(B(he), M({
|
|
197
|
+
ref_key: "autocompleteRef",
|
|
198
|
+
ref: r
|
|
199
|
+
}, B(A), {
|
|
200
|
+
"model-value": z.value,
|
|
201
|
+
disabled: e.disabled,
|
|
202
|
+
placeholder: e.placeholder,
|
|
203
|
+
clearable: e.clearable,
|
|
204
|
+
debounce: e.debounce,
|
|
205
|
+
"fetch-suggestions": D,
|
|
206
|
+
"trigger-on-focus": e.triggerOnFocus,
|
|
207
|
+
teleported: e.teleported,
|
|
208
|
+
"fit-input-width": e.fitInputWidth,
|
|
209
|
+
"popper-class": O.value,
|
|
210
|
+
"append-to": e.appendTo,
|
|
211
|
+
"value-key": "value",
|
|
212
|
+
"onUpdate:modelValue": N,
|
|
213
|
+
onInput: q,
|
|
214
|
+
onChange: U,
|
|
215
|
+
onFocus: W,
|
|
216
|
+
onBlur: j,
|
|
217
|
+
onClear: x,
|
|
218
|
+
onSelect: J,
|
|
219
|
+
onKeydown: ce(G, ["enter"])
|
|
220
|
+
}), de({
|
|
221
|
+
append: i(() => [
|
|
222
|
+
e.$slots.append ? d(e.$slots, "append", { key: 0 }, void 0, !0) : (V(), fe(B(me), M({ key: 1 }, e.buttonProps, {
|
|
223
|
+
loading: e.loading,
|
|
224
|
+
disabled: e.disabled,
|
|
225
|
+
onClick: k
|
|
226
|
+
}), {
|
|
227
|
+
default: i(() => [
|
|
228
|
+
ge(I(e.buttonText), 1)
|
|
229
|
+
]),
|
|
230
|
+
_: 1
|
|
231
|
+
}, 16, ["loading", "disabled"]))
|
|
232
|
+
]),
|
|
233
|
+
default: i(({ item: n }) => [
|
|
234
|
+
d(e.$slots, "item", {
|
|
235
|
+
item: n,
|
|
236
|
+
keyword: f.value
|
|
237
|
+
}, () => [
|
|
238
|
+
E("div", ye, [
|
|
239
|
+
E("div", {
|
|
240
|
+
class: "qy-search-input__item-label",
|
|
241
|
+
innerHTML: Y(n.label || n.value || "")
|
|
242
|
+
}, null, 8, be),
|
|
243
|
+
n.description ? (V(), F("div", Ve, I(n.description), 1)) : pe("", !0)
|
|
244
|
+
])
|
|
245
|
+
], !0)
|
|
246
|
+
]),
|
|
247
|
+
_: 2
|
|
248
|
+
}, [
|
|
249
|
+
e.$slots.prefix ? {
|
|
250
|
+
name: "prefix",
|
|
251
|
+
fn: i(() => [
|
|
252
|
+
d(e.$slots, "prefix", {}, void 0, !0)
|
|
253
|
+
]),
|
|
254
|
+
key: "0"
|
|
255
|
+
} : void 0,
|
|
256
|
+
e.$slots.suffix ? {
|
|
257
|
+
name: "suffix",
|
|
258
|
+
fn: i(() => [
|
|
259
|
+
d(e.$slots, "suffix", {}, void 0, !0)
|
|
260
|
+
]),
|
|
261
|
+
key: "1"
|
|
262
|
+
} : void 0,
|
|
263
|
+
e.$slots.prepend ? {
|
|
264
|
+
name: "prepend",
|
|
265
|
+
fn: i(() => [
|
|
266
|
+
d(e.$slots, "prepend", {}, void 0, !0)
|
|
267
|
+
]),
|
|
268
|
+
key: "2"
|
|
269
|
+
} : void 0
|
|
270
|
+
]), 1040, ["model-value", "disabled", "placeholder", "clearable", "debounce", "trigger-on-focus", "teleported", "fit-input-width", "popper-class", "append-to"])
|
|
271
|
+
], 2));
|
|
272
|
+
}
|
|
273
|
+
}), Ce = /* @__PURE__ */ ve(Be, [["__scopeId", "data-v-47c6430a"]]);
|
|
274
|
+
export {
|
|
275
|
+
Ce as Q
|
|
276
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { defineComponent as F, useAttrs as K, ref as d, computed as R, watch as U, createBlock as N, openBlock as P, unref as p, mergeProps as Q, withKeys as _, createSlots as j, withCtx as r, renderSlot as i } from "vue";
|
|
2
|
+
import { ElInput as q } from "element-plus";
|
|
3
|
+
const H = F({
|
|
4
|
+
name: "QyInput",
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "index",
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: { default: "" },
|
|
9
|
+
removeSpace: { type: Boolean, default: !1 },
|
|
10
|
+
trimMode: { default: "none" }
|
|
11
|
+
},
|
|
12
|
+
emits: ["update:modelValue", "input", "change", "focus", "blur", "clear", "enter"],
|
|
13
|
+
setup(m, { expose: V, emit: h }) {
|
|
14
|
+
const l = m, t = h, v = K(), u = d(null), a = d(o(l.modelValue)), g = R(() => o(l.modelValue));
|
|
15
|
+
U(
|
|
16
|
+
() => l.modelValue,
|
|
17
|
+
(e) => {
|
|
18
|
+
a.value = o(e);
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
function o(e) {
|
|
22
|
+
return e == null ? "" : String(e);
|
|
23
|
+
}
|
|
24
|
+
function y(e) {
|
|
25
|
+
return l.removeSpace ? e.replace(/\s+/g, "") : e;
|
|
26
|
+
}
|
|
27
|
+
function f(e, n) {
|
|
28
|
+
return l.trimMode !== n ? e : e.trim();
|
|
29
|
+
}
|
|
30
|
+
function c(e) {
|
|
31
|
+
return y(o(e));
|
|
32
|
+
}
|
|
33
|
+
function s(e) {
|
|
34
|
+
a.value = e, t("update:modelValue", e);
|
|
35
|
+
}
|
|
36
|
+
function x(e) {
|
|
37
|
+
const n = c(e);
|
|
38
|
+
s(n);
|
|
39
|
+
}
|
|
40
|
+
function $(e) {
|
|
41
|
+
a.value = o(e), t("input", o(e));
|
|
42
|
+
}
|
|
43
|
+
function k(e) {
|
|
44
|
+
const n = f(c(e), "change");
|
|
45
|
+
n !== o(l.modelValue) && s(n), t("change", n);
|
|
46
|
+
}
|
|
47
|
+
function C(e) {
|
|
48
|
+
t("focus", e);
|
|
49
|
+
}
|
|
50
|
+
function I(e) {
|
|
51
|
+
const n = f(a.value, "blur");
|
|
52
|
+
n !== o(l.modelValue) && s(n), t("blur", e);
|
|
53
|
+
}
|
|
54
|
+
function S() {
|
|
55
|
+
a.value = "", t("update:modelValue", ""), t("clear");
|
|
56
|
+
}
|
|
57
|
+
function b(e) {
|
|
58
|
+
t("enter", e);
|
|
59
|
+
}
|
|
60
|
+
function z() {
|
|
61
|
+
var e, n;
|
|
62
|
+
(n = (e = u.value) == null ? void 0 : e.focus) == null || n.call(e);
|
|
63
|
+
}
|
|
64
|
+
function B() {
|
|
65
|
+
var e, n;
|
|
66
|
+
(n = (e = u.value) == null ? void 0 : e.blur) == null || n.call(e);
|
|
67
|
+
}
|
|
68
|
+
function w() {
|
|
69
|
+
var e, n;
|
|
70
|
+
(n = (e = u.value) == null ? void 0 : e.select) == null || n.call(e);
|
|
71
|
+
}
|
|
72
|
+
function M() {
|
|
73
|
+
var e, n;
|
|
74
|
+
(n = (e = u.value) == null ? void 0 : e.clear) == null || n.call(e);
|
|
75
|
+
}
|
|
76
|
+
function T() {
|
|
77
|
+
var e, n;
|
|
78
|
+
(n = (e = u.value) == null ? void 0 : e.resizeTextarea) == null || n.call(e);
|
|
79
|
+
}
|
|
80
|
+
function A() {
|
|
81
|
+
var e;
|
|
82
|
+
return ((e = u.value) == null ? void 0 : e.input) || null;
|
|
83
|
+
}
|
|
84
|
+
function E() {
|
|
85
|
+
var e;
|
|
86
|
+
return ((e = u.value) == null ? void 0 : e.textarea) || null;
|
|
87
|
+
}
|
|
88
|
+
return V({
|
|
89
|
+
focus: z,
|
|
90
|
+
blur: B,
|
|
91
|
+
select: w,
|
|
92
|
+
clear: M,
|
|
93
|
+
resizeTextarea: T,
|
|
94
|
+
getNativeInput: A,
|
|
95
|
+
getTextarea: E
|
|
96
|
+
}), (e, n) => (P(), N(p(q), Q({
|
|
97
|
+
ref_key: "inputRef",
|
|
98
|
+
ref: u
|
|
99
|
+
}, p(v), {
|
|
100
|
+
"model-value": g.value,
|
|
101
|
+
"onUpdate:modelValue": x,
|
|
102
|
+
onInput: $,
|
|
103
|
+
onChange: k,
|
|
104
|
+
onFocus: C,
|
|
105
|
+
onBlur: I,
|
|
106
|
+
onClear: S,
|
|
107
|
+
onKeydown: _(b, ["enter"])
|
|
108
|
+
}), j({ _: 2 }, [
|
|
109
|
+
e.$slots.prefix ? {
|
|
110
|
+
name: "prefix",
|
|
111
|
+
fn: r(() => [
|
|
112
|
+
i(e.$slots, "prefix")
|
|
113
|
+
]),
|
|
114
|
+
key: "0"
|
|
115
|
+
} : void 0,
|
|
116
|
+
e.$slots.suffix ? {
|
|
117
|
+
name: "suffix",
|
|
118
|
+
fn: r(() => [
|
|
119
|
+
i(e.$slots, "suffix")
|
|
120
|
+
]),
|
|
121
|
+
key: "1"
|
|
122
|
+
} : void 0,
|
|
123
|
+
e.$slots.prepend ? {
|
|
124
|
+
name: "prepend",
|
|
125
|
+
fn: r(() => [
|
|
126
|
+
i(e.$slots, "prepend")
|
|
127
|
+
]),
|
|
128
|
+
key: "2"
|
|
129
|
+
} : void 0,
|
|
130
|
+
e.$slots.append ? {
|
|
131
|
+
name: "append",
|
|
132
|
+
fn: r(() => [
|
|
133
|
+
i(e.$slots, "append")
|
|
134
|
+
]),
|
|
135
|
+
key: "3"
|
|
136
|
+
} : void 0
|
|
137
|
+
]), 1040, ["model-value"]));
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
export {
|
|
141
|
+
H as _
|
|
142
|
+
};
|