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