@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,16 +1,15 @@
|
|
|
1
|
-
import { defineComponent as U, useAttrs as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const _ = { class: "qy-record-quote-search" }, x = {
|
|
1
|
+
import { defineComponent as U, useAttrs as D, ref as M, computed as $, createElementBlock as i, openBlock as c, renderSlot as a, createVNode as I, 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 X from "../qy-search-input/index.vue.mjs";
|
|
3
|
+
const Y = { class: "qy-record-quote-search" }, x = {
|
|
5
4
|
key: 0,
|
|
6
5
|
class: "qy-record-quote-search__header"
|
|
7
|
-
},
|
|
6
|
+
}, _ = {
|
|
8
7
|
key: 0,
|
|
9
8
|
class: "qy-record-quote-search__label"
|
|
10
|
-
},
|
|
9
|
+
}, ee = {
|
|
11
10
|
key: 1,
|
|
12
11
|
class: "qy-record-quote-search__description"
|
|
13
|
-
},
|
|
12
|
+
}, ne = /* @__PURE__ */ U({
|
|
14
13
|
name: "QyRecordQuoteSearch",
|
|
15
14
|
inheritAttrs: !1,
|
|
16
15
|
__name: "index",
|
|
@@ -38,102 +37,102 @@ const _ = { class: "qy-record-quote-search" }, x = {
|
|
|
38
37
|
trimMode: { default: "blur" }
|
|
39
38
|
},
|
|
40
39
|
emits: ["update:modelValue", "search", "clear", "normalize", "enter", "select", "error", "success"],
|
|
41
|
-
setup(k, { expose: z, emit:
|
|
42
|
-
const o = k,
|
|
43
|
-
function
|
|
40
|
+
setup(k, { expose: z, emit: C }) {
|
|
41
|
+
const o = k, n = C, q = D(), r = M(null), h = M(!1), m = $(() => o.statusText || ""), B = $(() => o.loading || h.value);
|
|
42
|
+
function s(e) {
|
|
44
43
|
return e == null ? "" : String(e);
|
|
45
44
|
}
|
|
46
|
-
function
|
|
47
|
-
const t =
|
|
48
|
-
return
|
|
45
|
+
function E(e) {
|
|
46
|
+
const t = s(e).trim(), l = g(t), u = l.match(/BJ\d{8}[A-Z0-9]{4}/i);
|
|
47
|
+
return u ? u[0] : l;
|
|
49
48
|
}
|
|
50
49
|
function g(e) {
|
|
51
|
-
return
|
|
50
|
+
return s(e).replace(/\s+/g, "").trim().toUpperCase();
|
|
52
51
|
}
|
|
53
52
|
function y(e) {
|
|
54
|
-
return o.extractMethod ? o.extractMethod(e) :
|
|
53
|
+
return o.extractMethod ? o.extractMethod(e) : E(e);
|
|
55
54
|
}
|
|
56
55
|
function v(e) {
|
|
57
56
|
return o.normalizeMethod ? o.normalizeMethod(e) : g(e);
|
|
58
57
|
}
|
|
59
58
|
function b(e, t) {
|
|
60
|
-
const
|
|
61
|
-
return
|
|
62
|
-
rawValue:
|
|
59
|
+
const l = s(e), u = y(l), V = o.autoNormalize ? v(u) : u;
|
|
60
|
+
return n("normalize", { rawValue: l, code: V }), {
|
|
61
|
+
rawValue: l,
|
|
63
62
|
code: V,
|
|
64
63
|
item: t
|
|
65
64
|
};
|
|
66
65
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
66
|
+
function Q(e) {
|
|
67
|
+
n("update:modelValue", e);
|
|
69
68
|
}
|
|
70
69
|
async function S(e) {
|
|
71
|
-
if (
|
|
70
|
+
if (n("search", e), !!o.searchMethod) {
|
|
72
71
|
h.value = !0;
|
|
73
72
|
try {
|
|
74
73
|
const t = await o.searchMethod(e);
|
|
75
|
-
|
|
74
|
+
n("success", t);
|
|
76
75
|
} catch (t) {
|
|
77
|
-
|
|
76
|
+
n("error", t);
|
|
78
77
|
} finally {
|
|
79
78
|
h.value = !1;
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
|
-
function
|
|
82
|
+
function N(e) {
|
|
84
83
|
const t = b(e);
|
|
85
|
-
t.code !==
|
|
84
|
+
t.code !== s(o.modelValue) && n("update:modelValue", t.code), S(t);
|
|
86
85
|
}
|
|
87
|
-
function
|
|
88
|
-
|
|
86
|
+
function O() {
|
|
87
|
+
n("clear");
|
|
89
88
|
}
|
|
90
|
-
function
|
|
91
|
-
|
|
89
|
+
function T(e) {
|
|
90
|
+
n("enter", e);
|
|
92
91
|
}
|
|
93
|
-
function
|
|
94
|
-
if (
|
|
92
|
+
function w(e) {
|
|
93
|
+
if (n("select", e), !o.searchOnSelect) return;
|
|
95
94
|
const t = b(e.value, e);
|
|
96
|
-
t.code !==
|
|
95
|
+
t.code !== s(o.modelValue) && n("update:modelValue", t.code), S(t);
|
|
97
96
|
}
|
|
98
|
-
function
|
|
99
|
-
|
|
97
|
+
function F(e) {
|
|
98
|
+
n("error", e);
|
|
100
99
|
}
|
|
101
|
-
function
|
|
100
|
+
function L() {
|
|
102
101
|
var e, t;
|
|
103
|
-
(t = (e =
|
|
102
|
+
(t = (e = r.value) == null ? void 0 : e.focus) == null || t.call(e);
|
|
104
103
|
}
|
|
105
|
-
function
|
|
104
|
+
function P() {
|
|
106
105
|
var e, t;
|
|
107
|
-
(t = (e =
|
|
106
|
+
(t = (e = r.value) == null ? void 0 : e.blur) == null || t.call(e);
|
|
108
107
|
}
|
|
109
|
-
function
|
|
108
|
+
function R() {
|
|
110
109
|
var e, t;
|
|
111
|
-
(t = (e =
|
|
110
|
+
(t = (e = r.value) == null ? void 0 : e.select) == null || t.call(e);
|
|
112
111
|
}
|
|
113
|
-
function
|
|
112
|
+
function A() {
|
|
114
113
|
var e, t;
|
|
115
|
-
(t = (e =
|
|
114
|
+
(t = (e = r.value) == null ? void 0 : e.clear) == null || t.call(e);
|
|
116
115
|
}
|
|
117
116
|
return z({
|
|
118
|
-
focus:
|
|
119
|
-
blur:
|
|
120
|
-
select:
|
|
121
|
-
clear:
|
|
117
|
+
focus: L,
|
|
118
|
+
blur: P,
|
|
119
|
+
select: R,
|
|
120
|
+
clear: A,
|
|
122
121
|
extractQuoteOrderCode: y,
|
|
123
122
|
normalizeQuoteOrderCode: v
|
|
124
|
-
}), (e, t) => (c(), i("div",
|
|
125
|
-
|
|
123
|
+
}), (e, t) => (c(), i("div", Y, [
|
|
124
|
+
a(e.$slots, "label", {}, () => [
|
|
126
125
|
e.label || e.description ? (c(), i("div", x, [
|
|
127
|
-
e.label ? (c(), i("div",
|
|
128
|
-
e.description ? (c(), i("div",
|
|
126
|
+
e.label ? (c(), i("div", _, p(e.label), 1)) : f("", !0),
|
|
127
|
+
e.description ? (c(), i("div", ee, p(e.description), 1)) : f("", !0)
|
|
129
128
|
])) : f("", !0)
|
|
130
129
|
], !0),
|
|
131
|
-
|
|
130
|
+
I(X, J({
|
|
132
131
|
ref_key: "searchRef",
|
|
133
|
-
ref:
|
|
134
|
-
}, Z(
|
|
132
|
+
ref: r
|
|
133
|
+
}, Z(q), {
|
|
135
134
|
"model-value": e.modelValue,
|
|
136
|
-
loading:
|
|
135
|
+
loading: B.value,
|
|
137
136
|
disabled: e.disabled,
|
|
138
137
|
placeholder: e.placeholder,
|
|
139
138
|
"remove-space": !0,
|
|
@@ -145,50 +144,50 @@ const _ = { class: "qy-record-quote-search" }, x = {
|
|
|
145
144
|
debounce: e.debounce,
|
|
146
145
|
"min-length": e.minLength,
|
|
147
146
|
"search-on-select": !1,
|
|
148
|
-
"onUpdate:modelValue":
|
|
149
|
-
onSearch:
|
|
150
|
-
onClear:
|
|
151
|
-
onEnter:
|
|
152
|
-
onSelect:
|
|
153
|
-
onError:
|
|
147
|
+
"onUpdate:modelValue": Q,
|
|
148
|
+
onSearch: N,
|
|
149
|
+
onClear: O,
|
|
150
|
+
onEnter: T,
|
|
151
|
+
onSelect: w,
|
|
152
|
+
onError: F
|
|
154
153
|
}), j({ _: 2 }, [
|
|
155
154
|
e.$slots.prefix ? {
|
|
156
155
|
name: "prefix",
|
|
157
156
|
fn: d(() => [
|
|
158
|
-
|
|
157
|
+
a(e.$slots, "prefix", {}, void 0, !0)
|
|
159
158
|
]),
|
|
160
159
|
key: "0"
|
|
161
160
|
} : void 0,
|
|
162
161
|
e.$slots.suffix ? {
|
|
163
162
|
name: "suffix",
|
|
164
163
|
fn: d(() => [
|
|
165
|
-
|
|
164
|
+
a(e.$slots, "suffix", {}, void 0, !0)
|
|
166
165
|
]),
|
|
167
166
|
key: "1"
|
|
168
167
|
} : void 0,
|
|
169
168
|
e.$slots.item ? {
|
|
170
169
|
name: "item",
|
|
171
|
-
fn: d((
|
|
172
|
-
|
|
170
|
+
fn: d((l) => [
|
|
171
|
+
a(e.$slots, "item", G(H(l)), void 0, !0)
|
|
173
172
|
]),
|
|
174
173
|
key: "2"
|
|
175
174
|
} : void 0,
|
|
176
175
|
e.$slots.empty ? {
|
|
177
176
|
name: "empty",
|
|
178
177
|
fn: d(() => [
|
|
179
|
-
|
|
178
|
+
a(e.$slots, "empty", {}, void 0, !0)
|
|
180
179
|
]),
|
|
181
180
|
key: "3"
|
|
182
181
|
} : void 0,
|
|
183
182
|
e.$slots.loading ? {
|
|
184
183
|
name: "loading",
|
|
185
184
|
fn: d(() => [
|
|
186
|
-
|
|
185
|
+
a(e.$slots, "loading", {}, void 0, !0)
|
|
187
186
|
]),
|
|
188
187
|
key: "4"
|
|
189
188
|
} : void 0
|
|
190
189
|
]), 1040, ["model-value", "loading", "disabled", "placeholder", "trim-mode", "button-text", "suggestions", "fetch-suggestions", "fetch-suggestions-method", "debounce", "min-length"]),
|
|
191
|
-
e.showStatus && m.value ?
|
|
190
|
+
e.showStatus && m.value ? a(e.$slots, "status", {
|
|
192
191
|
key: 0,
|
|
193
192
|
status: e.status,
|
|
194
193
|
statusText: m.value
|
|
@@ -199,7 +198,7 @@ const _ = { class: "qy-record-quote-search" }, x = {
|
|
|
199
198
|
], !0) : f("", !0)
|
|
200
199
|
]));
|
|
201
200
|
}
|
|
202
|
-
})
|
|
201
|
+
});
|
|
203
202
|
export {
|
|
204
|
-
|
|
203
|
+
ne as default
|
|
205
204
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),P=require("../qy-select/index.vue.cjs"),U=l.defineComponent({name:"QyRemoteSelect",inheritAttrs:!1,__name:"index",props:{modelValue:{type:[String,Number,Boolean,Array,null],default:void 0},fetchMethod:{},defaultOptions:{default:()=>[]},labelKey:{default:"label"},valueKey:{default:"value"},disabledKey:{default:"disabled"},placeholder:{default:"请选择"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},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:""},debounce:{default:300},minLength:{default:1},remoteOnFocus:{type:Boolean,default:!1},remoteShowSuffix:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},reserveSelectedOption:{type:Boolean,default:!0}},emits:["update:modelValue","change","clear","visible-change","focus","blur","options-change","loading-change","error"],setup(S,{expose:O,emit:B}){const t=S,o=B,V=l.useAttrs(),p=l.ref(null),s=l.ref([]),v=l.ref(new Map),m=l.ref(!1),d=l.ref("");let i=0,u=null;const C=l.computed(()=>t.loading||m.value),h=l.ref(!1),r=l.computed(()=>{const e=new Map,a=n=>{e.set(y(n),n)};return t.defaultOptions.forEach(a),t.reserveSelectedOption&&v.value.forEach(n=>a(n)),s.value.forEach(a),Array.from(e.values())});l.watch(()=>t.defaultOptions,e=>{e.forEach(f)},{immediate:!0}),l.watch(()=>t.modelValue,()=>{r.value.forEach(f)},{immediate:!0});function y(e){return(e==null?void 0:e[t.valueKey])??(e==null?void 0:e.value)??(e==null?void 0:e.label)}function w(e){return Array.isArray(t.modelValue)?t.modelValue.includes(e):t.modelValue===e}function f(e){if(!t.reserveSelectedOption)return;const a=y(e);w(a)&&v.value.set(a,e)}function T(e){return t.disabled?!1:e?e.length>=t.minLength:t.remoteOnFocus}function g(e){m.value!==e&&(m.value=e,o("loading-change",e))}async function c(e){if(d.value=e,!T(e)){i+=1,s.value=[],g(!1),o("options-change",r.value);return}const a=++i;g(!0);try{const n=await t.fetchMethod(e);if(a!==i)return;s.value=Array.isArray(n)?n:[],s.value.forEach(f),o("options-change",r.value)}catch(n){if(a!==i)return;s.value=[],o("error",n),o("options-change",r.value)}finally{a===i&&g(!1)}}function b(){h.value||(h.value=!0,c(""))}function k(e){u&&(clearTimeout(u),u=null),u=setTimeout(()=>{c(e)},t.debounce)}function F(){h.value=!0,c("")}function $(){c(d.value)}function M(e){o("update:modelValue",e)}function A(e){r.value.forEach(f),o("change",e)}function K(){o("clear")}function E(e){e&&t.remoteOnFocus&&!d.value&&b(),o("visible-change",e)}function I(e){t.remoteOnFocus&&!d.value&&b(),o("focus",e)}function R(e){o("blur",e)}function z(){var e,a;(a=(e=p.value)==null?void 0:e.focus)==null||a.call(e)}function L(){var e,a;(a=(e=p.value)==null?void 0:e.blur)==null||a.call(e)}function q(){o("update:modelValue",t.multiple?[]:""),o("clear")}return l.onBeforeUnmount(()=>{u&&clearTimeout(u)}),O({focus:z,blur:L,clear:q,retryFetch:$,fetchDefaultOptions:F}),(e,a)=>(l.openBlock(),l.createBlock(P.default,l.mergeProps({ref_key:"selectRef",ref:p},l.unref(V),{"model-value":e.modelValue,options:r.value,"label-key":e.labelKey,"value-key":e.valueKey,"disabled-key":e.disabledKey,placeholder:e.placeholder,disabled:e.disabled,clearable:e.clearable,filterable:!0,multiple:e.multiple,"collapse-tags":e.collapseTags,"collapse-tags-tooltip":e.collapseTagsTooltip,"auto-select-single":e.autoSelectSingle,size:e.size,teleported:e.teleported,"append-to":e.appendTo,"fit-input-width":e.fitInputWidth,"popper-class":e.popperClass,remote:"","remote-show-suffix":e.remoteShowSuffix,"remote-method":k,loading:C.value,"onUpdate:modelValue":M,onChange:A,onClear:K,onVisibleChange:E,onFocus:I,onBlur:R}),l.createSlots({default:l.withCtx(()=>[e.$slots.default?l.renderSlot(e.$slots,"default",{key:0}):l.createCommentVNode("",!0)]),_: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(n=>[l.renderSlot(e.$slots,"tag",l.normalizeProps(l.guardReactiveProps(n)))]),key:"3"}:void 0]),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"]))}});exports.default=U;
|
|
@@ -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;
|
|
@@ -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-9fedf1a9"]]);exports.default=u;
|
|
@@ -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;
|