@fangzhongya/vue-archive 0.0.32 → 0.0.33
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 +57 -28
- package/dist/node/index.js +57 -28
- package/dist/packages/components/use/util.cjs +3 -3
- package/dist/packages/components/use/util.js +107 -88
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -3138,35 +3138,63 @@ function getTypeValue(arr) {
|
|
|
3138
3138
|
return "undefined";
|
|
3139
3139
|
}
|
|
3140
3140
|
}
|
|
3141
|
-
function
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3141
|
+
function setDataType(arr) {
|
|
3142
|
+
return arr.join("|") || "any";
|
|
3143
|
+
}
|
|
3144
|
+
var splitIgnoringNesting = (str, delimiter) => {
|
|
3145
|
+
let bracketStack = [];
|
|
3146
|
+
let parts = [];
|
|
3147
|
+
let current = "";
|
|
3148
|
+
for (let i = 0; i < str.length; i++) {
|
|
3149
|
+
const char = str[i];
|
|
3150
|
+
if (char === "[" || char === "<" || char === "(") {
|
|
3151
|
+
bracketStack.push(char);
|
|
3152
|
+
current += char;
|
|
3153
|
+
} else if (char === "]" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "<" || char === ")" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "(") {
|
|
3154
|
+
bracketStack.pop();
|
|
3155
|
+
current += char;
|
|
3156
|
+
} else if (char === delimiter && bracketStack.length === 0) {
|
|
3157
|
+
parts.push(current.trim());
|
|
3158
|
+
current = "";
|
|
3148
3159
|
} else {
|
|
3149
|
-
|
|
3150
|
-
let rts = reg.exec(str);
|
|
3151
|
-
if (rts && rts.length > 0) {
|
|
3152
|
-
let ass = rts[1];
|
|
3153
|
-
arr = ass.split("|");
|
|
3154
|
-
} else {
|
|
3155
|
-
arr = ["any"];
|
|
3156
|
-
}
|
|
3160
|
+
current += char;
|
|
3157
3161
|
}
|
|
3162
|
+
}
|
|
3163
|
+
if (current.trim() !== "") {
|
|
3164
|
+
parts.push(current.trim());
|
|
3165
|
+
}
|
|
3166
|
+
return parts;
|
|
3167
|
+
};
|
|
3168
|
+
var parseTypeDefinition = (typeDef) => {
|
|
3169
|
+
if (!typeDef || typeDef === "[]") {
|
|
3170
|
+
return { type: "any", dataType: ["any"] };
|
|
3171
|
+
} else if (typeDef.startsWith("[") && typeDef.endsWith("]")) {
|
|
3172
|
+
const inner = typeDef.slice(1, -1).trim();
|
|
3173
|
+
if (!inner) return { type: "any", dataType: ["any"] };
|
|
3174
|
+
const types = splitIgnoringNesting(inner, ",");
|
|
3175
|
+
return {
|
|
3176
|
+
type: types[0] || "any",
|
|
3177
|
+
dataType: types
|
|
3178
|
+
};
|
|
3179
|
+
} else if (typeDef.startsWith("<") && typeDef.endsWith(">")) {
|
|
3180
|
+
const inner = typeDef.slice(1, -1).trim();
|
|
3181
|
+
if (!inner) return { type: "any", dataType: ["any"] };
|
|
3182
|
+
const types = splitIgnoringNesting(inner, "|");
|
|
3183
|
+
return {
|
|
3184
|
+
type: types[0] || "any",
|
|
3185
|
+
dataType: types
|
|
3186
|
+
};
|
|
3158
3187
|
} else {
|
|
3159
|
-
|
|
3188
|
+
return {
|
|
3189
|
+
type: typeDef,
|
|
3190
|
+
dataType: [typeDef]
|
|
3191
|
+
};
|
|
3160
3192
|
}
|
|
3161
|
-
|
|
3162
|
-
}
|
|
3163
|
-
function setDataType(arr) {
|
|
3164
|
-
return arr.join("|") || "any";
|
|
3165
|
-
}
|
|
3193
|
+
};
|
|
3166
3194
|
function parseParamString(input) {
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
const label = trimmedPart;
|
|
3195
|
+
const parts = splitIgnoringNesting(input, ",");
|
|
3196
|
+
return parts.map((trimmedPart) => {
|
|
3197
|
+
const label = trimmedPart.trim();
|
|
3170
3198
|
const nameMatch = trimmedPart.match(/^([^:?]+)(\??):/);
|
|
3171
3199
|
if (!nameMatch) return null;
|
|
3172
3200
|
const name = nameMatch[1].trim();
|
|
@@ -3191,12 +3219,13 @@ function parseParamString(input) {
|
|
|
3191
3219
|
break;
|
|
3192
3220
|
}
|
|
3193
3221
|
}
|
|
3194
|
-
|
|
3222
|
+
const { type, dataType } = parseTypeDefinition(t);
|
|
3223
|
+
const tarr = getSonType(dataType);
|
|
3195
3224
|
return {
|
|
3196
3225
|
name,
|
|
3197
3226
|
prop: name,
|
|
3198
3227
|
type: tarr[0],
|
|
3199
|
-
dataType
|
|
3228
|
+
dataType,
|
|
3200
3229
|
must,
|
|
3201
3230
|
label,
|
|
3202
3231
|
description
|
|
@@ -3421,7 +3450,7 @@ function setValStringify(v, key, propsText) {
|
|
|
3421
3450
|
}
|
|
3422
3451
|
}
|
|
3423
3452
|
function getSpecType(val) {
|
|
3424
|
-
let tarr =
|
|
3453
|
+
let tarr = getType(val?.type);
|
|
3425
3454
|
let type = "any";
|
|
3426
3455
|
if (tarr.length == 1) {
|
|
3427
3456
|
type = tarr[0].split("<")[0];
|
|
@@ -3454,7 +3483,7 @@ function getSpecType(val) {
|
|
|
3454
3483
|
dataType: tarr
|
|
3455
3484
|
};
|
|
3456
3485
|
}
|
|
3457
|
-
function
|
|
3486
|
+
function getType(value) {
|
|
3458
3487
|
let arr = [];
|
|
3459
3488
|
let str = (value || "").trim().toLowerCase();
|
|
3460
3489
|
str.split(",").forEach((v) => {
|
package/dist/node/index.js
CHANGED
|
@@ -3123,35 +3123,63 @@ function getTypeValue(arr) {
|
|
|
3123
3123
|
return "undefined";
|
|
3124
3124
|
}
|
|
3125
3125
|
}
|
|
3126
|
-
function
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3126
|
+
function setDataType(arr) {
|
|
3127
|
+
return arr.join("|") || "any";
|
|
3128
|
+
}
|
|
3129
|
+
var splitIgnoringNesting = (str, delimiter) => {
|
|
3130
|
+
let bracketStack = [];
|
|
3131
|
+
let parts = [];
|
|
3132
|
+
let current = "";
|
|
3133
|
+
for (let i = 0; i < str.length; i++) {
|
|
3134
|
+
const char = str[i];
|
|
3135
|
+
if (char === "[" || char === "<" || char === "(") {
|
|
3136
|
+
bracketStack.push(char);
|
|
3137
|
+
current += char;
|
|
3138
|
+
} else if (char === "]" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "<" || char === ")" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "(") {
|
|
3139
|
+
bracketStack.pop();
|
|
3140
|
+
current += char;
|
|
3141
|
+
} else if (char === delimiter && bracketStack.length === 0) {
|
|
3142
|
+
parts.push(current.trim());
|
|
3143
|
+
current = "";
|
|
3133
3144
|
} else {
|
|
3134
|
-
|
|
3135
|
-
let rts = reg.exec(str);
|
|
3136
|
-
if (rts && rts.length > 0) {
|
|
3137
|
-
let ass = rts[1];
|
|
3138
|
-
arr = ass.split("|");
|
|
3139
|
-
} else {
|
|
3140
|
-
arr = ["any"];
|
|
3141
|
-
}
|
|
3145
|
+
current += char;
|
|
3142
3146
|
}
|
|
3147
|
+
}
|
|
3148
|
+
if (current.trim() !== "") {
|
|
3149
|
+
parts.push(current.trim());
|
|
3150
|
+
}
|
|
3151
|
+
return parts;
|
|
3152
|
+
};
|
|
3153
|
+
var parseTypeDefinition = (typeDef) => {
|
|
3154
|
+
if (!typeDef || typeDef === "[]") {
|
|
3155
|
+
return { type: "any", dataType: ["any"] };
|
|
3156
|
+
} else if (typeDef.startsWith("[") && typeDef.endsWith("]")) {
|
|
3157
|
+
const inner = typeDef.slice(1, -1).trim();
|
|
3158
|
+
if (!inner) return { type: "any", dataType: ["any"] };
|
|
3159
|
+
const types = splitIgnoringNesting(inner, ",");
|
|
3160
|
+
return {
|
|
3161
|
+
type: types[0] || "any",
|
|
3162
|
+
dataType: types
|
|
3163
|
+
};
|
|
3164
|
+
} else if (typeDef.startsWith("<") && typeDef.endsWith(">")) {
|
|
3165
|
+
const inner = typeDef.slice(1, -1).trim();
|
|
3166
|
+
if (!inner) return { type: "any", dataType: ["any"] };
|
|
3167
|
+
const types = splitIgnoringNesting(inner, "|");
|
|
3168
|
+
return {
|
|
3169
|
+
type: types[0] || "any",
|
|
3170
|
+
dataType: types
|
|
3171
|
+
};
|
|
3143
3172
|
} else {
|
|
3144
|
-
|
|
3173
|
+
return {
|
|
3174
|
+
type: typeDef,
|
|
3175
|
+
dataType: [typeDef]
|
|
3176
|
+
};
|
|
3145
3177
|
}
|
|
3146
|
-
|
|
3147
|
-
}
|
|
3148
|
-
function setDataType(arr) {
|
|
3149
|
-
return arr.join("|") || "any";
|
|
3150
|
-
}
|
|
3178
|
+
};
|
|
3151
3179
|
function parseParamString(input) {
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
const label = trimmedPart;
|
|
3180
|
+
const parts = splitIgnoringNesting(input, ",");
|
|
3181
|
+
return parts.map((trimmedPart) => {
|
|
3182
|
+
const label = trimmedPart.trim();
|
|
3155
3183
|
const nameMatch = trimmedPart.match(/^([^:?]+)(\??):/);
|
|
3156
3184
|
if (!nameMatch) return null;
|
|
3157
3185
|
const name = nameMatch[1].trim();
|
|
@@ -3176,12 +3204,13 @@ function parseParamString(input) {
|
|
|
3176
3204
|
break;
|
|
3177
3205
|
}
|
|
3178
3206
|
}
|
|
3179
|
-
|
|
3207
|
+
const { type, dataType } = parseTypeDefinition(t);
|
|
3208
|
+
const tarr = getSonType(dataType);
|
|
3180
3209
|
return {
|
|
3181
3210
|
name,
|
|
3182
3211
|
prop: name,
|
|
3183
3212
|
type: tarr[0],
|
|
3184
|
-
dataType
|
|
3213
|
+
dataType,
|
|
3185
3214
|
must,
|
|
3186
3215
|
label,
|
|
3187
3216
|
description
|
|
@@ -3406,7 +3435,7 @@ function setValStringify(v, key, propsText) {
|
|
|
3406
3435
|
}
|
|
3407
3436
|
}
|
|
3408
3437
|
function getSpecType(val) {
|
|
3409
|
-
let tarr =
|
|
3438
|
+
let tarr = getType(val?.type);
|
|
3410
3439
|
let type = "any";
|
|
3411
3440
|
if (tarr.length == 1) {
|
|
3412
3441
|
type = tarr[0].split("<")[0];
|
|
@@ -3439,7 +3468,7 @@ function getSpecType(val) {
|
|
|
3439
3468
|
dataType: tarr
|
|
3440
3469
|
};
|
|
3441
3470
|
}
|
|
3442
|
-
function
|
|
3471
|
+
function getType(value) {
|
|
3443
3472
|
let arr = [];
|
|
3444
3473
|
let str = (value || "").trim().toLowerCase();
|
|
3445
3474
|
str.split(",").forEach((v) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`)}function
|
|
3
|
-
|\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("@fangzhongya/utils/basic/string/toFunction"),w=require("@fangzhongya/utils/basic/string/firstLower");function g(e){return e.replace(/\;(\s|\n\r)*$/,"")}function O(e){return e="let a = "+e,g(e).replace(/^let a = /,"")}function x(e){return g(e)}function A(e,n=""){let t=(e+"").trim().split(/\n/);return t=t.map(r=>n+r),t.join(`
|
|
2
|
+
`)}function d(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?d(r[1]):e}const k=["Boolean","Any","String","Number","Array","Object","Function"];function q(e){return k.includes(e)?w.firstLower(e):e}function B(e){let t=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(t&&t.length>0)return{own:q(t[1]),son:t[2]}}function T(e,n){let t=B(e);t?(n.push(t.own),t.son&&T(t.son,n)):n.push(e)}function y(e){e instanceof Array&&(e=e[0]);const n=[];return e&&T(e,n),n}function j(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=j(e),r=y(n)[0];return r&&r!="any"?t==r:!0}function L(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 W(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 C(e){return e.join("|")||"any"}const p=(e,n)=>{let t=[],r=[],i="";for(let a=0;a<e.length;a++){const o=e[a];o==="["||o==="<"||o==="("?(t.push(o),i+=o):o==="]"&&t.length>0&&t[t.length-1]==="["||o===">"&&t.length>0&&t[t.length-1]==="<"||o===")"&&t.length>0&&t[t.length-1]==="("?(t.pop(),i+=o):o===n&&t.length===0?(r.push(i.trim()),i=""):i+=o}return i.trim()!==""&&r.push(i.trim()),r},I=e=>{if(!e||e==="[]")return{type:"any",dataType:["any"]};if(e.startsWith("[")&&e.endsWith("]")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=p(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=p(n,"|");return{type:t[0]||"any",dataType:t}}else return{type:e,dataType:[e]}};function M(e){return p(e,",").map(t=>{const r=t.trim(),i=t.match(/^([^:?]+)(\??):/);if(!i)return null;const a=i[1].trim(),o=!i[2],$=i[0].length,c=t.substring($).trim();let s=[],f=-1,h="",m="";for(let u=0;u<c.length;u++){const l=c[u];if(l==="["||l==="<"||l==="("?s.push(l):(l==="]"&&s[s.length-1]==="["||l===">"&&s[s.length-1]==="<"||l===")"&&s[s.length-1]==="(")&&s.pop(),s.length===0&&u>0){f=u==1?0:u,h=c.substring(0,f+1).trim(),m=c.substring(f+1);break}}const{type:N,dataType:b}=I(h),S=y(b);return{name:a,prop:a,type:S[0],dataType:b,must:o,label:r,description:m}}).filter(Boolean)}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>v.getFunctionFormat});exports.getFunBody=d;exports.getObjType=j;exports.getSonType=y;exports.getString=L;exports.getTypeValue=F;exports.isDefaultType=W;exports.isTypeEqual=E;exports.parseParamString=M;exports.prettierArrFormat=x;exports.prettierFormat=g;exports.prettierObjFormat=O;exports.setDataType=C;exports.vueFormat=A;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { getFunctionFormat as
|
|
1
|
+
import { getFunctionFormat as V } from "@fangzhongya/utils/basic/string/toFunction";
|
|
2
2
|
import { firstLower as j } from "@fangzhongya/utils/basic/string/firstLower";
|
|
3
|
-
function
|
|
3
|
+
function m(e) {
|
|
4
4
|
return e.replace(/\;(\s|\n\r)*$/, "");
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return e = "let a = " + e,
|
|
6
|
+
function B(e) {
|
|
7
|
+
return e = "let a = " + e, m(e).replace(/^let a = /, "");
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function E(e) {
|
|
10
|
+
return m(e);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
return
|
|
12
|
+
function L(e, n = "") {
|
|
13
|
+
let t = (e + "").trim().split(/\n/);
|
|
14
|
+
return t = t.map((r) => n + r), t.join(`
|
|
15
15
|
`);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function S(e = "") {
|
|
18
18
|
e = e.trim();
|
|
19
|
-
let
|
|
20
|
-
|\r)+?)\\}[\\s|\\n|\\r]*`, r = new RegExp("^" +
|
|
21
|
-
return r && r.length > 0 ?
|
|
19
|
+
let n = `[\\s|\\n|\\r]*\\{((.|
|
|
20
|
+
|\r)+?)\\}[\\s|\\n|\\r]*`, r = new RegExp("^" + n + "$").exec(e);
|
|
21
|
+
return r && r.length > 0 ? S(r[1]) : e;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const w = [
|
|
24
24
|
"Boolean",
|
|
25
25
|
"Any",
|
|
26
26
|
"String",
|
|
@@ -29,47 +29,47 @@ const x = [
|
|
|
29
29
|
"Object",
|
|
30
30
|
"Function"
|
|
31
31
|
];
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function x(e) {
|
|
33
|
+
return w.includes(e) ? j(e) : e;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
let
|
|
37
|
-
if (
|
|
35
|
+
function F(e) {
|
|
36
|
+
let t = new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);
|
|
37
|
+
if (t && t.length > 0)
|
|
38
38
|
return {
|
|
39
|
-
own:
|
|
40
|
-
son:
|
|
39
|
+
own: x(t[1]),
|
|
40
|
+
son: t[2]
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
let
|
|
45
|
-
|
|
43
|
+
function d(e, n) {
|
|
44
|
+
let t = F(e);
|
|
45
|
+
t ? (n.push(t.own), t.son && d(t.son, n)) : n.push(e);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function b(e) {
|
|
48
48
|
e instanceof Array && (e = e[0]);
|
|
49
|
-
const
|
|
50
|
-
return e &&
|
|
49
|
+
const n = [];
|
|
50
|
+
return e && d(e, n), n;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
const
|
|
54
|
-
let r = /^\[[O|o]bject (.*)\]$/.exec(
|
|
55
|
-
return r && r.length > 0 && (
|
|
52
|
+
function v(e) {
|
|
53
|
+
const n = Object.prototype.toString.call(e);
|
|
54
|
+
let r = /^\[[O|o]bject (.*)\]$/.exec(n), i = typeof e;
|
|
55
|
+
return r && r.length > 0 && (i = r[1].toLowerCase()), i;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
return r && r != "any" ?
|
|
57
|
+
function C(e, n) {
|
|
58
|
+
const t = v(e), r = b(n)[0];
|
|
59
|
+
return r && r != "any" ? t == r : !0;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function I(e) {
|
|
62
62
|
if (typeof e == "string") {
|
|
63
|
-
let
|
|
64
|
-
return (/^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e)) && (
|
|
63
|
+
let n = !1;
|
|
64
|
+
return (/^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e)) && (n = !0), n && (e = e.substring(1, e.length - 1)), e + "";
|
|
65
65
|
} else return typeof e == "object" && e ? e.toString() : typeof e > "u" || typeof e == "object" && !e ? "" : e + "";
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function N(e) {
|
|
68
68
|
e = (e + "").replace(/^(\s|\n|r)*/, "").replace(/(\s|\n|r)*$/, "");
|
|
69
|
-
let
|
|
70
|
-
return /^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e) ?
|
|
69
|
+
let n = "";
|
|
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 k(e) {
|
|
73
73
|
switch ((e[0] || "any").toLowerCase()) {
|
|
74
74
|
case "string":
|
|
75
75
|
return '""';
|
|
@@ -78,8 +78,8 @@ function S(e) {
|
|
|
78
78
|
case "number":
|
|
79
79
|
return "0";
|
|
80
80
|
case "array":
|
|
81
|
-
let
|
|
82
|
-
return
|
|
81
|
+
let t = k(e.splice(1));
|
|
82
|
+
return t = t == "undefined" ? "" : t, `[${t}]`;
|
|
83
83
|
case "object":
|
|
84
84
|
return "{}";
|
|
85
85
|
case "function":
|
|
@@ -90,60 +90,79 @@ function S(e) {
|
|
|
90
90
|
return "undefined";
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
let t = [];
|
|
95
|
-
if (e)
|
|
96
|
-
if (e = (e + "").trim(), e.startsWith("["))
|
|
97
|
-
e = e.substring(1, e.lastIndexOf("]")), t = e.split(",");
|
|
98
|
-
else {
|
|
99
|
-
let r = /^\<([a-z|\<|\>|\|]+)\>/.exec(e);
|
|
100
|
-
r && r.length > 0 ? t = r[1].split("|") : t = ["any"];
|
|
101
|
-
}
|
|
102
|
-
else
|
|
103
|
-
t = ["any"];
|
|
104
|
-
return t.map((n) => m(n));
|
|
105
|
-
}
|
|
106
|
-
function z(e) {
|
|
93
|
+
function R(e) {
|
|
107
94
|
return e.join("|") || "any";
|
|
108
95
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
96
|
+
const p = (e, n) => {
|
|
97
|
+
let t = [], r = [], i = "";
|
|
98
|
+
for (let u = 0; u < e.length; u++) {
|
|
99
|
+
const s = e[u];
|
|
100
|
+
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
|
+
}
|
|
102
|
+
return i.trim() !== "" && r.push(i.trim()), r;
|
|
103
|
+
}, A = (e) => {
|
|
104
|
+
if (!e || e === "[]")
|
|
105
|
+
return { type: "any", dataType: ["any"] };
|
|
106
|
+
if (e.startsWith("[") && e.endsWith("]")) {
|
|
107
|
+
const n = e.slice(1, -1).trim();
|
|
108
|
+
if (!n) return { type: "any", dataType: ["any"] };
|
|
109
|
+
const t = p(n, ",");
|
|
110
|
+
return {
|
|
111
|
+
type: t[0] || "any",
|
|
112
|
+
dataType: t
|
|
113
|
+
};
|
|
114
|
+
} else if (e.startsWith("<") && e.endsWith(">")) {
|
|
115
|
+
const n = e.slice(1, -1).trim();
|
|
116
|
+
if (!n) return { type: "any", dataType: ["any"] };
|
|
117
|
+
const t = p(n, "|");
|
|
118
|
+
return {
|
|
119
|
+
type: t[0] || "any",
|
|
120
|
+
dataType: t
|
|
121
|
+
};
|
|
122
|
+
} else
|
|
123
|
+
return {
|
|
124
|
+
type: e,
|
|
125
|
+
dataType: [e]
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
function q(e) {
|
|
129
|
+
return p(e, ",").map((t) => {
|
|
130
|
+
const r = t.trim(), i = t.match(/^([^:?]+)(\??):/);
|
|
131
|
+
if (!i) return null;
|
|
132
|
+
const u = i[1].trim(), s = !i[2], T = i[0].length, c = t.substring(T).trim();
|
|
133
|
+
let o = [], f = -1, g = "", y = "";
|
|
134
|
+
for (let a = 0; a < c.length; a++) {
|
|
135
|
+
const l = c[a];
|
|
136
|
+
if (l === "[" || l === "<" || l === "(" ? o.push(l) : (l === "]" && o[o.length - 1] === "[" || l === ">" && o[o.length - 1] === "<" || l === ")" && o[o.length - 1] === "(") && o.pop(), o.length === 0 && a > 0) {
|
|
137
|
+
f = a == 1 ? 0 : a, g = c.substring(0, f + 1).trim(), y = c.substring(f + 1);
|
|
119
138
|
break;
|
|
120
139
|
}
|
|
121
140
|
}
|
|
122
|
-
|
|
141
|
+
const { type: O, dataType: h } = A(g), $ = b(h);
|
|
123
142
|
return {
|
|
124
|
-
name:
|
|
125
|
-
prop:
|
|
126
|
-
type:
|
|
127
|
-
dataType:
|
|
128
|
-
must:
|
|
143
|
+
name: u,
|
|
144
|
+
prop: u,
|
|
145
|
+
type: $[0],
|
|
146
|
+
dataType: h,
|
|
147
|
+
must: s,
|
|
129
148
|
label: r,
|
|
130
|
-
description:
|
|
149
|
+
description: y
|
|
131
150
|
};
|
|
132
151
|
}).filter(Boolean);
|
|
133
152
|
}
|
|
134
153
|
export {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
154
|
+
S as getFunBody,
|
|
155
|
+
V as getFunctionFormat,
|
|
156
|
+
v as getObjType,
|
|
157
|
+
b as getSonType,
|
|
158
|
+
I as getString,
|
|
159
|
+
k as getTypeValue,
|
|
160
|
+
N as isDefaultType,
|
|
161
|
+
C as isTypeEqual,
|
|
162
|
+
q as parseParamString,
|
|
163
|
+
E as prettierArrFormat,
|
|
164
|
+
m as prettierFormat,
|
|
165
|
+
B as prettierObjFormat,
|
|
166
|
+
R as setDataType,
|
|
167
|
+
L as vueFormat
|
|
149
168
|
};
|