@fangzhongya/vue-archive 0.0.22 → 0.0.23
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/dist/node/index.cjs +0 -1
- package/dist/node/index.js +0 -1
- package/dist/packages/components/use/code.cjs +5 -5
- package/dist/packages/components/use/code.js +27 -27
- package/dist/packages/components/use/retrie/expose/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/expose/index.vue.js +16 -16
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -3254,7 +3254,6 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
|
3254
3254
|
sarr.push(
|
|
3255
3255
|
`// ${sp.description} ${sp.name}: {${sp.type}} (${sp.selectable})`
|
|
3256
3256
|
);
|
|
3257
|
-
console.log("val", val);
|
|
3258
3257
|
if (typeof val == "function") {
|
|
3259
3258
|
sarr.push(
|
|
3260
3259
|
"const " + key + " = " + getFunctionBody(val, key, propsText)
|
package/dist/node/index.js
CHANGED
|
@@ -3239,7 +3239,6 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
|
3239
3239
|
sarr.push(
|
|
3240
3240
|
`// ${sp.description} ${sp.name}: {${sp.type}} (${sp.selectable})`
|
|
3241
3241
|
);
|
|
3242
|
-
console.log("val", val);
|
|
3243
3242
|
if (typeof val == "function") {
|
|
3244
3243
|
sarr.push(
|
|
3245
3244
|
"const " + key + " = " + getFunctionBody(val, key, propsText)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const B=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const C=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const V=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const g=require("./util.cjs"),S=require("../../utils/props.cjs"),H=require("@fangzhongya/utils/basic/string/toFunction"),J=["class"];function j(s,t){return s.filter(e=>e.name==t)[0]}function N(s){return s.map(t=>(t.prop||"...arr")+":"+g.setDataType(t.dataType)).join(",")}function A(s,t,e,o,h,$){const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const B=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const C=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const V=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const g=require("./util.cjs"),S=require("../../utils/props.cjs"),H=require("@fangzhongya/utils/basic/string/toFunction"),J=["class"];function j(s,t){return s.filter(e=>e.name==t)[0]}function N(s){return s.map(t=>(t.prop||"...arr")+":"+g.setDataType(t.dataType)).join(",")}function A(s,t,e,o,h,$){const f=[],n=[];let b=!0;const L=S.getPropsValue(t.propss||[]),P=S.getEmitsValue(t.emitss||[]),x=S.getExposeValue(t.exposes||[]),z=S.getSlotValue(t.slots||[]);Object.keys(e).forEach(r=>{let p=e[r];if(/^on[A-Z]/.test(r)&&typeof p=="function"){let i=r.substring(2);const c=r.split(":");let a;if(c.length>1?(a=c[0]+c.slice(1).map(l=>V.firstUpper(l)).join(""),i=C.firstLower(i)):(a=c[0],i=B.humpToLine(i)),c.includes("-")){let l=a.split("-");l=l.map((m,T)=>T!=0?V.firstUpper(m):m),a=l.join("")}f.push(" @"+i+'="'+a+'"');const u=j(P,i),y=u.selectable||"",q=g.getParametersObj(y),d=N(q);n.push(`// ${u.description} ${u.name}: (${u.selectable})`),n.push("function "+a+"("+d+") {"),q.forEach(l=>{const m=l.prop||"arr";n.push(" console.log('"+l.description+m+"', "+m+")")}),n.push("}")}else{let i=r;J.includes(r)&&(i=r+"1"),f.push(" :"+r+'="'+i+'"');const c=j(L,r),a=D(c);if(n.push(`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`),typeof p=="function")n.push("const "+r+" = "+F(p,r,h));else if(b&&(b=!1,n.unshift("import { ref } from 'vue';")),typeof p>"u"){const u=g.getTypeValue(a.dataType);u=="()=>{}"?n.push("const "+i+" = "+u+";"):n.push("const "+i+" = ref("+(u==="undefined"?"":u)+");")}else{let u=E(p,r,h);n.push("const "+i+" = ref("+u+");")}}});const O=Object.values($||{});O.length>0&&(b&&(b=!1,n.unshift("import { ref } from 'vue';")),f.unshift(' ref="refDom"'),n.push("const refDom = ref()"),O.forEach(r=>{const p=j(x,r.name);n.push(`// ${p.description} ${p.name}:(${p.selectable}) ${p.type}`);const i=r.name+"Value",c=g.getParametersObj(p?.selectable||""),a=[],u=r.params||[];c.forEach((y,q)=>{const d=y.prop;if(d){const l=d+r.name,m=u[q];if(n.push(`// ${y.label}`),typeof m=="function")n.push("const "+l+" = "+F(m,d,r.text));else if(typeof m>"u")n.push("const "+l+" = "+g.getTypeValue(y.dataType)+";");else{let T=E(m,d,r.text);n.push("const "+l+" = "+T+";")}a.push(l)}}),r.type==="function"?n.push(`const ${i} = refDom.value?.${r.name}(${a.join(", ")})`):n.push(`const ${i} = refDom.value?.${r.name}`),n.push(`console.log('"${p.type}"', ${i})`)})),f.length>0&&f.unshift("");const U=M(o,z);return`<!--${s}-->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
|
-
<${s}${
|
|
4
|
+
<${s}${f.join(`
|
|
5
5
|
`)}>${U.join(`
|
|
6
6
|
`)}
|
|
7
7
|
</${s}>
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
${n.join(`
|
|
12
12
|
`)}
|
|
13
13
|
<\/script>
|
|
14
|
-
`}function M(s={},t){const e=[];return Object.keys(s).forEach(o=>{const h=j(t,o),$=s[o];if($){const
|
|
14
|
+
`}function M(s={},t){const e=[];return Object.keys(s).forEach(o=>{const h=j(t,o),$=s[o];if($){const f=` <!-- ${h.description} ${h.name}:(${h.selectable}) -->
|
|
15
15
|
<template #${o}="scope">
|
|
16
16
|
${g.vueFormat($," ")}
|
|
17
|
-
</template>`;e.push(
|
|
17
|
+
</template>`;e.push(f)}}),e&&e.length>0&&e.unshift(""),e}function F(s,t,e){const o=e?e[t]:"";return o||w(s.toString())}function w(s){const t=H.getFunctionFormat(g.prettierFormat(s));if(t){let e=`{
|
|
18
18
|
${g.vueFormat(g.getFunBody(t.body)," ")}
|
|
19
|
-
}`;return`function (${t.param}) ${e}`}else return"undefined"}function Z(s){const t=s.trim();return/^\(/.test(t)?w(t):JSON.stringify(s)}function E(s,t,e){const o=e?e[t]:"";return o||(typeof s=="string"?Z(s+""):JSON.stringify(s))}function D(s){let t=G(s.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const o=e;let h=(s.selectable||"").trim(),$=[];return h&&e!="boolean"&&(h.split(",").forEach(
|
|
19
|
+
}`;return`function (${t.param}) ${e}`}else return"undefined"}function Z(s){const t=s.trim();return/^\(/.test(t)?w(t):JSON.stringify(s)}function E(s,t,e){const o=e?e[t]:"";return o||(typeof s=="string"?Z(s+""):JSON.stringify(s))}function D(s){let t=G(s.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const o=e;let h=(s.selectable||"").trim(),$=[];return h&&e!="boolean"&&(h.split(",").forEach(f=>{if(f){let n=f.split(":");$.push({label:f,prop:n[0].trim()})}}),e=="function"?e="function":e=="array"?e="choice":e="select"),{arr:$,zdtype:o,type:e,dataType:t}}function G(s){let t=[];return(s||"").trim().toLowerCase().split(",").forEach(o=>{o=o.trim(),o&&t.push(o)}),[...new Set(t)].sort()}exports.getHmtl=A;exports.getSpecType=D;exports.setValStringify=E;
|
|
@@ -20,20 +20,20 @@ function Q(s) {
|
|
|
20
20
|
return s.map((e) => (e.prop || "...arr") + ":" + A(e.dataType)).join(",");
|
|
21
21
|
}
|
|
22
22
|
function at(s, e, t, r, h, $) {
|
|
23
|
-
const
|
|
23
|
+
const l = [], n = [];
|
|
24
24
|
let y = !0;
|
|
25
25
|
const z = Z(e.propss || []), L = q(e.emitss || []), P = G(e.exposes || []), B = I(e.slots || []);
|
|
26
26
|
Object.keys(t).forEach((o) => {
|
|
27
|
-
let
|
|
28
|
-
if (/^on[A-Z]/.test(o) && typeof
|
|
27
|
+
let u = t[o];
|
|
28
|
+
if (/^on[A-Z]/.test(o) && typeof u == "function") {
|
|
29
29
|
let i = o.substring(2);
|
|
30
|
-
const
|
|
30
|
+
const c = o.split(":");
|
|
31
31
|
let a;
|
|
32
|
-
if (
|
|
32
|
+
if (c.length > 1 ? (a = c[0] + c.slice(1).map((f) => O(f)).join(""), i = N(i)) : (a = c[0], i = J(i)), c.includes("-")) {
|
|
33
33
|
let f = a.split("-");
|
|
34
34
|
f = f.map((m, S) => S != 0 ? O(m) : m), a = f.join("");
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
l.push(" @" + i + '="' + a + '"');
|
|
37
37
|
const p = j(L, i), d = p.selectable || "", b = V(d), g = Q(b);
|
|
38
38
|
n.push(`// ${p.description} ${p.name}: (${p.selectable})`), n.push("function " + a + "(" + g + ") {"), b.forEach((f) => {
|
|
39
39
|
const m = f.prop || "arr";
|
|
@@ -43,33 +43,33 @@ function at(s, e, t, r, h, $) {
|
|
|
43
43
|
}), n.push("}");
|
|
44
44
|
} else {
|
|
45
45
|
let i = o;
|
|
46
|
-
M.includes(o) && (i = o + "1"),
|
|
47
|
-
const
|
|
46
|
+
M.includes(o) && (i = o + "1"), l.push(" :" + o + '="' + i + '"');
|
|
47
|
+
const c = j(z, o), a = X(c);
|
|
48
48
|
if (n.push(
|
|
49
|
-
`// ${
|
|
50
|
-
),
|
|
49
|
+
`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`
|
|
50
|
+
), typeof u == "function")
|
|
51
51
|
n.push(
|
|
52
|
-
"const " + o + " = " + T(
|
|
52
|
+
"const " + o + " = " + T(u, o, h)
|
|
53
53
|
);
|
|
54
|
-
else if (y && (y = !1, n.unshift("import { ref } from 'vue';")), typeof
|
|
54
|
+
else if (y && (y = !1, n.unshift("import { ref } from 'vue';")), typeof u > "u") {
|
|
55
55
|
const p = F(a.dataType);
|
|
56
56
|
p == "()=>{}" ? n.push("const " + i + " = " + p + ";") : n.push(
|
|
57
57
|
"const " + i + " = ref(" + (p === "undefined" ? "" : p) + ");"
|
|
58
58
|
);
|
|
59
59
|
} else {
|
|
60
|
-
let p = D(
|
|
60
|
+
let p = D(u, o, h);
|
|
61
61
|
n.push("const " + i + " = ref(" + p + ");");
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
const E = Object.values($ || {});
|
|
66
|
-
E.length > 0 && (y && (y = !1, n.unshift("import { ref } from 'vue';")),
|
|
67
|
-
const
|
|
66
|
+
E.length > 0 && (y && (y = !1, n.unshift("import { ref } from 'vue';")), l.unshift(' ref="refDom"'), n.push("const refDom = ref()"), E.forEach((o) => {
|
|
67
|
+
const u = j(P, o.name);
|
|
68
68
|
n.push(
|
|
69
|
-
`// ${
|
|
69
|
+
`// ${u.description} ${u.name}:(${u.selectable}) ${u.type}`
|
|
70
70
|
);
|
|
71
|
-
const i = o.name + "Value",
|
|
72
|
-
|
|
71
|
+
const i = o.name + "Value", c = V(u?.selectable || ""), a = [], p = o.params || [];
|
|
72
|
+
c.forEach((d, b) => {
|
|
73
73
|
const g = d.prop;
|
|
74
74
|
if (g) {
|
|
75
75
|
const f = g + o.name, m = p[b];
|
|
@@ -89,13 +89,13 @@ function at(s, e, t, r, h, $) {
|
|
|
89
89
|
}
|
|
90
90
|
}), o.type === "function" ? n.push(
|
|
91
91
|
`const ${i} = refDom.value?.${o.name}(${a.join(", ")})`
|
|
92
|
-
) : n.push(`const ${i} = refDom.value?.${o.name}`), n.push(`console.log('"${
|
|
93
|
-
})),
|
|
92
|
+
) : n.push(`const ${i} = refDom.value?.${o.name}`), n.push(`console.log('"${u.type}"', ${i})`);
|
|
93
|
+
})), l.length > 0 && l.unshift("");
|
|
94
94
|
const C = R(r, B);
|
|
95
95
|
return `<!--${s}-->
|
|
96
96
|
<template>
|
|
97
97
|
<div>
|
|
98
|
-
<${s}${
|
|
98
|
+
<${s}${l.join(`
|
|
99
99
|
`)}>${C.join(`
|
|
100
100
|
`)}
|
|
101
101
|
</${s}>
|
|
@@ -112,11 +112,11 @@ function R(s = {}, e) {
|
|
|
112
112
|
return Object.keys(s).forEach((r) => {
|
|
113
113
|
const h = j(e, r), $ = s[r];
|
|
114
114
|
if ($) {
|
|
115
|
-
const
|
|
115
|
+
const l = ` <!-- ${h.description} ${h.name}:(${h.selectable}) -->
|
|
116
116
|
<template #${r}="scope">
|
|
117
117
|
${w($, " ")}
|
|
118
118
|
</template>`;
|
|
119
|
-
t.push(
|
|
119
|
+
t.push(l);
|
|
120
120
|
}
|
|
121
121
|
}), t && t.length > 0 && t.unshift(""), t;
|
|
122
122
|
}
|
|
@@ -147,11 +147,11 @@ function X(s) {
|
|
|
147
147
|
e.length == 1 && (t = e[0].split("<")[0]);
|
|
148
148
|
const r = t;
|
|
149
149
|
let h = (s.selectable || "").trim(), $ = [];
|
|
150
|
-
return h && t != "boolean" && (h.split(",").forEach((
|
|
151
|
-
if (
|
|
152
|
-
let n =
|
|
150
|
+
return h && t != "boolean" && (h.split(",").forEach((l) => {
|
|
151
|
+
if (l) {
|
|
152
|
+
let n = l.split(":");
|
|
153
153
|
$.push({
|
|
154
|
-
label:
|
|
154
|
+
label: l,
|
|
155
155
|
prop: n[0].trim()
|
|
156
156
|
});
|
|
157
157
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),d=require("../../util.cjs"),g=require("../index.vue.cjs");;/* empty css */const y={class:"expose"},h={class:"expose-label"},x={class:"expose-return"},b=e.defineComponent({__name:"index",props:{getRef:{type:Function},name:String,value:{type:Object}},emits:["change"],setup(p,{emit:v}){const
|
|
1
|
+
"use strict";const e=require("vue"),d=require("../../util.cjs"),g=require("../index.vue.cjs");;/* empty css */const y={class:"expose"},h={class:"expose-label"},x={class:"expose-return"},b=e.defineComponent({__name:"index",props:{getRef:{type:Function},name:String,value:{type:Object}},emits:["change"],setup(p,{emit:v}){const a=p,m=v,c=e.ref(""),o=e.ref(""),i=e.ref([]),f=e.computed(()=>{i.value=[];const t=a.value;if(t&&t.name){let l=(t.selectable+"").trim();if(c.value=t.name+": "+t.description+" 入参=("+l+") 返回值: "+t.type,l){let n=d.getParametersObj(l);return n.forEach(r=>{i.value.push(r.prop)}),n}}return[]});function _(t,l){let n=a.getRef?a.getRef():void 0,r=a.value?.name;if(r){let u=i.value.map(s=>t[s]);if(n&&n[r]){if(typeof n[r]=="function"){let s=n[r](...u);o.value=JSON.stringify(s)}else{let s=n[r];s instanceof HTMLDivElement?o.value=s.outerHTML:o.value=JSON.stringify(s)}m("change",r,u,typeof n[r],l)}}else console.log("请选择方法")}return(t,l)=>(e.openBlock(),e.createElementBlock("div",y,[e.createElementVNode("div",h,e.toDisplayString(c.value||"请选择方法"),1),e.createVNode(g,{list:f.value,name:a.name,queryName:"调用",onQuery:_},null,8,["list","name"]),e.createElementVNode("div",x,e.toDisplayString(a.value?.type)+"返回值:"+e.toDisplayString(o.value),1)]))}});module.exports=b;
|
|
@@ -17,36 +17,36 @@ const S = { class: "expose" }, j = { class: "expose-label" }, R = { class: "expo
|
|
|
17
17
|
setup(f, { emit: v }) {
|
|
18
18
|
const a = f, d = v, u = i(""), r = i(""), s = i([]), _ = h(() => {
|
|
19
19
|
s.value = [];
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
let l = (
|
|
23
|
-
if (u.value =
|
|
24
|
-
let
|
|
25
|
-
return
|
|
20
|
+
const e = a.value;
|
|
21
|
+
if (e && e.name) {
|
|
22
|
+
let l = (e.selectable + "").trim();
|
|
23
|
+
if (u.value = e.name + ": " + e.description + " 入参=(" + l + ") 返回值: " + e.type, l) {
|
|
24
|
+
let t = E(l);
|
|
25
|
+
return t.forEach((n) => {
|
|
26
26
|
s.value.push(n.prop);
|
|
27
|
-
}),
|
|
27
|
+
}), t;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
return [];
|
|
31
31
|
});
|
|
32
|
-
function g(
|
|
33
|
-
let
|
|
32
|
+
function g(e, l) {
|
|
33
|
+
let t = a.getRef ? a.getRef() : void 0, n = a.value?.name;
|
|
34
34
|
if (n) {
|
|
35
|
-
let m = s.value.map((o) =>
|
|
36
|
-
if (
|
|
37
|
-
if (typeof
|
|
38
|
-
let o =
|
|
35
|
+
let m = s.value.map((o) => e[o]);
|
|
36
|
+
if (t && t[n]) {
|
|
37
|
+
if (typeof t[n] == "function") {
|
|
38
|
+
let o = t[n](...m);
|
|
39
39
|
r.value = JSON.stringify(o);
|
|
40
40
|
} else {
|
|
41
|
-
let o =
|
|
41
|
+
let o = t[n];
|
|
42
42
|
o instanceof HTMLDivElement ? r.value = o.outerHTML : r.value = JSON.stringify(o);
|
|
43
43
|
}
|
|
44
|
-
d("change", n, m, typeof
|
|
44
|
+
d("change", n, m, typeof t[n], l);
|
|
45
45
|
}
|
|
46
46
|
} else
|
|
47
47
|
console.log("请选择方法");
|
|
48
48
|
}
|
|
49
|
-
return (
|
|
49
|
+
return (e, l) => (x(), b("div", S, [
|
|
50
50
|
p("div", j, c(u.value || "请选择方法"), 1),
|
|
51
51
|
N(O, {
|
|
52
52
|
list: _.value,
|