@fangzhongya/vue-archive 0.0.13 → 0.0.15
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
CHANGED
|
@@ -2888,6 +2888,7 @@ function getFunctionFormat(v) {
|
|
|
2888
2888
|
}
|
|
2889
2889
|
|
|
2890
2890
|
// packages/components/use/code.ts
|
|
2891
|
+
var keywords = ["class"];
|
|
2891
2892
|
function getHmtl(propsname, value, slotValue, propsText) {
|
|
2892
2893
|
const tarr = [];
|
|
2893
2894
|
const sarr = [];
|
|
@@ -2916,44 +2917,30 @@ function getHmtl(propsname, value, slotValue, propsText) {
|
|
|
2916
2917
|
});
|
|
2917
2918
|
strs = arr.join("");
|
|
2918
2919
|
}
|
|
2919
|
-
tarr.push(
|
|
2920
|
-
" @" + name + '="' + strs + '"'
|
|
2921
|
-
);
|
|
2920
|
+
tarr.push(" @" + name + '="' + strs + '"');
|
|
2922
2921
|
sarr.push("function " + strs + "(...arr) {");
|
|
2923
|
-
sarr.push(
|
|
2924
|
-
" console.log('" + strs + "', arr)"
|
|
2925
|
-
);
|
|
2922
|
+
sarr.push(" console.log('" + strs + "', arr)");
|
|
2926
2923
|
sarr.push("}");
|
|
2927
2924
|
} else {
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2925
|
+
let z = key;
|
|
2926
|
+
if (keywords.includes(key)) {
|
|
2927
|
+
z = key + "1";
|
|
2928
|
+
}
|
|
2929
|
+
tarr.push(" :" + key + '="' + z + '"');
|
|
2931
2930
|
if (typeof val == "function") {
|
|
2932
2931
|
sarr.push(
|
|
2933
|
-
"const " + key + " = " + getFunctionBody(
|
|
2934
|
-
val,
|
|
2935
|
-
key,
|
|
2936
|
-
propsText
|
|
2937
|
-
)
|
|
2932
|
+
"const " + key + " = " + getFunctionBody(val, key, propsText)
|
|
2938
2933
|
);
|
|
2939
2934
|
} else {
|
|
2940
2935
|
if (is) {
|
|
2941
2936
|
is = false;
|
|
2942
|
-
sarr.unshift(
|
|
2943
|
-
"import { ref } from 'vue';"
|
|
2944
|
-
);
|
|
2937
|
+
sarr.unshift("import { ref } from 'vue';");
|
|
2945
2938
|
}
|
|
2946
2939
|
if (typeof val == "undefined") {
|
|
2947
|
-
sarr.push("const " +
|
|
2940
|
+
sarr.push("const " + z + " = ref();");
|
|
2948
2941
|
} else {
|
|
2949
|
-
let st2 = setValStringify(
|
|
2950
|
-
|
|
2951
|
-
key,
|
|
2952
|
-
propsText
|
|
2953
|
-
);
|
|
2954
|
-
sarr.push(
|
|
2955
|
-
"const " + key + " = ref(" + st2 + ");"
|
|
2956
|
-
);
|
|
2942
|
+
let st2 = setValStringify(val, key, propsText);
|
|
2943
|
+
sarr.push("const " + z + " = ref(" + st2 + ");");
|
|
2957
2944
|
}
|
|
2958
2945
|
}
|
|
2959
2946
|
}
|
|
@@ -3474,7 +3461,7 @@ function getName(obj) {
|
|
|
3474
3461
|
}
|
|
3475
3462
|
function gettests(obj, arr, n) {
|
|
3476
3463
|
const tests = getTestName(obj.key);
|
|
3477
|
-
if (tests && tests.length >
|
|
3464
|
+
if (tests && tests.length > 1 && configObj.generatetype != 3) {
|
|
3478
3465
|
asyncMergeArray(tests, (res, _reject, zv, inde) => {
|
|
3479
3466
|
getLocalTextTests(zv).then((text) => {
|
|
3480
3467
|
arr.push(`### \u793A\u4F8B` + inde + 1);
|
package/dist/node/index.js
CHANGED
|
@@ -2873,6 +2873,7 @@ function getFunctionFormat(v) {
|
|
|
2873
2873
|
}
|
|
2874
2874
|
|
|
2875
2875
|
// packages/components/use/code.ts
|
|
2876
|
+
var keywords = ["class"];
|
|
2876
2877
|
function getHmtl(propsname, value, slotValue, propsText) {
|
|
2877
2878
|
const tarr = [];
|
|
2878
2879
|
const sarr = [];
|
|
@@ -2901,44 +2902,30 @@ function getHmtl(propsname, value, slotValue, propsText) {
|
|
|
2901
2902
|
});
|
|
2902
2903
|
strs = arr.join("");
|
|
2903
2904
|
}
|
|
2904
|
-
tarr.push(
|
|
2905
|
-
" @" + name + '="' + strs + '"'
|
|
2906
|
-
);
|
|
2905
|
+
tarr.push(" @" + name + '="' + strs + '"');
|
|
2907
2906
|
sarr.push("function " + strs + "(...arr) {");
|
|
2908
|
-
sarr.push(
|
|
2909
|
-
" console.log('" + strs + "', arr)"
|
|
2910
|
-
);
|
|
2907
|
+
sarr.push(" console.log('" + strs + "', arr)");
|
|
2911
2908
|
sarr.push("}");
|
|
2912
2909
|
} else {
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2910
|
+
let z = key;
|
|
2911
|
+
if (keywords.includes(key)) {
|
|
2912
|
+
z = key + "1";
|
|
2913
|
+
}
|
|
2914
|
+
tarr.push(" :" + key + '="' + z + '"');
|
|
2916
2915
|
if (typeof val == "function") {
|
|
2917
2916
|
sarr.push(
|
|
2918
|
-
"const " + key + " = " + getFunctionBody(
|
|
2919
|
-
val,
|
|
2920
|
-
key,
|
|
2921
|
-
propsText
|
|
2922
|
-
)
|
|
2917
|
+
"const " + key + " = " + getFunctionBody(val, key, propsText)
|
|
2923
2918
|
);
|
|
2924
2919
|
} else {
|
|
2925
2920
|
if (is) {
|
|
2926
2921
|
is = false;
|
|
2927
|
-
sarr.unshift(
|
|
2928
|
-
"import { ref } from 'vue';"
|
|
2929
|
-
);
|
|
2922
|
+
sarr.unshift("import { ref } from 'vue';");
|
|
2930
2923
|
}
|
|
2931
2924
|
if (typeof val == "undefined") {
|
|
2932
|
-
sarr.push("const " +
|
|
2925
|
+
sarr.push("const " + z + " = ref();");
|
|
2933
2926
|
} else {
|
|
2934
|
-
let st2 = setValStringify(
|
|
2935
|
-
|
|
2936
|
-
key,
|
|
2937
|
-
propsText
|
|
2938
|
-
);
|
|
2939
|
-
sarr.push(
|
|
2940
|
-
"const " + key + " = ref(" + st2 + ");"
|
|
2941
|
-
);
|
|
2927
|
+
let st2 = setValStringify(val, key, propsText);
|
|
2928
|
+
sarr.push("const " + z + " = ref(" + st2 + ");");
|
|
2942
2929
|
}
|
|
2943
2930
|
}
|
|
2944
2931
|
}
|
|
@@ -3459,7 +3446,7 @@ function getName(obj) {
|
|
|
3459
3446
|
}
|
|
3460
3447
|
function gettests(obj, arr, n) {
|
|
3461
3448
|
const tests = getTestName(obj.key);
|
|
3462
|
-
if (tests && tests.length >
|
|
3449
|
+
if (tests && tests.length > 1 && configObj.generatetype != 3) {
|
|
3463
3450
|
asyncMergeArray(tests, (res, _reject, zv, inde) => {
|
|
3464
3451
|
getLocalTextTests(zv).then((text) => {
|
|
3465
3452
|
arr.push(`### \u793A\u4F8B` + inde + 1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const $=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const b=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const d=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const g=require("./util.cjs");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const $=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const b=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const d=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const g=require("./util.cjs"),j=["class"];function F(r,t,e,n){const o=[],i=[];let c=!0;Object.keys(t).forEach(s=>{let p=t[s];if(/^on[A-Z]/.test(s)&&typeof p=="function"){let u=s.substring(2);const f=s.split(":");let l;if(f.length>1?(l=f[0]+f.slice(1).map(a=>d.firstUpper(a)).join(""),u=b.firstLower(u)):(l=f[0],u=$.humpToLine(u)),f.includes("-")){let a=l.split("-");a=a.map((m,S)=>S!=0?d.firstUpper(m):m),l=a.join("")}o.push(" @"+u+'="'+l+'"'),i.push("function "+l+"(...arr) {"),i.push(" console.log('"+l+"', arr)"),i.push("}")}else{let u=s;if(j.includes(s)&&(u=s+"1"),o.push(" :"+s+'="'+u+'"'),typeof p=="function")i.push("const "+s+" = "+L(p,s,n));else if(c&&(c=!1,i.unshift("import { ref } from 'vue';")),typeof p>"u")i.push("const "+u+" = ref();");else{let f=q(p,s,n);i.push("const "+u+" = ref("+f+");")}}}),o.length>0&&o.unshift("");const h=w(e);return`<!--${r}-->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
4
|
<${r}${o.join(`
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
${i.join(`
|
|
12
12
|
`)}
|
|
13
13
|
<\/script>
|
|
14
|
-
`}function
|
|
14
|
+
`}function w(r={}){const t=[];return Object.keys(r).forEach(e=>{const n=r[e];if(n){const o=` <template #${e}="scope">
|
|
15
15
|
${g.vueFormat(n," ")}
|
|
16
16
|
</template>`;t.push(o)}}),t&&t.length>0&&t.unshift(""),t}function L(r,t,e){const n=e?e[t]:"";return n?"function "+n:y(r.toString())}function y(r){const t=g.getFunctionFormat(g.prettierFormat(r));if(t){let e=`{
|
|
17
17
|
${g.vueFormat(g.getFunBody(t.body)," ")}
|
|
18
|
-
}`;return`function ${t.param} ${e}`}else return"undefined"}function O(r){const t=r.trim();return/^\(/.test(t)?y(t):JSON.stringify(r)}function q(r,t,e){const n=e?e[t]:"";return n||(typeof r=="string"?O(r+""):JSON.stringify(r))}function
|
|
18
|
+
}`;return`function ${t.param} ${e}`}else return"undefined"}function O(r){const t=r.trim();return/^\(/.test(t)?y(t):JSON.stringify(r)}function q(r,t,e){const n=e?e[t]:"";return n||(typeof r=="string"?O(r+""):JSON.stringify(r))}function E(r){let t=T(r.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const n=e;let o=(r.selectable||"").trim(),i=[];return o&&e!="boolean"&&(o.split(",").forEach(c=>{if(c){let h=c.split(":");i.push({label:c,prop:h[0].trim()})}}),e=="function"?e="function":e=="array"?e="choice":e="select"),{arr:i,zdtype:n,type:e,dataType:t}}function T(r){let t=[];return(r||"").trim().toLowerCase().split(",").forEach(n=>{n=n.trim(),n&&t.push(n)}),[...new Set(t)].sort()}exports.getHmtl=F;exports.getSpecType=E;exports.setValStringify=q;
|
|
@@ -9,58 +9,44 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
|
9
9
|
import { firstUpper as g } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
10
10
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
11
11
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
12
|
-
import { vueFormat as d, getFunctionFormat as j, prettierFormat as F, getFunBody as
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
import { vueFormat as d, getFunctionFormat as j, prettierFormat as F, getFunBody as w } from "./util.js";
|
|
13
|
+
const E = ["class"];
|
|
14
|
+
function K(n, t, e, r) {
|
|
15
|
+
const o = [], i = [];
|
|
16
|
+
let c = !0;
|
|
17
|
+
Object.keys(t).forEach((s) => {
|
|
18
|
+
let p = t[s];
|
|
19
|
+
if (/^on[A-Z]/.test(s) && typeof p == "function") {
|
|
20
|
+
let f = s.substring(2);
|
|
21
|
+
const l = s.split(":");
|
|
22
|
+
let u;
|
|
23
|
+
if (l.length > 1 ? (u = l[0] + l.slice(1).map((a) => g(a)).join(""), f = S(f)) : (u = l[0], f = b(f)), l.includes("-")) {
|
|
24
|
+
let a = u.split("-");
|
|
25
|
+
a = a.map((h, $) => $ != 0 ? g(h) : h), u = a.join("");
|
|
26
|
+
}
|
|
27
|
+
o.push(" @" + f + '="' + u + '"'), i.push("function " + u + "(...arr) {"), i.push(" console.log('" + u + "', arr)"), i.push("}");
|
|
28
|
+
} else {
|
|
29
|
+
let f = s;
|
|
30
|
+
if (E.includes(s) && (f = s + "1"), o.push(" :" + s + '="' + f + '"'), typeof p == "function")
|
|
31
|
+
i.push(
|
|
32
|
+
"const " + s + " = " + z(p, s, r)
|
|
33
|
+
);
|
|
34
|
+
else if (c && (c = !1, i.unshift("import { ref } from 'vue';")), typeof p > "u")
|
|
35
|
+
i.push("const " + f + " = ref();");
|
|
36
|
+
else {
|
|
37
|
+
let l = B(p, s, r);
|
|
38
|
+
i.push("const " + f + " = ref(" + l + ");");
|
|
25
39
|
}
|
|
26
|
-
s.push(
|
|
27
|
-
" @" + f + '="' + l + '"'
|
|
28
|
-
), i.push("function " + l + "(...arr) {"), i.push(
|
|
29
|
-
" console.log('" + l + "', arr)"
|
|
30
|
-
), i.push("}");
|
|
31
|
-
} else if (s.push(
|
|
32
|
-
" :" + o + '="' + o + '"'
|
|
33
|
-
), typeof c == "function")
|
|
34
|
-
i.push(
|
|
35
|
-
"const " + o + " = " + w(
|
|
36
|
-
c,
|
|
37
|
-
o,
|
|
38
|
-
n
|
|
39
|
-
)
|
|
40
|
-
);
|
|
41
|
-
else if (u && (u = !1, i.unshift(
|
|
42
|
-
"import { ref } from 'vue';"
|
|
43
|
-
)), typeof c > "u")
|
|
44
|
-
i.push("const " + o + " = ref();");
|
|
45
|
-
else {
|
|
46
|
-
let f = z(
|
|
47
|
-
c,
|
|
48
|
-
o,
|
|
49
|
-
n
|
|
50
|
-
);
|
|
51
|
-
i.push(
|
|
52
|
-
"const " + o + " = ref(" + f + ");"
|
|
53
|
-
);
|
|
54
40
|
}
|
|
55
|
-
}),
|
|
41
|
+
}), o.length > 0 && o.unshift("");
|
|
56
42
|
const m = O(e);
|
|
57
|
-
return `<!--${
|
|
43
|
+
return `<!--${n}-->
|
|
58
44
|
<template>
|
|
59
45
|
<div>
|
|
60
|
-
<${
|
|
46
|
+
<${n}${o.join(`
|
|
61
47
|
`)}>${m.join(`
|
|
62
48
|
`)}
|
|
63
|
-
</${
|
|
49
|
+
</${n}>
|
|
64
50
|
</div>
|
|
65
51
|
</template>
|
|
66
52
|
<script lang="ts" setup>
|
|
@@ -69,68 +55,68 @@ ${i.join(`
|
|
|
69
55
|
<\/script>
|
|
70
56
|
`;
|
|
71
57
|
}
|
|
72
|
-
function O(
|
|
58
|
+
function O(n = {}) {
|
|
73
59
|
const t = [];
|
|
74
|
-
return Object.keys(
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
${d(
|
|
60
|
+
return Object.keys(n).forEach((e) => {
|
|
61
|
+
const r = n[e];
|
|
62
|
+
if (r) {
|
|
63
|
+
const o = ` <template #${e}="scope">
|
|
64
|
+
${d(r, " ")}
|
|
79
65
|
</template>`;
|
|
80
|
-
t.push(
|
|
66
|
+
t.push(o);
|
|
81
67
|
}
|
|
82
68
|
}), t && t.length > 0 && t.unshift(""), t;
|
|
83
69
|
}
|
|
84
|
-
function
|
|
85
|
-
const
|
|
86
|
-
return
|
|
70
|
+
function z(n, t, e) {
|
|
71
|
+
const r = e ? e[t] : "";
|
|
72
|
+
return r ? "function " + r : y(n.toString());
|
|
87
73
|
}
|
|
88
|
-
function
|
|
89
|
-
const t = j(F(
|
|
74
|
+
function y(n) {
|
|
75
|
+
const t = j(F(n));
|
|
90
76
|
if (t) {
|
|
91
77
|
let e = `{
|
|
92
|
-
${d(
|
|
78
|
+
${d(w(t.body), " ")}
|
|
93
79
|
}`;
|
|
94
80
|
return `function ${t.param} ${e}`;
|
|
95
81
|
} else
|
|
96
82
|
return "undefined";
|
|
97
83
|
}
|
|
98
|
-
function L(
|
|
99
|
-
const t =
|
|
100
|
-
return /^\(/.test(t) ?
|
|
84
|
+
function L(n) {
|
|
85
|
+
const t = n.trim();
|
|
86
|
+
return /^\(/.test(t) ? y(t) : JSON.stringify(n);
|
|
101
87
|
}
|
|
102
|
-
function
|
|
103
|
-
const
|
|
104
|
-
return
|
|
88
|
+
function B(n, t, e) {
|
|
89
|
+
const r = e ? e[t] : "";
|
|
90
|
+
return r || (typeof n == "string" ? L(n + "") : JSON.stringify(n));
|
|
105
91
|
}
|
|
106
|
-
function
|
|
107
|
-
let t =
|
|
92
|
+
function M(n) {
|
|
93
|
+
let t = C(n.type), e = "any";
|
|
108
94
|
t.length == 1 && (e = t[0].split("<")[0]);
|
|
109
|
-
const
|
|
110
|
-
let
|
|
111
|
-
return
|
|
112
|
-
if (
|
|
113
|
-
let m =
|
|
95
|
+
const r = e;
|
|
96
|
+
let o = (n.selectable || "").trim(), i = [];
|
|
97
|
+
return o && e != "boolean" && (o.split(",").forEach((c) => {
|
|
98
|
+
if (c) {
|
|
99
|
+
let m = c.split(":");
|
|
114
100
|
i.push({
|
|
115
|
-
label:
|
|
101
|
+
label: c,
|
|
116
102
|
prop: m[0].trim()
|
|
117
103
|
});
|
|
118
104
|
}
|
|
119
105
|
}), e == "function" ? e = "function" : e == "array" ? e = "choice" : e = "select"), {
|
|
120
106
|
arr: i,
|
|
121
|
-
zdtype:
|
|
107
|
+
zdtype: r,
|
|
122
108
|
type: e,
|
|
123
109
|
dataType: t
|
|
124
110
|
};
|
|
125
111
|
}
|
|
126
|
-
function
|
|
112
|
+
function C(n) {
|
|
127
113
|
let t = [];
|
|
128
|
-
return (
|
|
129
|
-
|
|
114
|
+
return (n || "").trim().toLowerCase().split(",").forEach((r) => {
|
|
115
|
+
r = r.trim(), r && t.push(r);
|
|
130
116
|
}), [...new Set(t)].sort();
|
|
131
117
|
}
|
|
132
118
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
119
|
+
K as getHmtl,
|
|
120
|
+
M as getSpecType,
|
|
121
|
+
B as setValStringify
|
|
136
122
|
};
|