@fangzhongya/vue-archive 0.0.35 → 0.0.37
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 +28 -14
- package/dist/node/index.js +28 -14
- package/dist/packages/components/use/code.cjs +12 -12
- package/dist/packages/components/use/code.d.ts +1 -0
- package/dist/packages/components/use/code.js +122 -110
- package/dist/packages/components/use/index.cjs +1 -1
- package/dist/packages/components/use/index.js +23 -22
- package/dist/packages/components/use/util.cjs +3 -3
- package/dist/packages/components/use/util.js +27 -24
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -3157,7 +3157,21 @@ function getTypeValue(arr) {
|
|
|
3157
3157
|
}
|
|
3158
3158
|
}
|
|
3159
3159
|
function setDataType(arr) {
|
|
3160
|
-
|
|
3160
|
+
let ts = "";
|
|
3161
|
+
arr.forEach((v, index) => {
|
|
3162
|
+
v = v.trim();
|
|
3163
|
+
if (v) {
|
|
3164
|
+
if (ts) {
|
|
3165
|
+
ts += " | ";
|
|
3166
|
+
}
|
|
3167
|
+
if (v === "Array") {
|
|
3168
|
+
ts += "Array<any>";
|
|
3169
|
+
} else {
|
|
3170
|
+
ts += v;
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
});
|
|
3174
|
+
return ts || "any";
|
|
3161
3175
|
}
|
|
3162
3176
|
var splitIgnoringNesting = (str, delimiter) => {
|
|
3163
3177
|
let bracketStack = [];
|
|
@@ -3531,6 +3545,19 @@ function getType(value) {
|
|
|
3531
3545
|
});
|
|
3532
3546
|
return [...new Set(arr)].sort();
|
|
3533
3547
|
}
|
|
3548
|
+
function getObjValue(d) {
|
|
3549
|
+
try {
|
|
3550
|
+
return new Function(`{ return ${d} }`)();
|
|
3551
|
+
} catch (error) {
|
|
3552
|
+
return "" + d;
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
function getDefaultValue(obj) {
|
|
3556
|
+
const vo = getSpecType(obj);
|
|
3557
|
+
const v = getTypeValue(vo.dataType);
|
|
3558
|
+
const d = (obj.default || "").trim();
|
|
3559
|
+
return getObjValue(d || v);
|
|
3560
|
+
}
|
|
3534
3561
|
|
|
3535
3562
|
// packages/components/compo/index.ts
|
|
3536
3563
|
var notesObj = {
|
|
@@ -3986,19 +4013,6 @@ function gettests(obj, arr, n) {
|
|
|
3986
4013
|
}
|
|
3987
4014
|
}
|
|
3988
4015
|
}
|
|
3989
|
-
function getObjValue(d) {
|
|
3990
|
-
try {
|
|
3991
|
-
return new Function(`{ return ${d} }`)();
|
|
3992
|
-
} catch (error) {
|
|
3993
|
-
return "" + d;
|
|
3994
|
-
}
|
|
3995
|
-
}
|
|
3996
|
-
function getDefaultValue(obj) {
|
|
3997
|
-
const vo = getSpecType(obj);
|
|
3998
|
-
const v = getTypeValue(vo.dataType);
|
|
3999
|
-
const d = (obj.default || "").trim();
|
|
4000
|
-
return getObjValue(d || v);
|
|
4001
|
-
}
|
|
4002
4016
|
function setVue(propsname, param, url) {
|
|
4003
4017
|
const ps = getPropsValue2(param.propss || []);
|
|
4004
4018
|
const es = getEmitsValue(param.emitss || []);
|
package/dist/node/index.js
CHANGED
|
@@ -3142,7 +3142,21 @@ function getTypeValue(arr) {
|
|
|
3142
3142
|
}
|
|
3143
3143
|
}
|
|
3144
3144
|
function setDataType(arr) {
|
|
3145
|
-
|
|
3145
|
+
let ts = "";
|
|
3146
|
+
arr.forEach((v, index) => {
|
|
3147
|
+
v = v.trim();
|
|
3148
|
+
if (v) {
|
|
3149
|
+
if (ts) {
|
|
3150
|
+
ts += " | ";
|
|
3151
|
+
}
|
|
3152
|
+
if (v === "Array") {
|
|
3153
|
+
ts += "Array<any>";
|
|
3154
|
+
} else {
|
|
3155
|
+
ts += v;
|
|
3156
|
+
}
|
|
3157
|
+
}
|
|
3158
|
+
});
|
|
3159
|
+
return ts || "any";
|
|
3146
3160
|
}
|
|
3147
3161
|
var splitIgnoringNesting = (str, delimiter) => {
|
|
3148
3162
|
let bracketStack = [];
|
|
@@ -3516,6 +3530,19 @@ function getType(value) {
|
|
|
3516
3530
|
});
|
|
3517
3531
|
return [...new Set(arr)].sort();
|
|
3518
3532
|
}
|
|
3533
|
+
function getObjValue(d) {
|
|
3534
|
+
try {
|
|
3535
|
+
return new Function(`{ return ${d} }`)();
|
|
3536
|
+
} catch (error) {
|
|
3537
|
+
return "" + d;
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
function getDefaultValue(obj) {
|
|
3541
|
+
const vo = getSpecType(obj);
|
|
3542
|
+
const v = getTypeValue(vo.dataType);
|
|
3543
|
+
const d = (obj.default || "").trim();
|
|
3544
|
+
return getObjValue(d || v);
|
|
3545
|
+
}
|
|
3519
3546
|
|
|
3520
3547
|
// packages/components/compo/index.ts
|
|
3521
3548
|
var notesObj = {
|
|
@@ -3971,19 +3998,6 @@ function gettests(obj, arr, n) {
|
|
|
3971
3998
|
}
|
|
3972
3999
|
}
|
|
3973
4000
|
}
|
|
3974
|
-
function getObjValue(d) {
|
|
3975
|
-
try {
|
|
3976
|
-
return new Function(`{ return ${d} }`)();
|
|
3977
|
-
} catch (error) {
|
|
3978
|
-
return "" + d;
|
|
3979
|
-
}
|
|
3980
|
-
}
|
|
3981
|
-
function getDefaultValue(obj) {
|
|
3982
|
-
const vo = getSpecType(obj);
|
|
3983
|
-
const v = getTypeValue(vo.dataType);
|
|
3984
|
-
const d = (obj.default || "").trim();
|
|
3985
|
-
return getObjValue(d || v);
|
|
3986
|
-
}
|
|
3987
4001
|
function setVue(propsname, param, url) {
|
|
3988
4002
|
const ps = getPropsValue2(param.propss || []);
|
|
3989
4003
|
const es = getEmitsValue(param.emitss || []);
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const C=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const H=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const C=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const H=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const O=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const c=require("./util.cjs"),q=require("../../utils/props.cjs"),J=require("@fangzhongya/utils/basic/string/toFunction"),N=["class"];function V(e,t){return e.filter(n=>n.name==t)[0]}function P(e){return e.map(t=>(t.prop||"...arr")+":"+c.setDataType(t.dataType)).join(",")}function v(e,t,n,s,l,$){const p=[],r=[];let b=!0;const L=q.getPropsValue(t.propss||[]),x=q.getEmitsValue(t.emitss||[]),z=q.getExposeValue(t.exposes||[]),B=q.getSlotValue(t.slots||[]);Object.keys(n).forEach(o=>{let m=n[o];if(/^on[A-Z]/.test(o)&&typeof m=="function"){let i=o.substring(2);const u=o.split(":");let g;if(u.length>1?(g=u[0]+u.slice(1).map(f=>O.firstUpper(f)).join(""),i=H.firstLower(i)):(g=u[0],i=C.humpToLine(i)),u.includes("-")){let f=g.split("-");f=f.map((h,T)=>T!=0?O.firstUpper(h):h),g=f.join("")}p.push(" @"+i+'="'+g+'"');const a=V(x,i)||{},y=a.selectable||"",S=c.parseParamString(y),d=P(S);r.push(`// ${a.description} ${a.name}: (${a.selectable})`),r.push("function "+g+"("+d+") {"),S.forEach(f=>{const h=f.name||"arr";r.push(" console.log('"+f.label+"', "+h+")")}),r.push("}")}else{let i=o;N.includes(o)&&(i=o+"1"),p.push(" :"+o+'="'+i+'"');const u=V(L,o)||{},g=j(u);if(r.push(`// ${u.description} ${u.name}: {${u.type}} (${u.selectable})`),typeof m=="function")r.push("const "+o+" = "+D(m,o,l));else if(b&&(b=!1,r.unshift("import { ref } from 'vue';")),typeof m>"u")if(g.type=="function"){const a=M(u);r.push("const "+i+" = "+a+";")}else{const a=c.getTypeValue(g.dataType);r.push("const "+i+" = ref("+(a==="undefined"?"":a)+");")}else{let a=F(m,o,l);r.push("const "+i+" = ref("+a+");")}}});const E=Object.values($||{});E.length>0&&(b&&(b=!1,r.unshift("import { ref } from 'vue';")),p.unshift(' ref="refDom"'),r.push("const refDom = ref()"),E.forEach(o=>{const m=V(z,o.name)||{};r.push(`// ${m.description} ${m.name}:(${m.selectable}) ${m.type}`);const i=o.name+"Value",u=c.parseParamString(m?.selectable||""),g=[],a=o.params||[];u.forEach((y,S)=>{const d=y.name;if(d){const f=d+o.name,h=a[S];if(r.push(`// ${y.label}`),typeof h=="function")r.push("const "+f+" = "+D(h,d,o.text));else if(typeof h>"u")r.push("const "+f+" = "+c.getTypeValue(y.dataType)+";");else{let T=F(h,d,o.text);r.push("const "+f+" = "+T+";")}g.push(f)}}),o.type==="function"?r.push(`const ${i} = refDom.value?.${o.name}(${g.join(", ")})`):r.push(`const ${i} = refDom.value?.${o.name}`),r.push(`console.log('"${m.type}"', ${i})`)})),p.length>0&&p.unshift("");const U=A(s,B);return`<!--${e}-->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
|
-
<${
|
|
4
|
+
<${e}${p.join(`
|
|
5
5
|
`)}>${U.join(`
|
|
6
6
|
`)}
|
|
7
|
-
</${
|
|
7
|
+
</${e}>
|
|
8
8
|
</div>
|
|
9
9
|
</template>
|
|
10
10
|
<script lang="ts" setup>
|
|
11
|
-
${
|
|
11
|
+
${r.join(`
|
|
12
12
|
`)}
|
|
13
13
|
<\/script>
|
|
14
|
-
`}function
|
|
15
|
-
<template #${
|
|
16
|
-
${
|
|
17
|
-
</template>`;
|
|
18
|
-
${
|
|
19
|
-
}`;return`function (${t.param}) ${
|
|
20
|
-
${
|
|
21
|
-
}`;return`function (${
|
|
14
|
+
`}function A(e={},t){const n=[];return Object.keys(e).forEach(s=>{const l=V(t,s)||{},$=e[s];if($){const p=` <!-- ${l.description} ${l.name}:(${l.selectable}) -->
|
|
15
|
+
<template #${s}="scope">
|
|
16
|
+
${c.vueFormat($," ")}
|
|
17
|
+
</template>`;n.push(p)}}),n&&n.length>0&&n.unshift(""),n}function D(e,t,n){const s=n?n[t]:"";return s||w(e.toString())}function w(e){const t=J.getFunctionFormat(c.prettierFormat(e));if(t){let n=`{
|
|
18
|
+
${c.vueFormat(c.getFunBody(t.body)," ")}
|
|
19
|
+
}`;return`function (${t.param}) ${n}`}else return"undefined"}function M(e){const t=c.parseParamString(e.selectable),n=P(t);let s="";e.return&&(s="return ");let l=`{
|
|
20
|
+
${c.vueFormat(c.getFunBody(s)," ")}
|
|
21
|
+
}`;return`function (${n}) ${l}`}function Z(e){const t=e.trim();return/^\(/.test(t)?w(t):JSON.stringify(e)}function F(e,t,n){const s=n?n[t]:"";return s||(typeof e=="string"?Z(e+""):JSON.stringify(e))}function j(e){let t=G(e?.type),n="any";t.length==1&&(n=t[0].split("<")[0]);const s=n;let l=(e?.selectable||"").trim(),$=[];return l&&n!="boolean"&&(l.includes("|")?l.split("|").forEach(p=>{if(p){let r=p.split(":");$.push({label:p,prop:r[0].trim()})}}):$=c.parseParamString(l),n=="function"?n="function":n=="array"?n="choice":n="select"),{arr:$,zdtype:s,type:n,dataType:t}}function G(e){let t=[];return(e||"").trim().toLowerCase().split(",").forEach(s=>{s=s.trim(),s&&t.push(s)}),[...new Set(t)].sort()}function I(e){try{return new Function(`{ return ${e} }`)()}catch{return""+e}}function K(e){const t=j(e),n=c.getTypeValue(t.dataType),s=(e.default||"").trim();return I(s||n)}exports.getDefaultValue=K;exports.getHmtl=v;exports.getSpecType=j;exports.setValStringify=F;
|
|
@@ -1,187 +1,199 @@
|
|
|
1
1
|
import "@fangzhongya/utils/basic/object/mergeObject";
|
|
2
2
|
import "@fangzhongya/utils/basic/array/toggleArray";
|
|
3
|
-
import { humpToLine as
|
|
3
|
+
import { humpToLine as H } from "@fangzhongya/utils/name/humpToLine";
|
|
4
4
|
import "@fangzhongya/utils/name/lineToLargeHump";
|
|
5
5
|
import "@fangzhongya/utils/basic/string/appearNum";
|
|
6
|
-
import { firstLower as
|
|
6
|
+
import { firstLower as U } from "@fangzhongya/utils/basic/string/firstLower";
|
|
7
7
|
import "@fangzhongya/utils/basic/array/duplicateRemoval";
|
|
8
8
|
import "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
9
|
-
import { firstUpper as
|
|
9
|
+
import { firstUpper as O } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
10
10
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
11
11
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
12
|
-
import {
|
|
13
|
-
import { getPropsValue as
|
|
14
|
-
import { getFunctionFormat as
|
|
15
|
-
const
|
|
16
|
-
function S(
|
|
17
|
-
return
|
|
12
|
+
import { getTypeValue as E, parseParamString as j, setDataType as Z, vueFormat as F, prettierFormat as q, getFunBody as x } from "./util.js";
|
|
13
|
+
import { getPropsValue as G, getEmitsValue as I, getExposeValue as K, getSlotValue as M } from "../../utils/props.js";
|
|
14
|
+
import { getFunctionFormat as Q } from "@fangzhongya/utils/basic/string/toFunction";
|
|
15
|
+
const R = ["class"];
|
|
16
|
+
function S(t, e) {
|
|
17
|
+
return t.filter((n) => n.name == e)[0];
|
|
18
18
|
}
|
|
19
|
-
function z(
|
|
20
|
-
return
|
|
19
|
+
function z(t) {
|
|
20
|
+
return t.map((e) => (e.prop || "...arr") + ":" + Z(e.dataType)).join(",");
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const p = [],
|
|
22
|
+
function ht(t, e, n, s, u, $) {
|
|
23
|
+
const p = [], o = [];
|
|
24
24
|
let y = !0;
|
|
25
|
-
const
|
|
26
|
-
Object.keys(
|
|
27
|
-
let a =
|
|
28
|
-
if (/^on[A-Z]/.test(
|
|
29
|
-
let i =
|
|
30
|
-
const c =
|
|
25
|
+
const B = G(e.propss || []), C = I(e.emitss || []), J = K(e.exposes || []), N = M(e.slots || []);
|
|
26
|
+
Object.keys(n).forEach((r) => {
|
|
27
|
+
let a = n[r];
|
|
28
|
+
if (/^on[A-Z]/.test(r) && typeof a == "function") {
|
|
29
|
+
let i = r.substring(2);
|
|
30
|
+
const c = r.split(":");
|
|
31
31
|
let m;
|
|
32
|
-
if (c.length > 1 ? (m = c[0] + c.slice(1).map((
|
|
33
|
-
let
|
|
34
|
-
|
|
32
|
+
if (c.length > 1 ? (m = c[0] + c.slice(1).map((f) => O(f)).join(""), i = U(i)) : (m = c[0], i = H(i)), c.includes("-")) {
|
|
33
|
+
let f = m.split("-");
|
|
34
|
+
f = f.map((h, V) => V != 0 ? O(h) : h), m = f.join("");
|
|
35
35
|
}
|
|
36
36
|
p.push(" @" + i + '="' + m + '"');
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const h =
|
|
40
|
-
|
|
41
|
-
}),
|
|
37
|
+
const l = S(C, i) || {}, d = l.selectable || "", b = j(d), g = z(b);
|
|
38
|
+
o.push(`// ${l.description} ${l.name}: (${l.selectable})`), o.push("function " + m + "(" + g + ") {"), b.forEach((f) => {
|
|
39
|
+
const h = f.name || "arr";
|
|
40
|
+
o.push(" console.log('" + f.label + "', " + h + ")");
|
|
41
|
+
}), o.push("}");
|
|
42
42
|
} else {
|
|
43
|
-
let i =
|
|
44
|
-
|
|
45
|
-
const c = S(
|
|
46
|
-
if (
|
|
43
|
+
let i = r;
|
|
44
|
+
R.includes(r) && (i = r + "1"), p.push(" :" + r + '="' + i + '"');
|
|
45
|
+
const c = S(B, r) || {}, m = P(c);
|
|
46
|
+
if (o.push(
|
|
47
47
|
`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`
|
|
48
48
|
), typeof a == "function")
|
|
49
|
-
|
|
50
|
-
"const " +
|
|
49
|
+
o.push(
|
|
50
|
+
"const " + r + " = " + D(a, r, u)
|
|
51
51
|
);
|
|
52
|
-
else if (y && (y = !1,
|
|
52
|
+
else if (y && (y = !1, o.unshift("import { ref } from 'vue';")), typeof a > "u")
|
|
53
53
|
if (m.type == "function") {
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const l = X(c);
|
|
55
|
+
o.push("const " + i + " = " + l + ";");
|
|
56
56
|
} else {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
"const " + i + " = ref(" + (
|
|
57
|
+
const l = E(m.dataType);
|
|
58
|
+
o.push(
|
|
59
|
+
"const " + i + " = ref(" + (l === "undefined" ? "" : l) + ");"
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
let
|
|
64
|
-
|
|
63
|
+
let l = w(a, r, u);
|
|
64
|
+
o.push("const " + i + " = ref(" + l + ");");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const a = S(
|
|
71
|
-
|
|
68
|
+
const T = Object.values($ || {});
|
|
69
|
+
T.length > 0 && (y && (y = !1, o.unshift("import { ref } from 'vue';")), p.unshift(' ref="refDom"'), o.push("const refDom = ref()"), T.forEach((r) => {
|
|
70
|
+
const a = S(J, r.name) || {};
|
|
71
|
+
o.push(
|
|
72
72
|
`// ${a.description} ${a.name}:(${a.selectable}) ${a.type}`
|
|
73
73
|
);
|
|
74
|
-
const i =
|
|
74
|
+
const i = r.name + "Value", c = j(a?.selectable || ""), m = [], l = r.params || [];
|
|
75
75
|
c.forEach((d, b) => {
|
|
76
76
|
const g = d.name;
|
|
77
77
|
if (g) {
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
"const " +
|
|
78
|
+
const f = g + r.name, h = l[b];
|
|
79
|
+
if (o.push(`// ${d.label}`), typeof h == "function")
|
|
80
|
+
o.push(
|
|
81
|
+
"const " + f + " = " + D(h, g, r.text)
|
|
82
82
|
);
|
|
83
83
|
else if (typeof h > "u")
|
|
84
|
-
|
|
85
|
-
"const " +
|
|
84
|
+
o.push(
|
|
85
|
+
"const " + f + " = " + E(d.dataType) + ";"
|
|
86
86
|
);
|
|
87
87
|
else {
|
|
88
|
-
let
|
|
89
|
-
|
|
88
|
+
let V = w(h, g, r.text);
|
|
89
|
+
o.push("const " + f + " = " + V + ";");
|
|
90
90
|
}
|
|
91
|
-
m.push(
|
|
91
|
+
m.push(f);
|
|
92
92
|
}
|
|
93
|
-
}),
|
|
94
|
-
`const ${i} = refDom.value?.${
|
|
95
|
-
) :
|
|
93
|
+
}), r.type === "function" ? o.push(
|
|
94
|
+
`const ${i} = refDom.value?.${r.name}(${m.join(", ")})`
|
|
95
|
+
) : o.push(`const ${i} = refDom.value?.${r.name}`), o.push(`console.log('"${a.type}"', ${i})`);
|
|
96
96
|
})), p.length > 0 && p.unshift("");
|
|
97
|
-
const
|
|
98
|
-
return `<!--${
|
|
97
|
+
const A = W(s, N);
|
|
98
|
+
return `<!--${t}-->
|
|
99
99
|
<template>
|
|
100
100
|
<div>
|
|
101
|
-
<${
|
|
102
|
-
`)}>${
|
|
101
|
+
<${t}${p.join(`
|
|
102
|
+
`)}>${A.join(`
|
|
103
103
|
`)}
|
|
104
|
-
</${
|
|
104
|
+
</${t}>
|
|
105
105
|
</div>
|
|
106
106
|
</template>
|
|
107
107
|
<script lang="ts" setup>
|
|
108
|
-
${
|
|
108
|
+
${o.join(`
|
|
109
109
|
`)}
|
|
110
110
|
<\/script>
|
|
111
111
|
`;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
const
|
|
115
|
-
return Object.keys(
|
|
116
|
-
const
|
|
113
|
+
function W(t = {}, e) {
|
|
114
|
+
const n = [];
|
|
115
|
+
return Object.keys(t).forEach((s) => {
|
|
116
|
+
const u = S(e, s) || {}, $ = t[s];
|
|
117
117
|
if ($) {
|
|
118
|
-
const p = ` <!-- ${
|
|
119
|
-
<template #${
|
|
120
|
-
${
|
|
118
|
+
const p = ` <!-- ${u.description} ${u.name}:(${u.selectable}) -->
|
|
119
|
+
<template #${s}="scope">
|
|
120
|
+
${F($, " ")}
|
|
121
121
|
</template>`;
|
|
122
|
-
|
|
122
|
+
n.push(p);
|
|
123
123
|
}
|
|
124
|
-
}),
|
|
124
|
+
}), n && n.length > 0 && n.unshift(""), n;
|
|
125
125
|
}
|
|
126
|
-
function D(
|
|
127
|
-
const
|
|
128
|
-
return
|
|
126
|
+
function D(t, e, n) {
|
|
127
|
+
const s = n ? n[e] : "";
|
|
128
|
+
return s || L(t.toString());
|
|
129
129
|
}
|
|
130
|
-
function L(
|
|
131
|
-
const e =
|
|
130
|
+
function L(t) {
|
|
131
|
+
const e = Q(q(t));
|
|
132
132
|
if (e) {
|
|
133
|
-
let
|
|
134
|
-
${
|
|
133
|
+
let n = `{
|
|
134
|
+
${F(x(e.body), " ")}
|
|
135
135
|
}`;
|
|
136
|
-
return `function (${e.param}) ${
|
|
136
|
+
return `function (${e.param}) ${n}`;
|
|
137
137
|
} else
|
|
138
138
|
return "undefined";
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const e = j(
|
|
142
|
-
let
|
|
143
|
-
|
|
144
|
-
let
|
|
145
|
-
${
|
|
140
|
+
function X(t) {
|
|
141
|
+
const e = j(t.selectable), n = z(e);
|
|
142
|
+
let s = "";
|
|
143
|
+
t.return && (s = "return ");
|
|
144
|
+
let u = `{
|
|
145
|
+
${F(x(s), " ")}
|
|
146
146
|
}`;
|
|
147
|
-
return `function (${
|
|
147
|
+
return `function (${n}) ${u}`;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
const e =
|
|
151
|
-
return /^\(/.test(e) ? L(e) : JSON.stringify(
|
|
149
|
+
function Y(t) {
|
|
150
|
+
const e = t.trim();
|
|
151
|
+
return /^\(/.test(e) ? L(e) : JSON.stringify(t);
|
|
152
152
|
}
|
|
153
|
-
function w(
|
|
154
|
-
const
|
|
155
|
-
return
|
|
153
|
+
function w(t, e, n) {
|
|
154
|
+
const s = n ? n[e] : "";
|
|
155
|
+
return s || (typeof t == "string" ? Y(t + "") : JSON.stringify(t));
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
let e = _(
|
|
159
|
-
e.length == 1 && (
|
|
160
|
-
const
|
|
161
|
-
let
|
|
162
|
-
return
|
|
157
|
+
function P(t) {
|
|
158
|
+
let e = _(t?.type), n = "any";
|
|
159
|
+
e.length == 1 && (n = e[0].split("<")[0]);
|
|
160
|
+
const s = n;
|
|
161
|
+
let u = (t?.selectable || "").trim(), $ = [];
|
|
162
|
+
return u && n != "boolean" && (u.includes("|") ? u.split("|").forEach((p) => {
|
|
163
163
|
if (p) {
|
|
164
|
-
let
|
|
164
|
+
let o = p.split(":");
|
|
165
165
|
$.push({
|
|
166
166
|
label: p,
|
|
167
|
-
prop:
|
|
167
|
+
prop: o[0].trim()
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
}) : $ = j(
|
|
170
|
+
}) : $ = j(u), n == "function" ? n = "function" : n == "array" ? n = "choice" : n = "select"), {
|
|
171
171
|
arr: $,
|
|
172
|
-
zdtype:
|
|
173
|
-
type:
|
|
172
|
+
zdtype: s,
|
|
173
|
+
type: n,
|
|
174
174
|
dataType: e
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
function _(
|
|
177
|
+
function _(t) {
|
|
178
178
|
let e = [];
|
|
179
|
-
return (
|
|
180
|
-
|
|
179
|
+
return (t || "").trim().toLowerCase().split(",").forEach((s) => {
|
|
180
|
+
s = s.trim(), s && e.push(s);
|
|
181
181
|
}), [...new Set(e)].sort();
|
|
182
182
|
}
|
|
183
|
+
function v(t) {
|
|
184
|
+
try {
|
|
185
|
+
return new Function(`{ return ${t} }`)();
|
|
186
|
+
} catch {
|
|
187
|
+
return "" + t;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function $t(t) {
|
|
191
|
+
const e = P(t), n = E(e.dataType), s = (t.default || "").trim();
|
|
192
|
+
return v(s || n);
|
|
193
|
+
}
|
|
183
194
|
export {
|
|
184
|
-
|
|
185
|
-
|
|
195
|
+
$t as getDefaultValue,
|
|
196
|
+
ht as getHmtl,
|
|
197
|
+
P as getSpecType,
|
|
186
198
|
w as setValStringify
|
|
187
199
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("vue"),g=require("./set-props.vue.cjs"),y=require("./set-emit.vue.cjs");;/* empty css */const T=require("./set-code.vue.cjs"),C=require("./set-expose.vue.cjs");;/* empty css */const b=require("./set-slot.vue.cjs"),l=require("../../utils/props.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const x=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const
|
|
1
|
+
"use strict";const s=require("vue"),g=require("./set-props.vue.cjs"),y=require("./set-emit.vue.cjs");;/* empty css */const T=require("./set-code.vue.cjs"),C=require("./set-expose.vue.cjs");;/* empty css */const b=require("./set-slot.vue.cjs"),E=require("./code.cjs"),l=require("../../utils/props.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const x=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const j=s.defineComponent({props:{value:{type:Object},param:{type:Object}},render(O,U,v,D,u){const p=s.reactive({emitValue:{},slotValue:{}}),r=v.value;let c="div";r.component?c=s.defineAsyncComponent(r.component):r.name&&(c=s.resolveComponent(r.name));const i=v.param||{},h=l.getPropsValue(i.propss||[]),m=l.getEmitsValue(i.emitss||[]),V=l.getExposeValue(i.exposes||[]),f=l.getSlotValue(i.slots||[]),a={},q={};h.forEach(t=>{let e=t.name;if(!e.includes(".")){let o=e.split("/");e=(o[0]||"").trim(),e&&(a[e]=u.propsValue[e]??E.getDefaultValue(t),o&&o.length>1&&m.push({name:"update:"+e,description:t.description,selectable:"value:["+t.type+"]"}))}}),m.forEach(t=>{let e=t.name;if(e.includes("-")){let n=e.split("-");n=n.map((_,P)=>x.firstUpper(_)),e=n.join("")}else e=x.firstUpper(e);const o="on"+e;a[o]=(...n)=>{const _={arr:n,_date_:new Date().getTime()};p.emitValue[t.name]=_}});let d;return f.forEach(t=>{const e=t.name||"default";q[e]=o=>{if(p.slotValue[e]){const n=p.slotValue[e];return s.h(s.defineComponent({props:{scope:{type:Object}},template:n}),{scope:o})}}}),s.h("div",{class:"use"},[s.h("div",{class:"use-props"},s.h(g,{name:r.name,list:h,onChange:(t,e)=>{u.propsValue=t,u.propsText=e}})),s.h("div",{class:"use-component"},s.h(c,{...a,ref:t=>{d=t}},q)),s.h("div",{class:"use-code"},s.h(T,{name:r.name,param:i,value:a,propsText:u.propsText,exposeText:u.exposeText,slotValue:p.slotValue})),s.h("div",{class:"use-emit"},s.h(y,{name:r.name,list:m,value:p.emitValue})),s.h("div",{class:"use-expose"},s.h(C,{name:r.name,list:V,getRef:()=>d,onChange:t=>{u.exposeText=t}})),s.h("div",{class:"use-slot"},s.h(b,{name:r.name,list:f,onChange:(t,e)=>{p.slotValue[t]=e}}))])},data(){return{propsValue:{},propsText:{},exposeText:{}}}});module.exports=j;
|
|
@@ -6,7 +6,8 @@ import E from "./set-code.vue.js";
|
|
|
6
6
|
import O from "./set-expose.vue.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
import $ from "./set-slot.vue.js";
|
|
9
|
-
import {
|
|
9
|
+
import { getDefaultValue as D } from "./code.js";
|
|
10
|
+
import { getPropsValue as U, getEmitsValue as k, getExposeValue as w, getSlotValue as A } from "../../utils/props.js";
|
|
10
11
|
import "@fangzhongya/utils/basic/object/mergeObject";
|
|
11
12
|
import "@fangzhongya/utils/basic/array/toggleArray";
|
|
12
13
|
import "@fangzhongya/utils/name/humpToLine";
|
|
@@ -18,7 +19,7 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
|
18
19
|
import { firstUpper as g } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
19
20
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
20
21
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
21
|
-
const
|
|
22
|
+
const me = _({
|
|
22
23
|
/**
|
|
23
24
|
* @props {Stinrg} value 插入数据
|
|
24
25
|
*/
|
|
@@ -30,19 +31,19 @@ const oe = _({
|
|
|
30
31
|
type: Object
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
|
-
render(
|
|
34
|
-
const
|
|
34
|
+
render(P, R, f, S, r) {
|
|
35
|
+
const n = T({
|
|
35
36
|
emitValue: {},
|
|
36
37
|
slotValue: {}
|
|
37
38
|
}), o = f.value;
|
|
38
39
|
let l = "div";
|
|
39
40
|
o.component ? l = b(o.component) : o.name && (l = j(o.name));
|
|
40
|
-
const a = f.param || {}, d =
|
|
41
|
+
const a = f.param || {}, d = U(a.propss || []), c = k(a.emitss || []), h = w(a.exposes || []), V = A(a.slots || []), i = {}, x = {};
|
|
41
42
|
d.forEach((t) => {
|
|
42
43
|
let e = t.name;
|
|
43
44
|
if (!e.includes(".")) {
|
|
44
45
|
let p = e.split("/");
|
|
45
|
-
e = (p[0] || "").trim(), e && (i[e] =
|
|
46
|
+
e = (p[0] || "").trim(), e && (i[e] = r.propsValue[e] ?? D(t), p && p.length > 1 && c.push({
|
|
46
47
|
name: "update:" + e,
|
|
47
48
|
description: t.description,
|
|
48
49
|
selectable: "value:[" + t.type + "]"
|
|
@@ -52,7 +53,7 @@ const oe = _({
|
|
|
52
53
|
let e = t.name;
|
|
53
54
|
if (e.includes("-")) {
|
|
54
55
|
let m = e.split("-");
|
|
55
|
-
m = m.map((u,
|
|
56
|
+
m = m.map((u, q) => g(u)), e = m.join("");
|
|
56
57
|
} else
|
|
57
58
|
e = g(e);
|
|
58
59
|
const p = "on" + e;
|
|
@@ -61,15 +62,15 @@ const oe = _({
|
|
|
61
62
|
arr: m,
|
|
62
63
|
_date_: (/* @__PURE__ */ new Date()).getTime()
|
|
63
64
|
};
|
|
64
|
-
|
|
65
|
+
n.emitValue[t.name] = u;
|
|
65
66
|
};
|
|
66
67
|
});
|
|
67
68
|
let v;
|
|
68
|
-
return
|
|
69
|
+
return V.forEach((t) => {
|
|
69
70
|
const e = t.name || "default";
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
const m =
|
|
71
|
+
x[e] = (p) => {
|
|
72
|
+
if (n.slotValue[e]) {
|
|
73
|
+
const m = n.slotValue[e];
|
|
73
74
|
return s(
|
|
74
75
|
_({
|
|
75
76
|
props: {
|
|
@@ -100,7 +101,7 @@ const oe = _({
|
|
|
100
101
|
name: o.name,
|
|
101
102
|
list: d,
|
|
102
103
|
onChange: (t, e) => {
|
|
103
|
-
|
|
104
|
+
r.propsValue = t, r.propsText = e;
|
|
104
105
|
}
|
|
105
106
|
})
|
|
106
107
|
),
|
|
@@ -117,7 +118,7 @@ const oe = _({
|
|
|
117
118
|
v = t;
|
|
118
119
|
}
|
|
119
120
|
},
|
|
120
|
-
|
|
121
|
+
x
|
|
121
122
|
)
|
|
122
123
|
),
|
|
123
124
|
s(
|
|
@@ -129,9 +130,9 @@ const oe = _({
|
|
|
129
130
|
name: o.name,
|
|
130
131
|
param: a,
|
|
131
132
|
value: i,
|
|
132
|
-
propsText:
|
|
133
|
-
exposeText:
|
|
134
|
-
slotValue:
|
|
133
|
+
propsText: r.propsText,
|
|
134
|
+
exposeText: r.exposeText,
|
|
135
|
+
slotValue: n.slotValue
|
|
135
136
|
})
|
|
136
137
|
),
|
|
137
138
|
s(
|
|
@@ -142,7 +143,7 @@ const oe = _({
|
|
|
142
143
|
s(y, {
|
|
143
144
|
name: o.name,
|
|
144
145
|
list: c,
|
|
145
|
-
value:
|
|
146
|
+
value: n.emitValue
|
|
146
147
|
})
|
|
147
148
|
),
|
|
148
149
|
s(
|
|
@@ -155,7 +156,7 @@ const oe = _({
|
|
|
155
156
|
list: h,
|
|
156
157
|
getRef: () => v,
|
|
157
158
|
onChange: (t) => {
|
|
158
|
-
|
|
159
|
+
r.exposeText = t;
|
|
159
160
|
}
|
|
160
161
|
})
|
|
161
162
|
),
|
|
@@ -166,9 +167,9 @@ const oe = _({
|
|
|
166
167
|
},
|
|
167
168
|
s($, {
|
|
168
169
|
name: o.name,
|
|
169
|
-
list:
|
|
170
|
+
list: V,
|
|
170
171
|
onChange: (t, e) => {
|
|
171
|
-
|
|
172
|
+
n.slotValue[t] = e;
|
|
172
173
|
}
|
|
173
174
|
})
|
|
174
175
|
)
|
|
@@ -191,5 +192,5 @@ const oe = _({
|
|
|
191
192
|
// },
|
|
192
193
|
});
|
|
193
194
|
export {
|
|
194
|
-
|
|
195
|
+
me as default
|
|
195
196
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@fangzhongya/utils/basic/string/toFunction"),
|
|
2
|
-
`)}function
|
|
3
|
-
|\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+n+"$").exec(e);return r&&r.length>0?
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@fangzhongya/utils/basic/string/toFunction"),w=require("@fangzhongya/utils/basic/string/firstLower");function y(e){return e.replace(/\;(\s|\n\r)*$/,"")}function O(e){return e="let a = "+e,y(e).replace(/^let a = /,"")}function A(e){return y(e)}function x(e,n=""){let t=(e+"").trim().split(/\n/);return t=t.map(r=>n+r),t.join(`
|
|
2
|
+
`)}function b(e=""){e=e.trim();let n=`[\\s|\\n|\\r]*\\{((.|
|
|
3
|
+
|\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+n+"$").exec(e);return r&&r.length>0?b(r[1]):e}const W=["Boolean","Any","String","Number","Array","Object","Function"];function k(e){return W.includes(e)?w.firstLower(e):e}function v(e){let t=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(t&&t.length>0)return{own:k(t[1]),son:t[2]}}function d(e,n){let t=v(e);t?(n.push(t.own),t.son&&d(t.son,n)):n.push(e)}function h(e){e instanceof Array&&(e=e[0]);const n=[];return e&&d(e,n),n}function T(e){const n=Object.prototype.toString.call(e);let r=/^\[[O|o]bject (.*)\]$/.exec(n),i=typeof e;return r&&r.length>0&&(i=r[1].toLowerCase()),i}function E(e,n){const t=T(e),r=h(n)[0];return r&&r!="any"?t==r:!0}function q(e){if(typeof e=="string"){let n=!1;return(/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e))&&(n=!0),n&&(e=e.substring(1,e.length-1)),e+""}else return typeof e=="object"&&e?e.toString():typeof e>"u"||typeof e=="object"&&!e?"":e+""}function B(e){e=(e+"").replace(/^(\s|\n|r)*/,"").replace(/(\s|\n|r)*$/,"");let n="";return/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e)?n="string":/^\[(.|\n|\r)*\]$/.test(e)?n="array":/^\{(.|\n|\r)*\}$/.test(e)?n="object":/^[0-9]*$/.test(e)?n="number":e==="true"||e==="false"?n="boolean":e=="undefined"?n="undefined":e=="null"?n="null":e&&(n="string"),n}function F(e){switch((e[0]||"any").toLowerCase()){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":let t=F(e.splice(1));return t=t=="undefined"?"":t,`[${t}]`;case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function L(e){let n="";return e.forEach((t,r)=>{t=t.trim(),t&&(n&&(n+=" | "),t==="Array"?n+="Array<any>":n+=t)}),n||"any"}const g=(e,n)=>{let t=[],r=[],i="";for(let u=0;u<e.length;u++){const s=e[u];s==="["||s==="<"||s==="("?(t.push(s),i+=s):s==="]"&&t.length>0&&t[t.length-1]==="["||s===">"&&t.length>0&&t[t.length-1]==="<"||s===")"&&t.length>0&&t[t.length-1]==="("?(t.pop(),i+=s):s===n&&t.length===0?(r.push(i.trim()),i=""):i+=s}return i.trim()!==""&&r.push(i.trim()),r},C=e=>{if(e)if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=g(n,",");return{type:t[0]||"any",dataType:t}}else if(e.startsWith("<")&&e.endsWith(">")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=g(n,"|");return{type:t[0]||"any",dataType:t}}else return{type:e,dataType:[e]};else return{type:"any",dataType:["any"]}};function M(e){return g(e,",").map(t=>{const r=t.trim(),i=t.match(/^([^:?]+)(\??):/);if(!i)return null;const u=i[1].trim(),s=!i[2],j=i[0].length,c=t.substring(j).trim();let a=[],f="",p="";for(let l=0;l<c.length;l++){const o=c[l];if(o==="["||o==="<"||o==="("?a.push(o):(o==="]"&&a[a.length-1]==="["||o===">"&&a[a.length-1]==="<"||o===")"&&a[a.length-1]==="(")&&a.pop(),a.length===0&&l>0){l==1&&o!=="]"&&o!==">"&&o!==")"?(f="",p=c.substring(0)):(f=c.substring(0,l+1).trim(),p=c.substring(l+1));break}}const{type:N,dataType:m}=C(f),$=h(m);return{name:u,prop:u,type:$[0],dataType:m,must:s,label:r,description:p}}).filter(Boolean)}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>S.getFunctionFormat});exports.getFunBody=b;exports.getObjType=T;exports.getSonType=h;exports.getString=q;exports.getTypeValue=F;exports.isDefaultType=B;exports.isTypeEqual=E;exports.parseParamString=M;exports.prettierArrFormat=A;exports.prettierFormat=y;exports.prettierObjFormat=O;exports.setDataType=L;exports.vueFormat=x;
|
|
@@ -3,13 +3,13 @@ import { firstLower as $ } from "@fangzhongya/utils/basic/string/firstLower";
|
|
|
3
3
|
function h(e) {
|
|
4
4
|
return e.replace(/\;(\s|\n\r)*$/, "");
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function E(e) {
|
|
7
7
|
return e = "let a = " + e, h(e).replace(/^let a = /, "");
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function v(e) {
|
|
10
10
|
return h(e);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function B(e, n = "") {
|
|
13
13
|
let t = (e + "").trim().split(/\n/);
|
|
14
14
|
return t = t.map((r) => n + r), t.join(`
|
|
15
15
|
`);
|
|
@@ -32,7 +32,7 @@ const S = [
|
|
|
32
32
|
function w(e) {
|
|
33
33
|
return S.includes(e) ? $(e) : e;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function x(e) {
|
|
36
36
|
let t = new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);
|
|
37
37
|
if (t && t.length > 0)
|
|
38
38
|
return {
|
|
@@ -41,7 +41,7 @@ function F(e) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
function m(e, n) {
|
|
44
|
-
let t =
|
|
44
|
+
let t = x(e);
|
|
45
45
|
t ? (n.push(t.own), t.son && m(t.son, n)) : n.push(e);
|
|
46
46
|
}
|
|
47
47
|
function b(e) {
|
|
@@ -49,13 +49,13 @@ function b(e) {
|
|
|
49
49
|
const n = [];
|
|
50
50
|
return e && m(e, n), n;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function F(e) {
|
|
53
53
|
const n = Object.prototype.toString.call(e);
|
|
54
54
|
let r = /^\[[O|o]bject (.*)\]$/.exec(n), i = typeof e;
|
|
55
55
|
return r && r.length > 0 && (i = r[1].toLowerCase()), i;
|
|
56
56
|
}
|
|
57
57
|
function L(e, n) {
|
|
58
|
-
const t =
|
|
58
|
+
const t = F(e), r = b(n)[0];
|
|
59
59
|
return r && r != "any" ? t == r : !0;
|
|
60
60
|
}
|
|
61
61
|
function C(e) {
|
|
@@ -69,7 +69,7 @@ function N(e) {
|
|
|
69
69
|
let n = "";
|
|
70
70
|
return /^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e) ? n = "string" : /^\[(.|\n|\r)*\]$/.test(e) ? n = "array" : /^\{(.|\n|\r)*\}$/.test(e) ? n = "object" : /^[0-9]*$/.test(e) ? n = "number" : e === "true" || e === "false" ? n = "boolean" : e == "undefined" ? n = "undefined" : e == "null" ? n = "null" : e && (n = "string"), n;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function A(e) {
|
|
73
73
|
switch ((e[0] || "any").toLowerCase()) {
|
|
74
74
|
case "string":
|
|
75
75
|
return '""';
|
|
@@ -78,7 +78,7 @@ function x(e) {
|
|
|
78
78
|
case "number":
|
|
79
79
|
return "0";
|
|
80
80
|
case "array":
|
|
81
|
-
let t =
|
|
81
|
+
let t = A(e.splice(1));
|
|
82
82
|
return t = t == "undefined" ? "" : t, `[${t}]`;
|
|
83
83
|
case "object":
|
|
84
84
|
return "{}";
|
|
@@ -91,12 +91,15 @@ function x(e) {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
function R(e) {
|
|
94
|
-
|
|
94
|
+
let n = "";
|
|
95
|
+
return e.forEach((t, r) => {
|
|
96
|
+
t = t.trim(), t && (n && (n += " | "), t === "Array" ? n += "Array<any>" : n += t);
|
|
97
|
+
}), n || "any";
|
|
95
98
|
}
|
|
96
99
|
const g = (e, n) => {
|
|
97
100
|
let t = [], r = [], i = "";
|
|
98
|
-
for (let
|
|
99
|
-
const s = e[
|
|
101
|
+
for (let u = 0; u < e.length; u++) {
|
|
102
|
+
const s = e[u];
|
|
100
103
|
s === "[" || s === "<" || s === "(" ? (t.push(s), i += s) : s === "]" && t.length > 0 && t[t.length - 1] === "[" || s === ">" && t.length > 0 && t[t.length - 1] === "<" || s === ")" && t.length > 0 && t[t.length - 1] === "(" ? (t.pop(), i += s) : s === n && t.length === 0 ? (r.push(i.trim()), i = "") : i += s;
|
|
101
104
|
}
|
|
102
105
|
return i.trim() !== "" && r.push(i.trim()), r;
|
|
@@ -129,19 +132,19 @@ function q(e) {
|
|
|
129
132
|
return g(e, ",").map((t) => {
|
|
130
133
|
const r = t.trim(), i = t.match(/^([^:?]+)(\??):/);
|
|
131
134
|
if (!i) return null;
|
|
132
|
-
const
|
|
135
|
+
const u = i[1].trim(), s = !i[2], d = i[0].length, c = t.substring(d).trim();
|
|
133
136
|
let l = [], f = "", p = "";
|
|
134
|
-
for (let
|
|
135
|
-
const o = c[
|
|
136
|
-
if (o === "[" || o === "<" || o === "(" ? l.push(o) : (o === "]" && l[l.length - 1] === "[" || o === ">" && l[l.length - 1] === "<" || o === ")" && l[l.length - 1] === "(") && l.pop(), l.length === 0 &&
|
|
137
|
-
|
|
137
|
+
for (let a = 0; a < c.length; a++) {
|
|
138
|
+
const o = c[a];
|
|
139
|
+
if (o === "[" || o === "<" || o === "(" ? l.push(o) : (o === "]" && l[l.length - 1] === "[" || o === ">" && l[l.length - 1] === "<" || o === ")" && l[l.length - 1] === "(") && l.pop(), l.length === 0 && a > 0) {
|
|
140
|
+
a == 1 && o !== "]" && o !== ">" && o !== ")" ? (f = "", p = c.substring(0)) : (f = c.substring(0, a + 1).trim(), p = c.substring(a + 1));
|
|
138
141
|
break;
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
const { type: k, dataType: y } = W(f), T = b(y);
|
|
142
145
|
return {
|
|
143
|
-
name:
|
|
144
|
-
prop:
|
|
146
|
+
name: u,
|
|
147
|
+
prop: u,
|
|
145
148
|
type: T[0],
|
|
146
149
|
dataType: y,
|
|
147
150
|
must: s,
|
|
@@ -153,16 +156,16 @@ function q(e) {
|
|
|
153
156
|
export {
|
|
154
157
|
j as getFunBody,
|
|
155
158
|
M as getFunctionFormat,
|
|
156
|
-
|
|
159
|
+
F as getObjType,
|
|
157
160
|
b as getSonType,
|
|
158
161
|
C as getString,
|
|
159
|
-
|
|
162
|
+
A as getTypeValue,
|
|
160
163
|
N as isDefaultType,
|
|
161
164
|
L as isTypeEqual,
|
|
162
165
|
q as parseParamString,
|
|
163
|
-
|
|
166
|
+
v as prettierArrFormat,
|
|
164
167
|
h as prettierFormat,
|
|
165
|
-
|
|
168
|
+
E as prettierObjFormat,
|
|
166
169
|
R as setDataType,
|
|
167
|
-
|
|
170
|
+
B as vueFormat
|
|
168
171
|
};
|