@fangzhongya/vue-archive 0.0.37 → 0.0.38
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("vue"),V=require("./retrie/index.vue.cjs");;/* empty css */const T=require("./code.cjs"),k={key:0,class:"set-props"},q=s.defineComponent({__name:"set-props",props:{name:String,list:Array},emits:["change"],setup(
|
|
1
|
+
"use strict";const s=require("vue"),V=require("./retrie/index.vue.cjs");;/* empty css */const T=require("./code.cjs"),k={key:0,class:"set-props"},q=s.defineComponent({__name:"set-props",props:{name:String,list:Array},emits:["change"],setup(i,{emit:p}){const l=i,m=p,u=s.ref({}),f=s.ref(0),c=s.ref({}),r=s.ref([]);function d(){c.value={};const n=[];l.list?.forEach(t=>{let e=t.name;if(e.includes(".")?e="":e=(e.split("/")[0]||"").trim(),e){c.value[e]=(t.default||"").trim();const{arr:o,type:g,dataType:v}=T.getSpecType(t);o.length>1&&(u.value[e]=o);let b={label:_(e,t),prop:e,type:g,dataType:v,select:e};n.push(b)}}),r.value=n}function _(n,t){let e=n+": { "+(t.type||"any")+" } "+t.description;return t.default&&(e+=" 默认值="+t.default),t.selectable&&(e+=" 可选值="+t.selectable),e}function h(n,t){let e=Object.assign({},n);m("change",e,t)}let a;function y(){clearTimeout(a),a=setTimeout(()=>{d()},400)}return s.watch(()=>l.name,()=>{r.value=[],s.nextTick(()=>{y()})},{immediate:!0}),(n,t)=>r.value&&r.value.length>0?(s.openBlock(),s.createElementBlock("div",k,[s.createVNode(V,{refresh:f.value,modelValue:c.value,selects:u.value,list:r.value,name:l.name,onQuery:h},null,8,["refresh","modelValue","selects","list","name"])])):s.createCommentVNode("",!0)}});module.exports=q;
|
|
@@ -12,19 +12,19 @@ const S = {
|
|
|
12
12
|
list: Array
|
|
13
13
|
},
|
|
14
14
|
emits: ["change"],
|
|
15
|
-
setup(
|
|
16
|
-
const r =
|
|
17
|
-
function
|
|
15
|
+
setup(u, { emit: m }) {
|
|
16
|
+
const r = u, p = m, o = n({}), f = n(0), a = n({}), l = n([]);
|
|
17
|
+
function d() {
|
|
18
18
|
a.value = {};
|
|
19
19
|
const s = [];
|
|
20
20
|
r.list?.forEach((t) => {
|
|
21
21
|
let e = t.name;
|
|
22
22
|
if (e.includes(".") ? e = "" : e = (e.split("/")[0] || "").trim(), e) {
|
|
23
23
|
a.value[e] = (t.default || "").trim();
|
|
24
|
-
const { arr:
|
|
25
|
-
o.value[e] =
|
|
24
|
+
const { arr: i, type: b, dataType: g } = N(t);
|
|
25
|
+
i.length > 1 && (o.value[e] = i);
|
|
26
26
|
let V = {
|
|
27
|
-
label:
|
|
27
|
+
label: h(e, t),
|
|
28
28
|
prop: e,
|
|
29
29
|
type: b,
|
|
30
30
|
dataType: g,
|
|
@@ -34,25 +34,25 @@ const S = {
|
|
|
34
34
|
}
|
|
35
35
|
}), l.value = s;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function h(s, t) {
|
|
38
38
|
let e = s + ": { " + (t.type || "any") + " } " + t.description;
|
|
39
39
|
return t.default && (e += " 默认值=" + t.default), t.selectable && (e += " 可选值=" + t.selectable), e;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function _(s, t) {
|
|
42
42
|
let e = Object.assign({}, s);
|
|
43
|
-
|
|
43
|
+
p("change", e, t);
|
|
44
44
|
}
|
|
45
45
|
let c;
|
|
46
|
-
function
|
|
46
|
+
function y() {
|
|
47
47
|
clearTimeout(c), c = setTimeout(() => {
|
|
48
|
-
|
|
48
|
+
d();
|
|
49
49
|
}, 400);
|
|
50
50
|
}
|
|
51
51
|
return T(
|
|
52
52
|
() => r.name,
|
|
53
53
|
() => {
|
|
54
54
|
l.value = [], k(() => {
|
|
55
|
-
|
|
55
|
+
y();
|
|
56
56
|
});
|
|
57
57
|
},
|
|
58
58
|
{
|
|
@@ -60,12 +60,12 @@ const S = {
|
|
|
60
60
|
}
|
|
61
61
|
), (s, t) => l.value && l.value.length > 0 ? (B(), x("div", S, [
|
|
62
62
|
C(E, {
|
|
63
|
-
refresh:
|
|
63
|
+
refresh: f.value,
|
|
64
64
|
modelValue: a.value,
|
|
65
65
|
selects: o.value,
|
|
66
66
|
list: l.value,
|
|
67
67
|
name: r.name,
|
|
68
|
-
onQuery:
|
|
68
|
+
onQuery: _
|
|
69
69
|
}, null, 8, ["refresh", "modelValue", "selects", "list", "name"])
|
|
70
70
|
])) : j("", !0);
|
|
71
71
|
}
|