api-dict-select 0.1.0 → 0.1.1
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 +2 -2
- package/dist/index.js +0 -214
- package/dist/index.umd.cjs +0 -1
- package/dist/types/DictSelect.vue.d.ts +0 -92
- package/dist/types/cache.d.ts +0 -7
- package/dist/types/index.d.ts +0 -10
- package/dist/types/types.d.ts +0 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# `
|
|
1
|
+
# `dict-select`
|
|
2
2
|
|
|
3
3
|
一个可复用的下拉组件。传入接口方法后自动请求选项数据,支持缓存、联动参数、`label` 回传和多选。
|
|
4
4
|
|
|
@@ -38,7 +38,7 @@ npm publish --registry=http://your-registry
|
|
|
38
38
|
```ts
|
|
39
39
|
import { createApp } from 'vue';
|
|
40
40
|
import ElementPlus from 'element-plus';
|
|
41
|
-
import DictSelect from '
|
|
41
|
+
import DictSelect from 'dict-select';
|
|
42
42
|
import 'element-plus/dist/index.css';
|
|
43
43
|
|
|
44
44
|
const app = createApp(App);
|
package/dist/index.js
CHANGED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { defineComponent as z, useModel as p, ref as B, computed as U, watch as v, resolveComponent as D, openBlock as M, createBlock as L, withCtx as _, createElementBlock as G, Fragment as H, renderList as P, mergeModels as N } from "vue";
|
|
2
|
-
const O = /* @__PURE__ */ new Map(), Q = () => O, W = (u) => {
|
|
3
|
-
if (u) {
|
|
4
|
-
O.delete(u);
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
O.clear();
|
|
8
|
-
}, I = /* @__PURE__ */ z({
|
|
9
|
-
__name: "DictSelect",
|
|
10
|
-
props: /* @__PURE__ */ N({
|
|
11
|
-
placeholder: { default: "全部" },
|
|
12
|
-
disabled: { type: Boolean, default: !1 },
|
|
13
|
-
optionLabel: { default: "k" },
|
|
14
|
-
optionValue: { default: "v" },
|
|
15
|
-
optionDisabledField: { default: "text" },
|
|
16
|
-
optionDisabledValue: { type: [String, Number, Boolean], default: "disable" },
|
|
17
|
-
filter: { type: Boolean, default: !1 },
|
|
18
|
-
clearable: { type: Boolean, default: !0 },
|
|
19
|
-
vModelToNumber: { type: Boolean, default: !1 },
|
|
20
|
-
vModelToString: { type: Boolean, default: !1 },
|
|
21
|
-
isBuffer: { type: Boolean, default: !0 },
|
|
22
|
-
isLabel: { type: Boolean, default: !1 },
|
|
23
|
-
api: {},
|
|
24
|
-
mock: { default: () => [] },
|
|
25
|
-
multiple: { type: Boolean, default: !1 },
|
|
26
|
-
param: { default: () => ({}) },
|
|
27
|
-
callApiIfNeeded: { type: Boolean, default: !0 },
|
|
28
|
-
cacheKey: { default: "" },
|
|
29
|
-
transform: { type: Function, default: void 0 },
|
|
30
|
-
immediate: { type: Boolean, default: !0 },
|
|
31
|
-
autoClearInvalidValue: { type: Boolean, default: !0 }
|
|
32
|
-
}, {
|
|
33
|
-
modelValue: {},
|
|
34
|
-
modelModifiers: {},
|
|
35
|
-
options: {},
|
|
36
|
-
optionsModifiers: {},
|
|
37
|
-
response: {},
|
|
38
|
-
responseModifiers: {},
|
|
39
|
-
loading: { type: Boolean },
|
|
40
|
-
loadingModifiers: {},
|
|
41
|
-
selectedOption: {},
|
|
42
|
-
selectedOptionModifiers: {}
|
|
43
|
-
}),
|
|
44
|
-
emits: /* @__PURE__ */ N(["label", "allData", "options", "loaded", "error", "onClear"], ["update:modelValue", "update:options", "update:response", "update:loading", "update:selectedOption"]),
|
|
45
|
-
setup(u, { expose: w, emit: T }) {
|
|
46
|
-
const e = u, n = p(u, "modelValue"), A = p(u, "options"), K = p(u, "response"), E = p(u, "loading"), k = p(u, "selectedOption"), o = B([]), m = B(!1), d = B(), g = Q();
|
|
47
|
-
let y = 0;
|
|
48
|
-
const c = T, C = (l) => {
|
|
49
|
-
var a, i, t;
|
|
50
|
-
return ((a = l == null ? void 0 : l.result) == null ? void 0 : a.list) || ((i = l == null ? void 0 : l.result) == null ? void 0 : i.data) || ((t = l == null ? void 0 : l.result) == null ? void 0 : t.result) || (l == null ? void 0 : l.result) || (l == null ? void 0 : l.data) || l || [];
|
|
51
|
-
}, F = () => !e.param || Object.keys(e.param).length === 0 ? !0 : Object.values(e.param).every(
|
|
52
|
-
(l) => l != null && l !== ""
|
|
53
|
-
), S = () => {
|
|
54
|
-
var a;
|
|
55
|
-
return `${e.cacheKey || ((a = e.api) == null ? void 0 : a.name) || "dict-select"}:${JSON.stringify(e.param || {})}`;
|
|
56
|
-
}, f = () => e.multiple ? Array.isArray(n.value) ? o.value.filter(
|
|
57
|
-
(l) => n.value.includes(l[e.optionValue])
|
|
58
|
-
) : [] : o.value.find(
|
|
59
|
-
(l) => l[e.optionValue] === n.value
|
|
60
|
-
), s = () => {
|
|
61
|
-
A.value = o.value, K.value = d.value, E.value = m.value, k.value = f();
|
|
62
|
-
}, j = (l) => {
|
|
63
|
-
e.vModelToNumber && l.forEach((a) => {
|
|
64
|
-
a[e.optionValue] = Number(a[e.optionValue]);
|
|
65
|
-
}), e.vModelToString && l.forEach((a) => {
|
|
66
|
-
a[e.optionValue] = String(a[e.optionValue]);
|
|
67
|
-
});
|
|
68
|
-
}, J = () => {
|
|
69
|
-
if (!e.autoClearInvalidValue)
|
|
70
|
-
return;
|
|
71
|
-
if (e.multiple) {
|
|
72
|
-
if (Array.isArray(n.value) && n.value.length > 0) {
|
|
73
|
-
const a = n.value.filter(
|
|
74
|
-
(i) => o.value.some((t) => t[e.optionValue] === i)
|
|
75
|
-
);
|
|
76
|
-
a.length !== n.value.length && (n.value = a);
|
|
77
|
-
}
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
o.value.findIndex(
|
|
81
|
-
(a) => a[e.optionValue] === n.value
|
|
82
|
-
) === -1 && (n.value = void 0);
|
|
83
|
-
}, R = () => {
|
|
84
|
-
c("onClear");
|
|
85
|
-
}, b = (l, a, i) => {
|
|
86
|
-
o.value = l, d.value = a, j(o.value), J(), s(), c("loaded", {
|
|
87
|
-
options: o.value,
|
|
88
|
-
response: d.value,
|
|
89
|
-
fromCache: i
|
|
90
|
-
});
|
|
91
|
-
}, V = async (l = !1) => {
|
|
92
|
-
if (e.mock.length > 0) {
|
|
93
|
-
b(e.mock, e.mock, !1);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (!e.api) {
|
|
97
|
-
o.value = [], d.value = void 0, s();
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (!e.callApiIfNeeded || !F()) {
|
|
101
|
-
o.value = [], d.value = void 0, s();
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
const a = S();
|
|
105
|
-
if (!l && e.isBuffer && g.has(a)) {
|
|
106
|
-
const t = g.get(a);
|
|
107
|
-
b((t == null ? void 0 : t.options) || [], t == null ? void 0 : t.response, !0);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const i = ++y;
|
|
111
|
-
m.value = !0, s();
|
|
112
|
-
try {
|
|
113
|
-
const t = await e.api(e.param);
|
|
114
|
-
if (i !== y)
|
|
115
|
-
return;
|
|
116
|
-
const r = e.transform ? e.transform(C(t), t) : C(t), x = Array.isArray(r) ? r : [];
|
|
117
|
-
e.isBuffer && g.set(a, {
|
|
118
|
-
options: x,
|
|
119
|
-
response: t
|
|
120
|
-
}), b(x, t, !1);
|
|
121
|
-
} catch (t) {
|
|
122
|
-
if (i !== y)
|
|
123
|
-
return;
|
|
124
|
-
c("error", t), o.value = [], d.value = void 0, s();
|
|
125
|
-
} finally {
|
|
126
|
-
i === y && (m.value = !1, s());
|
|
127
|
-
}
|
|
128
|
-
}, q = async (l = !0) => {
|
|
129
|
-
await V(l);
|
|
130
|
-
}, $ = () => {
|
|
131
|
-
W(S());
|
|
132
|
-
}, h = U(() => {
|
|
133
|
-
if (e.multiple) {
|
|
134
|
-
const a = f();
|
|
135
|
-
return Array.isArray(a) ? a.map((i) => i[e.optionLabel]) : [];
|
|
136
|
-
}
|
|
137
|
-
const l = f();
|
|
138
|
-
return !l || Array.isArray(l) ? "" : l[e.optionLabel] ?? "";
|
|
139
|
-
});
|
|
140
|
-
return v(
|
|
141
|
-
() => o.value,
|
|
142
|
-
() => {
|
|
143
|
-
c("options", o.value), A.value = o.value;
|
|
144
|
-
}
|
|
145
|
-
), v(
|
|
146
|
-
() => e.mock,
|
|
147
|
-
() => {
|
|
148
|
-
if (e.mock.length > 0) {
|
|
149
|
-
b(e.mock, e.mock, !1);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
e.api || (o.value = [], d.value = void 0, s());
|
|
153
|
-
}
|
|
154
|
-
), v(
|
|
155
|
-
() => e.api,
|
|
156
|
-
() => {
|
|
157
|
-
e.immediate && V();
|
|
158
|
-
},
|
|
159
|
-
{ immediate: e.immediate }
|
|
160
|
-
), v(
|
|
161
|
-
() => e.param,
|
|
162
|
-
(l, a) => {
|
|
163
|
-
JSON.stringify(l) !== JSON.stringify(a) && V();
|
|
164
|
-
},
|
|
165
|
-
{ deep: !0 }
|
|
166
|
-
), v(
|
|
167
|
-
() => [n.value, o.value],
|
|
168
|
-
() => {
|
|
169
|
-
const l = f();
|
|
170
|
-
k.value = l, e.isLabel && c(
|
|
171
|
-
"label",
|
|
172
|
-
Array.isArray(h.value) ? h.value.join(",") : h.value
|
|
173
|
-
), c("allData", l);
|
|
174
|
-
},
|
|
175
|
-
{ immediate: !0, deep: !0 }
|
|
176
|
-
), w({
|
|
177
|
-
refresh: q,
|
|
178
|
-
clearCache: $,
|
|
179
|
-
getOptions: () => o.value,
|
|
180
|
-
getResponse: () => d.value,
|
|
181
|
-
getSelectedOption: f
|
|
182
|
-
}), (l, a) => {
|
|
183
|
-
const i = D("el-option"), t = D("el-select");
|
|
184
|
-
return M(), L(t, {
|
|
185
|
-
modelValue: n.value,
|
|
186
|
-
"onUpdate:modelValue": a[0] || (a[0] = (r) => n.value = r),
|
|
187
|
-
filterable: e.filter,
|
|
188
|
-
disabled: e.disabled,
|
|
189
|
-
placeholder: e.placeholder,
|
|
190
|
-
clearable: e.clearable,
|
|
191
|
-
multiple: e.multiple,
|
|
192
|
-
loading: m.value,
|
|
193
|
-
onClear: R
|
|
194
|
-
}, {
|
|
195
|
-
default: _(() => [
|
|
196
|
-
(M(!0), G(H, null, P(o.value, (r) => (M(), L(i, {
|
|
197
|
-
key: r[e.optionValue],
|
|
198
|
-
label: r[e.optionLabel],
|
|
199
|
-
value: r[e.optionValue],
|
|
200
|
-
disabled: r[e.optionDisabledField] === e.optionDisabledValue
|
|
201
|
-
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
202
|
-
]),
|
|
203
|
-
_: 1
|
|
204
|
-
}, 8, ["modelValue", "filterable", "disabled", "placeholder", "clearable", "multiple", "loading"]);
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
}), X = I;
|
|
208
|
-
X.install = (u) => {
|
|
209
|
-
u.component("DictSelect", I);
|
|
210
|
-
};
|
|
211
|
-
export {
|
|
212
|
-
I as DictSelect,
|
|
213
|
-
X as default
|
|
214
|
-
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.DictSelect={},s.Vue))})(this,function(s,t){"use strict";const g=new Map,w=()=>g,x=r=>{if(r){g.delete(r);return}g.clear()},h=t.defineComponent({__name:"DictSelect",props:t.mergeModels({placeholder:{default:"全部"},disabled:{type:Boolean,default:!1},optionLabel:{default:"k"},optionValue:{default:"v"},optionDisabledField:{default:"text"},optionDisabledValue:{type:[String,Number,Boolean],default:"disable"},filter:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},vModelToNumber:{type:Boolean,default:!1},vModelToString:{type:Boolean,default:!1},isBuffer:{type:Boolean,default:!0},isLabel:{type:Boolean,default:!1},api:{},mock:{default:()=>[]},multiple:{type:Boolean,default:!1},param:{default:()=>({})},callApiIfNeeded:{type:Boolean,default:!0},cacheKey:{default:""},transform:{type:Function,default:void 0},immediate:{type:Boolean,default:!0},autoClearInvalidValue:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{},options:{},optionsModifiers:{},response:{},responseModifiers:{},loading:{type:Boolean},loadingModifiers:{},selectedOption:{},selectedOptionModifiers:{}}),emits:t.mergeModels(["label","allData","options","loaded","error","onClear"],["update:modelValue","update:options","update:response","update:loading","update:selectedOption"]),setup(r,{expose:L,emit:N}){const e=r,u=t.useModel(r,"modelValue"),O=t.useModel(r,"options"),T=t.useModel(r,"response"),I=t.useModel(r,"loading"),A=t.useModel(r,"selectedOption"),i=t.ref([]),v=t.ref(!1),c=t.ref(),V=w();let y=0;const p=N,C=l=>{var a,n,o;return((a=l==null?void 0:l.result)==null?void 0:a.list)||((n=l==null?void 0:l.result)==null?void 0:n.data)||((o=l==null?void 0:l.result)==null?void 0:o.result)||(l==null?void 0:l.result)||(l==null?void 0:l.data)||l||[]},j=()=>!e.param||Object.keys(e.param).length===0?!0:Object.values(e.param).every(l=>l!=null&&l!==""),S=()=>{var a;return`${e.cacheKey||((a=e.api)==null?void 0:a.name)||"dict-select"}:${JSON.stringify(e.param||{})}`},m=()=>e.multiple?Array.isArray(u.value)?i.value.filter(l=>u.value.includes(l[e.optionValue])):[]:i.value.find(l=>l[e.optionValue]===u.value),f=()=>{O.value=i.value,T.value=c.value,I.value=v.value,A.value=m()},K=l=>{e.vModelToNumber&&l.forEach(a=>{a[e.optionValue]=Number(a[e.optionValue])}),e.vModelToString&&l.forEach(a=>{a[e.optionValue]=String(a[e.optionValue])})},E=()=>{if(!e.autoClearInvalidValue)return;if(e.multiple){if(Array.isArray(u.value)&&u.value.length>0){const a=u.value.filter(n=>i.value.some(o=>o[e.optionValue]===n));a.length!==u.value.length&&(u.value=a)}return}i.value.findIndex(a=>a[e.optionValue]===u.value)===-1&&(u.value=void 0)},F=()=>{p("onClear")},b=(l,a,n)=>{i.value=l,c.value=a,K(i.value),E(),f(),p("loaded",{options:i.value,response:c.value,fromCache:n})},M=async(l=!1)=>{if(e.mock.length>0){b(e.mock,e.mock,!1);return}if(!e.api){i.value=[],c.value=void 0,f();return}if(!e.callApiIfNeeded||!j()){i.value=[],c.value=void 0,f();return}const a=S();if(!l&&e.isBuffer&&V.has(a)){const o=V.get(a);b((o==null?void 0:o.options)||[],o==null?void 0:o.response,!0);return}const n=++y;v.value=!0,f();try{const o=await e.api(e.param);if(n!==y)return;const d=e.transform?e.transform(C(o),o):C(o),D=Array.isArray(d)?d:[];e.isBuffer&&V.set(a,{options:D,response:o}),b(D,o,!1)}catch(o){if(n!==y)return;p("error",o),i.value=[],c.value=void 0,f()}finally{n===y&&(v.value=!1,f())}},q=async(l=!0)=>{await M(l)},J=()=>{x(S())},B=t.computed(()=>{if(e.multiple){const a=m();return Array.isArray(a)?a.map(n=>n[e.optionLabel]):[]}const l=m();return!l||Array.isArray(l)?"":l[e.optionLabel]??""});return t.watch(()=>i.value,()=>{p("options",i.value),O.value=i.value}),t.watch(()=>e.mock,()=>{if(e.mock.length>0){b(e.mock,e.mock,!1);return}e.api||(i.value=[],c.value=void 0,f())}),t.watch(()=>e.api,()=>{e.immediate&&M()},{immediate:e.immediate}),t.watch(()=>e.param,(l,a)=>{JSON.stringify(l)!==JSON.stringify(a)&&M()},{deep:!0}),t.watch(()=>[u.value,i.value],()=>{const l=m();A.value=l,e.isLabel&&p("label",Array.isArray(B.value)?B.value.join(","):B.value),p("allData",l)},{immediate:!0,deep:!0}),L({refresh:q,clearCache:J,getOptions:()=>i.value,getResponse:()=>c.value,getSelectedOption:m}),(l,a)=>{const n=t.resolveComponent("el-option"),o=t.resolveComponent("el-select");return t.openBlock(),t.createBlock(o,{modelValue:u.value,"onUpdate:modelValue":a[0]||(a[0]=d=>u.value=d),filterable:e.filter,disabled:e.disabled,placeholder:e.placeholder,clearable:e.clearable,multiple:e.multiple,loading:v.value,onClear:F},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value,d=>(t.openBlock(),t.createBlock(n,{key:d[e.optionValue],label:d[e.optionLabel],value:d[e.optionValue],disabled:d[e.optionDisabledField]===e.optionDisabledValue},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue","filterable","disabled","placeholder","clearable","multiple","loading"])}}}),k=h;k.install=r=>{r.component("DictSelect",h)},s.DictSelect=h,s.default=k,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import type { ApiFunction, OptionItem, TransformFunction } from './types';
|
|
2
|
-
type __VLS_Props = {
|
|
3
|
-
placeholder?: string;
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
optionLabel?: string;
|
|
6
|
-
optionValue?: string;
|
|
7
|
-
optionDisabledField?: string;
|
|
8
|
-
optionDisabledValue?: string | number | boolean;
|
|
9
|
-
filter?: boolean;
|
|
10
|
-
clearable?: boolean;
|
|
11
|
-
vModelToNumber?: boolean;
|
|
12
|
-
vModelToString?: boolean;
|
|
13
|
-
isBuffer?: boolean;
|
|
14
|
-
isLabel?: boolean;
|
|
15
|
-
api?: ApiFunction;
|
|
16
|
-
mock?: OptionItem[];
|
|
17
|
-
multiple?: boolean;
|
|
18
|
-
param?: Record<string, any>;
|
|
19
|
-
callApiIfNeeded?: boolean;
|
|
20
|
-
cacheKey?: string;
|
|
21
|
-
transform?: TransformFunction;
|
|
22
|
-
immediate?: boolean;
|
|
23
|
-
autoClearInvalidValue?: boolean;
|
|
24
|
-
};
|
|
25
|
-
type __VLS_PublicProps = __VLS_Props & {
|
|
26
|
-
modelValue?: any;
|
|
27
|
-
'options'?: OptionItem[] | undefined;
|
|
28
|
-
'response'?: any;
|
|
29
|
-
'loading'?: boolean | undefined;
|
|
30
|
-
'selectedOption'?: OptionItem | OptionItem[] | undefined;
|
|
31
|
-
};
|
|
32
|
-
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
33
|
-
refresh: (force?: boolean) => Promise<void>;
|
|
34
|
-
clearCache: () => void;
|
|
35
|
-
getOptions: () => OptionItem[];
|
|
36
|
-
getResponse: () => any;
|
|
37
|
-
getSelectedOption: () => OptionItem | OptionItem[] | undefined;
|
|
38
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
39
|
-
options: (args_0: OptionItem[]) => any;
|
|
40
|
-
label: (args_0: string) => any;
|
|
41
|
-
allData: (args_0: OptionItem | OptionItem[] | undefined) => any;
|
|
42
|
-
loaded: (args_0: {
|
|
43
|
-
options: OptionItem[];
|
|
44
|
-
response: any;
|
|
45
|
-
fromCache: boolean;
|
|
46
|
-
}) => any;
|
|
47
|
-
error: (args_0: unknown) => any;
|
|
48
|
-
onClear: () => any;
|
|
49
|
-
"update:modelValue": (value: any) => any;
|
|
50
|
-
"update:options": (value: OptionItem[] | undefined) => any;
|
|
51
|
-
"update:response": (value: any) => any;
|
|
52
|
-
"update:loading": (value: boolean | undefined) => any;
|
|
53
|
-
"update:selectedOption": (value: OptionItem | OptionItem[] | undefined) => any;
|
|
54
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
55
|
-
onOptions?: ((args_0: OptionItem[]) => any) | undefined;
|
|
56
|
-
onLabel?: ((args_0: string) => any) | undefined;
|
|
57
|
-
onAllData?: ((args_0: OptionItem | OptionItem[] | undefined) => any) | undefined;
|
|
58
|
-
onLoaded?: ((args_0: {
|
|
59
|
-
options: OptionItem[];
|
|
60
|
-
response: any;
|
|
61
|
-
fromCache: boolean;
|
|
62
|
-
}) => any) | undefined;
|
|
63
|
-
onError?: ((args_0: unknown) => any) | undefined;
|
|
64
|
-
onOnClear?: (() => any) | undefined;
|
|
65
|
-
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
66
|
-
"onUpdate:options"?: ((value: OptionItem[] | undefined) => any) | undefined;
|
|
67
|
-
"onUpdate:response"?: ((value: any) => any) | undefined;
|
|
68
|
-
"onUpdate:loading"?: ((value: boolean | undefined) => any) | undefined;
|
|
69
|
-
"onUpdate:selectedOption"?: ((value: OptionItem | OptionItem[] | undefined) => any) | undefined;
|
|
70
|
-
}>, {
|
|
71
|
-
placeholder: string;
|
|
72
|
-
disabled: boolean;
|
|
73
|
-
optionLabel: string;
|
|
74
|
-
optionValue: string;
|
|
75
|
-
optionDisabledField: string;
|
|
76
|
-
optionDisabledValue: string | number | boolean;
|
|
77
|
-
filter: boolean;
|
|
78
|
-
clearable: boolean;
|
|
79
|
-
vModelToNumber: boolean;
|
|
80
|
-
vModelToString: boolean;
|
|
81
|
-
isBuffer: boolean;
|
|
82
|
-
isLabel: boolean;
|
|
83
|
-
mock: OptionItem[];
|
|
84
|
-
multiple: boolean;
|
|
85
|
-
param: Record<string, any>;
|
|
86
|
-
callApiIfNeeded: boolean;
|
|
87
|
-
cacheKey: string;
|
|
88
|
-
transform: TransformFunction;
|
|
89
|
-
immediate: boolean;
|
|
90
|
-
autoClearInvalidValue: boolean;
|
|
91
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
92
|
-
export default _default;
|
package/dist/types/cache.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { App } from 'vue';
|
|
2
|
-
import DictSelect from './DictSelect.vue';
|
|
3
|
-
import type { DictSelectExpose, OptionItem } from './types';
|
|
4
|
-
type DictSelectPlugin = typeof DictSelect & {
|
|
5
|
-
install: (app: App) => void;
|
|
6
|
-
};
|
|
7
|
-
declare const plugin: DictSelectPlugin;
|
|
8
|
-
export default plugin;
|
|
9
|
-
export { DictSelect };
|
|
10
|
-
export type { DictSelectExpose, OptionItem };
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type OptionItem = Record<string, any>;
|
|
2
|
-
export type ApiFunction = (params?: Record<string, any>) => Promise<any>;
|
|
3
|
-
export type TransformFunction = (raw: any, response: any) => OptionItem[];
|
|
4
|
-
export interface DictSelectExpose {
|
|
5
|
-
refresh: (force?: boolean) => Promise<void>;
|
|
6
|
-
clearCache: () => void;
|
|
7
|
-
getOptions: () => OptionItem[];
|
|
8
|
-
getResponse: () => any;
|
|
9
|
-
getSelectedOption: () => OptionItem | OptionItem[] | undefined;
|
|
10
|
-
}
|