sand-components-vben 1.0.2 → 1.0.3
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/package.json +1 -1
- package/sandComponents.css +1 -0
- package/sandComponents.js +39 -30
- package/sandComponents.umd.cjs +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ant-select[data-v-b42694f6]{width:100%}
|
package/sandComponents.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as h, reactive as
|
|
1
|
+
import { defineComponent as h, reactive as _, toRefs as m, onMounted as y, watch as w, resolveComponent as r, openBlock as s, createBlock as u, unref as i, isRef as S, withCtx as d, createElementBlock as g, Fragment as x, renderList as k, createTextVNode as b, toDisplayString as B } from "vue";
|
|
2
2
|
const C = /* @__PURE__ */ h({
|
|
3
3
|
__name: "ApiSelect",
|
|
4
4
|
props: {
|
|
@@ -8,8 +8,8 @@ const C = /* @__PURE__ */ h({
|
|
|
8
8
|
},
|
|
9
9
|
// 公共下拉请求
|
|
10
10
|
api: {
|
|
11
|
-
type:
|
|
12
|
-
default: () =>
|
|
11
|
+
type: Function,
|
|
12
|
+
default: () => null
|
|
13
13
|
},
|
|
14
14
|
// 支持搜索
|
|
15
15
|
showSearch: {
|
|
@@ -23,41 +23,45 @@ const C = /* @__PURE__ */ h({
|
|
|
23
23
|
pageSize: 100,
|
|
24
24
|
pageNo: 1
|
|
25
25
|
})
|
|
26
|
+
},
|
|
27
|
+
placeholder: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "请选择"
|
|
26
30
|
}
|
|
27
31
|
},
|
|
28
|
-
setup(
|
|
29
|
-
const e =
|
|
32
|
+
setup(t) {
|
|
33
|
+
const e = t, n = _({
|
|
30
34
|
options: [],
|
|
31
|
-
propsValue:
|
|
35
|
+
propsValue: void 0
|
|
32
36
|
});
|
|
33
|
-
let { options:
|
|
34
|
-
return
|
|
37
|
+
let { options: c, propsValue: o } = m(n);
|
|
38
|
+
return y(async () => {
|
|
35
39
|
if (e.api) {
|
|
36
|
-
const { data:
|
|
37
|
-
|
|
40
|
+
const { data: l } = await e.api(e.params);
|
|
41
|
+
n.options = l, o.value = e.value;
|
|
38
42
|
}
|
|
39
|
-
}),
|
|
43
|
+
}), w(
|
|
40
44
|
() => e.value,
|
|
41
|
-
(
|
|
42
|
-
|
|
45
|
+
(l) => {
|
|
46
|
+
o.value = l;
|
|
43
47
|
},
|
|
44
48
|
{ deep: !0 }
|
|
45
|
-
), (
|
|
46
|
-
const f =
|
|
47
|
-
return
|
|
48
|
-
value:
|
|
49
|
-
"onUpdate:value":
|
|
50
|
-
"show-search":
|
|
51
|
-
placeholder:
|
|
49
|
+
), (l, p) => {
|
|
50
|
+
const f = r("a-select-option"), v = r("a-select");
|
|
51
|
+
return s(), u(v, {
|
|
52
|
+
value: i(o),
|
|
53
|
+
"onUpdate:value": p[0] || (p[0] = (a) => S(o) ? o.value = a : o = a),
|
|
54
|
+
"show-search": t.showSearch,
|
|
55
|
+
placeholder: t.placeholder,
|
|
52
56
|
style: { width: "100%" }
|
|
53
57
|
}, {
|
|
54
|
-
default:
|
|
55
|
-
(
|
|
58
|
+
default: d(() => [
|
|
59
|
+
(s(!0), g(x, null, k(i(c), (a) => (s(), u(f, {
|
|
56
60
|
value: a.value,
|
|
57
61
|
key: a.value
|
|
58
62
|
}, {
|
|
59
|
-
default:
|
|
60
|
-
|
|
63
|
+
default: d(() => [
|
|
64
|
+
b(B(a.label), 1)
|
|
61
65
|
]),
|
|
62
66
|
_: 2
|
|
63
67
|
}, 1032, ["value"]))), 128))
|
|
@@ -66,12 +70,17 @@ const C = /* @__PURE__ */ h({
|
|
|
66
70
|
}, 8, ["value", "show-search", "placeholder"]);
|
|
67
71
|
};
|
|
68
72
|
}
|
|
69
|
-
}), N =
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
}), N = (t, e) => {
|
|
74
|
+
const n = t.__vccOpts || t;
|
|
75
|
+
for (const [c, o] of e)
|
|
76
|
+
n[c] = o;
|
|
77
|
+
return n;
|
|
78
|
+
}, V = /* @__PURE__ */ N(C, [["__scopeId", "data-v-b42694f6"]]), A = [V], E = function(t) {
|
|
79
|
+
A.forEach((e) => {
|
|
80
|
+
t.component(e.name, e);
|
|
72
81
|
});
|
|
73
|
-
},
|
|
82
|
+
}, O = { install: E };
|
|
74
83
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
84
|
+
V as ApiSelect,
|
|
85
|
+
O as default
|
|
77
86
|
};
|
package/sandComponents.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.sandComponents={},o.Vue))})(this,function(o,e){"use strict";const r=((n,t)=>{const c=n.__vccOpts||n;for(const[p,a]of t)c[p]=a;return c})(e.defineComponent({__name:"ApiSelect",props:{value:{type:[String,Number],default:void 0},api:{type:Function,default:()=>null},showSearch:{type:Boolean,default:!0},params:{type:Object,default:()=>({pageSize:100,pageNo:1})},placeholder:{type:String,default:"请选择"}},setup(n){const t=n,c=e.reactive({options:[],propsValue:void 0});let{options:p,propsValue:a}=e.toRefs(c);return e.onMounted(async()=>{if(t.api){const{data:s}=await t.api(t.params);c.options=s,a.value=t.value}}),e.watch(()=>t.value,s=>{a.value=s},{deep:!0}),(s,i)=>{const u=e.resolveComponent("a-select-option"),_=e.resolveComponent("a-select");return e.openBlock(),e.createBlock(_,{value:e.unref(a),"onUpdate:value":i[0]||(i[0]=l=>e.isRef(a)?a.value=l:a=l),"show-search":n.showSearch,placeholder:n.placeholder,style:{width:"100%"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),l=>(e.openBlock(),e.createBlock(u,{value:l.value,key:l.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value","show-search","placeholder"])}}}),[["__scopeId","data-v-b42694f6"]]),d=[r],f={install:function(n){d.forEach(t=>{n.component(t.name,t)})}};o.ApiSelect=r,o.default=f,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|