@fangzhongya/vue-archive 0.0.76 → 0.0.77
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 +145 -108
- package/dist/node/index.js +145 -108
- package/dist/packages/components/use/code.cjs +12 -12
- package/dist/packages/components/use/code.d.ts +25 -17
- package/dist/packages/components/use/code.js +92 -92
- package/dist/packages/components/use/edit.cjs +5 -5
- package/dist/packages/components/use/edit.js +63 -63
- package/dist/packages/components/use/retrie/any/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/any/index.vue.js +27 -49
- package/dist/packages/components/use/retrie/choice/index.d.ts +33 -2
- package/dist/packages/components/use/retrie/choice/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/choice/index.vue.js +24 -27
- package/dist/packages/components/use/retrie/input/editor/editor.cjs +1 -1
- package/dist/packages/components/use/retrie/input/editor/editor.js +50 -29
- package/dist/packages/components/use/retrie/input/editor/getExtraLib.cjs +416 -0
- package/dist/packages/components/use/retrie/input/editor/getExtraLib.d.ts +2 -0
- package/dist/packages/components/use/retrie/input/editor/getExtraLib.js +427 -0
- package/dist/packages/components/use/retrie/other/index.d.ts +13 -12
- package/dist/packages/components/use/retrie/other/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/other/index.vue.js +1 -1
- package/dist/packages/components/use/retrie/select/index.d.ts +33 -2
- package/dist/packages/components/use/retrie/select/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/select/index.vue.js +26 -26
- package/dist/packages/components/use/util.cjs +3 -3
- package/dist/packages/components/use/util.d.ts +23 -25
- package/dist/packages/components/use/util.js +161 -136
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`)}function
|
|
3
|
-
|\r)+?)\\}[\\s|\\n|\\r]*`,n=new RegExp("^"+
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("../../config.cjs"),W=require("@fangzhongya/utils/basic/string/toFunction"),k=require("@fangzhongya/utils/basic/string/firstLower");let c=e=>e;const f=A.getConfig("prettier");f&&Promise.resolve().then(()=>require("./prettier.cjs")).then(e=>{c=e.getFormat});function g(e){return f?c(e,"js"):e.replace(/\;(\s|\n\r)*$/,"")}async function q(e){return e="let a = "+e,(await g(e)).replace(/^let a = /,"")}function C(e){return g(e)}async function L(e){return!/^\s*function/.test(e)&&!/^\s*\([^\)]*\)\s*\=\>/.test(e)?(e="function a"+e,(await g(e)).replace(/^function a/,"")):await g(e)}function B(e){return f?c(e,"html"):e}function E(e){return f?c(e,"ts"):e}function x(e){return f?c(e,"js"):e}function N(e){return f?c(e,"css"):e}function P(e,t=""){let r=(e+"").trim().split(/\n/);return r=r.map(n=>t+n),r.join(`
|
|
2
|
+
`)}function v(e=""){e=e.trim();let t=`[\\s|\\n|\\r]*\\{((.|
|
|
3
|
+
|\r)+?)\\}[\\s|\\n|\\r]*`,n=new RegExp("^"+t+"$").exec(e);return n&&n.length>0?v(n[1]):e}const z=["Boolean","Any","String","Number","Array","Object","Function"];function H(e){return z.includes(e)?k.firstLower(e):e}function I(e){if(typeof e=="string"){let t=!1;return(/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e))&&(t=!0),t&&(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 J(e){const t=typeof e;if(t=="string"){e=(e+"").replace(/^(\s|\n|r)*/,"").replace(/(\s|\n|r)*$/,"");let r="";return/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e)?r="string":/^\[(.|\n|\r)*\]$/.test(e)?r="array":/^\{(.|\n|\r)*\}$/.test(e)?r="object":/^[0-9]*$/.test(e)?r="number":e==="true"||e==="false"?r="boolean":e=="undefined"?r="undefined":e=="null"?r="null":e&&(r="string"),r}else return t==="object"?e instanceof Array?"array":t===null?"null":t:t}const y=(e,t)=>{let r=[],n=[],i="";for(let u=0;u<e.length;u++){const s=e[u];s==="["||s==="<"||s==="("?(r.push(s),i+=s):s==="]"&&r.length>0&&r[r.length-1]==="["||s===">"&&r.length>0&&r[r.length-1]==="<"||s===")"&&r.length>0&&r[r.length-1]==="("?(r.pop(),i+=s):s===t&&r.length===0?(n.push(i.trim()),i=""):i+=s}return i.trim()!==""&&n.push(i.trim()),n},M=e=>{let t=[],r=!1,n=!1,i=0;for(let u=0;u<e.length;u++){const s=e[u];if(s==="["||s==="<"||s==="("?(n=!0,t.push(s),s=="["&&(r=!0),i==0&&(i=u)):(s==="]"&&t[t.length-1]==="["||s===">"&&t[t.length-1]==="<"||s===")"&&t[t.length-1]==="(")&&t.pop(),n&&t.length===0)return r&&i+1==u?{top:"Array",type:e.substring(0,i)}:{top:e.substring(0,i),type:e.substring(i+1,u)}}return{top:e,type:""}},d=e=>{if(e)if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const t=e.slice(1,-1).trim();return t?y(t,","):["any"]}else{if(e.startsWith("{")&&e.endsWith("}"))return["Object"];if(e.startsWith("<")&&e.endsWith(">")){const t=e.slice(1,-1).trim();return t?y(t,"|"):["any"]}else return y(e,",")}else return["any"]};function V(e){return y(e,",").map(r=>{const n=r.trim(),i=r.match(/^([^:?]+)(\??):/);if(!i)return null;const u=i[1].trim(),s=!i[2],w=i[0].length,p=r.substring(w).trim();let l=[],m="",b="";for(let a=0;a<p.length;a++){const o=p[a];if(o==="["||o==="<"||o==="("||o==="{"?l.push(o):(o==="]"&&l[l.length-1]==="["||o===">"&&l[l.length-1]==="<"||o==="}"&&l[l.length-1]==="{"||o===")"&&l[l.length-1]==="(")&&l.pop(),l.length===0&&a>0){a==1&&o!=="]"&&o!==">"&&o!=="}"&&o!==")"?(m="",b=p.substring(0)):(m=p.substring(0,a+1).trim(),b=p.substring(a+1));break}}const O=d(m),F=T(O);return{name:u,prop:u,type:h(F),dataType:F,must:s,label:n,description:b}}).filter(Boolean)}function j(e){return e.map(r=>{if(typeof r=="string")return r.toLowerCase()==="array"?"Array<any>":r;if(r.children&&r.children.length>0){const n=j(r.children);return r.value+"<"+n+">"}else{const n=r.value;return n.toLowerCase()==="array"?"Array<any>":n}}).join(" | ")||"any"}function T(e){const t=[];return e.forEach(r=>{const n=M(r);if(n.type){const i=d(n.type),u=T(i);t.push({label:r,value:n.top,children:u})}else t.push(n.top)}),t}function D(e){let t="";return typeof e=="string"?t=e:t=e.value,H(t||"any")}function h(e){const t=e[0]||"any";return D(t)}function $(e){const t=e[0];switch(h(e)){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":if(typeof t=="string")return"[]";{let n=t.children;if(n&&n.length>0){let i=$([n[0]]);return i=i=="undefined"?"":i,`[${i}]`}else return"[]"}case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function S(e){const t=Object.prototype.toString.call(e);let n=/^\[[O|o]bject (.*)\]$/.exec(t),i=typeof e;return n&&n.length>0&&(i=n[1].toLowerCase()),i}function R(e,t){const r=S(e),n=h(t);return n&&n!="any"?r==n:!0}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>W.getFunctionFormat});exports.getDataType=T;exports.getDataTypeType=h;exports.getFunBody=v;exports.getObjType=S;exports.getString=I;exports.getTypeValue=$;exports.isDefaultType=J;exports.isTypeEqual=R;exports.parseParamString=V;exports.parseTypeDefinition=d;exports.prettierArrFormat=C;exports.prettierCss=N;exports.prettierFormat=g;exports.prettierFunFormat=L;exports.prettierHtml=B;exports.prettierJs=x;exports.prettierObjFormat=q;exports.prettierTs=E;exports.setDataType=j;exports.vueFormat=P;
|
|
@@ -11,25 +11,6 @@ export declare function prettierVue(st: string): any;
|
|
|
11
11
|
export declare function vueFormat(st: string, kg?: string): string;
|
|
12
12
|
export declare function getFunBody(sr?: string): string;
|
|
13
13
|
export { getFunctionFormat } from '@fangzhongya/utils/basic/string/toFunction';
|
|
14
|
-
/**
|
|
15
|
-
* 解析array<string> 类型数组
|
|
16
|
-
* @param {*} type
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
export declare function getSonType(type: Array<string> | string): string[];
|
|
20
|
-
/**
|
|
21
|
-
* 获取当前对象的类型
|
|
22
|
-
* @param {*} obj
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
export declare function getObjType(obj: unknown): string;
|
|
26
|
-
/**
|
|
27
|
-
* 配置类型是否匹配
|
|
28
|
-
* @param {*} obj
|
|
29
|
-
* @param {*} type
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
export declare function isTypeEqual(obj: unknown, type: string[] | string): boolean;
|
|
33
14
|
/**
|
|
34
15
|
* 获取字符串, 去掉头尾''标识
|
|
35
16
|
* @param {*} st
|
|
@@ -40,18 +21,35 @@ export declare function getString(st: unknown): string;
|
|
|
40
21
|
* 配置字符串的类型
|
|
41
22
|
*/
|
|
42
23
|
export declare function isDefaultType(st: any): string;
|
|
43
|
-
export declare
|
|
44
|
-
export
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
24
|
+
export declare const parseTypeDefinition: (typeDef: string) => string[];
|
|
25
|
+
export type DataType = string | {
|
|
26
|
+
label: string;
|
|
27
|
+
value: string;
|
|
28
|
+
children?: DataType[];
|
|
48
29
|
};
|
|
49
30
|
export declare function parseParamString(input: string): Array<{
|
|
50
31
|
name: string;
|
|
51
32
|
prop: string;
|
|
52
33
|
type: string;
|
|
53
|
-
dataType:
|
|
34
|
+
dataType: DataType[];
|
|
54
35
|
must: boolean;
|
|
55
36
|
label: string;
|
|
56
37
|
description: string;
|
|
57
38
|
}>;
|
|
39
|
+
export declare function setDataType(arr: DataType[]): string;
|
|
40
|
+
export declare function getDataType(arr: string[]): DataType[];
|
|
41
|
+
export declare function getDataTypeType(dataType: DataType[]): string;
|
|
42
|
+
export declare function getTypeValue(arr: DataType[]): string;
|
|
43
|
+
/**
|
|
44
|
+
* 获取当前对象的类型
|
|
45
|
+
* @param {*} obj
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
export declare function getObjType(obj: unknown): string;
|
|
49
|
+
/**
|
|
50
|
+
* 配置类型是否匹配
|
|
51
|
+
* @param {*} obj
|
|
52
|
+
* @param {*} type
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
export declare function isTypeEqual(obj: unknown, dataType: DataType[]): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getConfig as F } from "../../config.js";
|
|
2
|
-
import { getFunctionFormat as
|
|
2
|
+
import { getFunctionFormat as Y } from "@fangzhongya/utils/basic/string/toFunction";
|
|
3
3
|
import { firstLower as w } from "@fangzhongya/utils/basic/string/firstLower";
|
|
4
4
|
let c = (e) => e;
|
|
5
5
|
const f = F("prettier");
|
|
@@ -9,39 +9,39 @@ f && import("./prettier.js").then((e) => {
|
|
|
9
9
|
function y(e) {
|
|
10
10
|
return f ? c(e, "js") : e.replace(/\;(\s|\n\r)*$/, "");
|
|
11
11
|
}
|
|
12
|
-
async function
|
|
12
|
+
async function N(e) {
|
|
13
13
|
return e = "let a = " + e, (await y(e)).replace(/^let a = /, "");
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function z(e) {
|
|
16
16
|
return y(e);
|
|
17
17
|
}
|
|
18
|
-
async function
|
|
18
|
+
async function I(e) {
|
|
19
19
|
return !/^\s*function/.test(e) && !/^\s*\([^\)]*\)\s*\=\>/.test(e) ? (e = "function a" + e, (await y(e)).replace(/^function a/, "")) : await y(e);
|
|
20
20
|
}
|
|
21
21
|
function q(e) {
|
|
22
22
|
return f ? c(e, "html") : e;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function H(e) {
|
|
25
25
|
return f ? c(e, "ts") : e;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function J(e) {
|
|
28
28
|
return f ? c(e, "js") : e;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function M(e) {
|
|
31
31
|
return f ? c(e, "css") : e;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
let
|
|
35
|
-
return
|
|
33
|
+
function R(e, t = "") {
|
|
34
|
+
let r = (e + "").trim().split(/\n/);
|
|
35
|
+
return r = r.map((n) => t + n), r.join(`
|
|
36
36
|
`);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function S(e = "") {
|
|
39
39
|
e = e.trim();
|
|
40
|
-
let
|
|
41
|
-
|\r)+?)\\}[\\s|\\n|\\r]*`,
|
|
42
|
-
return
|
|
40
|
+
let t = `[\\s|\\n|\\r]*\\{((.|
|
|
41
|
+
|\r)+?)\\}[\\s|\\n|\\r]*`, n = new RegExp("^" + t + "$").exec(e);
|
|
42
|
+
return n && n.length > 0 ? S(n[1]) : e;
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const A = [
|
|
45
45
|
"Boolean",
|
|
46
46
|
"Any",
|
|
47
47
|
"String",
|
|
@@ -50,159 +50,184 @@ const S = [
|
|
|
50
50
|
"Object",
|
|
51
51
|
"Function"
|
|
52
52
|
];
|
|
53
|
-
function A(e) {
|
|
54
|
-
return S.includes(e) ? w(e) : e;
|
|
55
|
-
}
|
|
56
|
-
function O(e) {
|
|
57
|
-
let t = new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);
|
|
58
|
-
if (t && t.length > 0)
|
|
59
|
-
return {
|
|
60
|
-
own: A(t[1]),
|
|
61
|
-
son: t[2]
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function b(e, n) {
|
|
65
|
-
let t = O(e);
|
|
66
|
-
t ? (n.push(t.own), t.son && b(t.son, n)) : n.push(e);
|
|
67
|
-
}
|
|
68
|
-
function T(e) {
|
|
69
|
-
e instanceof Array && (e = e[0]);
|
|
70
|
-
const n = [];
|
|
71
|
-
return e && b(e, n), n;
|
|
72
|
-
}
|
|
73
53
|
function W(e) {
|
|
74
|
-
|
|
75
|
-
let r = /^\[[O|o]bject (.*)\]$/.exec(n), i = typeof e;
|
|
76
|
-
return r && r.length > 0 && (i = r[1].toLowerCase()), i;
|
|
77
|
-
}
|
|
78
|
-
function M(e, n) {
|
|
79
|
-
const t = W(e), r = T(n)[0];
|
|
80
|
-
return r && r != "any" ? t == r : !0;
|
|
54
|
+
return A.includes(e) ? w(e) : e;
|
|
81
55
|
}
|
|
82
56
|
function V(e) {
|
|
83
57
|
if (typeof e == "string") {
|
|
84
|
-
let
|
|
85
|
-
return (/^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e)) && (
|
|
58
|
+
let t = !1;
|
|
59
|
+
return (/^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e)) && (t = !0), t && (e = e.substring(1, e.length - 1)), e + "";
|
|
86
60
|
} else return typeof e == "object" && e ? e.toString() : typeof e > "u" || typeof e == "object" && !e ? "" : e + "";
|
|
87
61
|
}
|
|
88
|
-
function
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
62
|
+
function G(e) {
|
|
63
|
+
const t = typeof e;
|
|
64
|
+
if (t == "string") {
|
|
91
65
|
e = (e + "").replace(/^(\s|\n|r)*/, "").replace(/(\s|\n|r)*$/, "");
|
|
92
|
-
let
|
|
93
|
-
return /^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e) ?
|
|
66
|
+
let r = "";
|
|
67
|
+
return /^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e) ? r = "string" : /^\[(.|\n|\r)*\]$/.test(e) ? r = "array" : /^\{(.|\n|\r)*\}$/.test(e) ? r = "object" : /^[0-9]*$/.test(e) ? r = "number" : e === "true" || e === "false" ? r = "boolean" : e == "undefined" ? r = "undefined" : e == "null" ? r = "null" : e && (r = "string"), r;
|
|
94
68
|
} else
|
|
95
|
-
return
|
|
69
|
+
return t === "object" ? e instanceof Array ? "array" : t === null ? "null" : t : t;
|
|
96
70
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return '""';
|
|
103
|
-
case "boolean":
|
|
104
|
-
return "false";
|
|
105
|
-
case "number":
|
|
106
|
-
return "0";
|
|
107
|
-
case "array":
|
|
108
|
-
let r = n.indexOf("<"), i = n.substring(n.indexOf("<") + 1, n.length - 1) || "";
|
|
109
|
-
r == -1 && (i = "any");
|
|
110
|
-
let o = k($(i).dataType);
|
|
111
|
-
return o = o == "undefined" ? "" : o, `[${o}]`;
|
|
112
|
-
case "object":
|
|
113
|
-
return "{}";
|
|
114
|
-
case "function":
|
|
115
|
-
return "()=>{}";
|
|
116
|
-
case "any":
|
|
117
|
-
return '""';
|
|
118
|
-
default:
|
|
119
|
-
return "undefined";
|
|
71
|
+
const g = (e, t) => {
|
|
72
|
+
let r = [], n = [], i = "";
|
|
73
|
+
for (let l = 0; l < e.length; l++) {
|
|
74
|
+
const s = e[l];
|
|
75
|
+
s === "[" || s === "<" || s === "(" ? (r.push(s), i += s) : s === "]" && r.length > 0 && r[r.length - 1] === "[" || s === ">" && r.length > 0 && r[r.length - 1] === "<" || s === ")" && r.length > 0 && r[r.length - 1] === "(" ? (r.pop(), i += s) : s === t && r.length === 0 ? (n.push(i.trim()), i = "") : i += s;
|
|
120
76
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
let n =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
77
|
+
return i.trim() !== "" && n.push(i.trim()), n;
|
|
78
|
+
}, k = (e) => {
|
|
79
|
+
let t = [], r = !1, n = !1, i = 0;
|
|
80
|
+
for (let l = 0; l < e.length; l++) {
|
|
81
|
+
const s = e[l];
|
|
82
|
+
if (s === "[" || s === "<" || s === "(" ? (n = !0, t.push(s), s == "[" && (r = !0), i == 0 && (i = l)) : (s === "]" && t[t.length - 1] === "[" || s === ">" && t[t.length - 1] === "<" || s === ")" && t[t.length - 1] === "(") && t.pop(), n && t.length === 0)
|
|
83
|
+
return r && i + 1 == l ? {
|
|
84
|
+
top: "Array",
|
|
85
|
+
type: e.substring(0, i)
|
|
86
|
+
} : {
|
|
87
|
+
top: e.substring(0, i),
|
|
88
|
+
type: e.substring(i + 1, l)
|
|
89
|
+
};
|
|
133
90
|
}
|
|
134
|
-
return
|
|
135
|
-
|
|
91
|
+
return {
|
|
92
|
+
top: e,
|
|
93
|
+
type: ""
|
|
94
|
+
};
|
|
95
|
+
}, v = (e) => {
|
|
136
96
|
if (e)
|
|
137
97
|
if (e.startsWith("[") && e.endsWith("]") || e.startsWith("(") && e.endsWith(")")) {
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
const t = g(n, ",");
|
|
141
|
-
return {
|
|
142
|
-
type: t[0] || "any",
|
|
143
|
-
dataType: t
|
|
144
|
-
};
|
|
145
|
-
} else if (e.startsWith("<") && e.endsWith(">")) {
|
|
146
|
-
const n = e.slice(1, -1).trim();
|
|
147
|
-
if (!n) return { type: "any", dataType: ["any"] };
|
|
148
|
-
const t = g(n, "|");
|
|
149
|
-
return {
|
|
150
|
-
type: t[0] || "any",
|
|
151
|
-
dataType: t
|
|
152
|
-
};
|
|
98
|
+
const t = e.slice(1, -1).trim();
|
|
99
|
+
return t ? g(t, ",") : ["any"];
|
|
153
100
|
} else {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
101
|
+
if (e.startsWith("{") && e.endsWith("}"))
|
|
102
|
+
return ["Object"];
|
|
103
|
+
if (e.startsWith("<") && e.endsWith(">")) {
|
|
104
|
+
const t = e.slice(1, -1).trim();
|
|
105
|
+
return t ? g(t, "|") : ["any"];
|
|
106
|
+
} else
|
|
107
|
+
return g(e, ",");
|
|
159
108
|
}
|
|
160
|
-
else return
|
|
109
|
+
else return ["any"];
|
|
161
110
|
};
|
|
162
111
|
function K(e) {
|
|
163
|
-
return g(e, ",").map((
|
|
164
|
-
const
|
|
112
|
+
return g(e, ",").map((r) => {
|
|
113
|
+
const n = r.trim(), i = r.match(/^([^:?]+)(\??):/);
|
|
165
114
|
if (!i) return null;
|
|
166
|
-
const
|
|
167
|
-
let
|
|
115
|
+
const l = i[1].trim(), s = !i[2], j = i[0].length, p = r.substring(j).trim();
|
|
116
|
+
let u = [], h = "", m = "";
|
|
168
117
|
for (let a = 0; a < p.length; a++) {
|
|
169
|
-
const
|
|
170
|
-
if (
|
|
171
|
-
a == 1 &&
|
|
118
|
+
const o = p[a];
|
|
119
|
+
if (o === "[" || o === "<" || o === "(" || o === "{" ? u.push(o) : (o === "]" && u[u.length - 1] === "[" || o === ">" && u[u.length - 1] === "<" || o === "}" && u[u.length - 1] === "{" || o === ")" && u[u.length - 1] === "(") && u.pop(), u.length === 0 && a > 0) {
|
|
120
|
+
a == 1 && o !== "]" && o !== ">" && o !== "}" && o !== ")" ? (h = "", m = p.substring(0)) : (h = p.substring(0, a + 1).trim(), m = p.substring(a + 1));
|
|
172
121
|
break;
|
|
173
122
|
}
|
|
174
123
|
}
|
|
175
|
-
const
|
|
124
|
+
const $ = v(h), d = T($);
|
|
176
125
|
return {
|
|
177
|
-
name:
|
|
178
|
-
prop:
|
|
179
|
-
type:
|
|
126
|
+
name: l,
|
|
127
|
+
prop: l,
|
|
128
|
+
type: b(d),
|
|
180
129
|
dataType: d,
|
|
181
130
|
must: s,
|
|
182
|
-
label:
|
|
131
|
+
label: n,
|
|
183
132
|
description: m
|
|
184
133
|
};
|
|
185
134
|
}).filter(Boolean);
|
|
186
135
|
}
|
|
136
|
+
function O(e) {
|
|
137
|
+
return e.map((r) => {
|
|
138
|
+
if (typeof r == "string")
|
|
139
|
+
return r.toLowerCase() === "array" ? "Array<any>" : r;
|
|
140
|
+
if (r.children && r.children.length > 0) {
|
|
141
|
+
const n = O(r.children);
|
|
142
|
+
return r.value + "<" + n + ">";
|
|
143
|
+
} else {
|
|
144
|
+
const n = r.value;
|
|
145
|
+
return n.toLowerCase() === "array" ? "Array<any>" : n;
|
|
146
|
+
}
|
|
147
|
+
}).join(" | ") || "any";
|
|
148
|
+
}
|
|
149
|
+
function T(e) {
|
|
150
|
+
const t = [];
|
|
151
|
+
return e.forEach((r) => {
|
|
152
|
+
const n = k(r);
|
|
153
|
+
if (n.type) {
|
|
154
|
+
const i = v(n.type), l = T(i);
|
|
155
|
+
t.push({
|
|
156
|
+
label: r,
|
|
157
|
+
value: n.top,
|
|
158
|
+
children: l
|
|
159
|
+
});
|
|
160
|
+
} else
|
|
161
|
+
t.push(n.top);
|
|
162
|
+
}), t;
|
|
163
|
+
}
|
|
164
|
+
function x(e) {
|
|
165
|
+
let t = "";
|
|
166
|
+
return typeof e == "string" ? t = e : t = e.value, W(t || "any");
|
|
167
|
+
}
|
|
168
|
+
function b(e) {
|
|
169
|
+
const t = e[0] || "any";
|
|
170
|
+
return x(t);
|
|
171
|
+
}
|
|
172
|
+
function C(e) {
|
|
173
|
+
const t = e[0];
|
|
174
|
+
switch (b(e)) {
|
|
175
|
+
case "string":
|
|
176
|
+
return '""';
|
|
177
|
+
case "boolean":
|
|
178
|
+
return "false";
|
|
179
|
+
case "number":
|
|
180
|
+
return "0";
|
|
181
|
+
case "array":
|
|
182
|
+
if (typeof t == "string")
|
|
183
|
+
return "[]";
|
|
184
|
+
{
|
|
185
|
+
let n = t.children;
|
|
186
|
+
if (n && n.length > 0) {
|
|
187
|
+
let i = C([n[0]]);
|
|
188
|
+
return i = i == "undefined" ? "" : i, `[${i}]`;
|
|
189
|
+
} else
|
|
190
|
+
return "[]";
|
|
191
|
+
}
|
|
192
|
+
case "object":
|
|
193
|
+
return "{}";
|
|
194
|
+
case "function":
|
|
195
|
+
return "()=>{}";
|
|
196
|
+
case "any":
|
|
197
|
+
return '""';
|
|
198
|
+
default:
|
|
199
|
+
return "undefined";
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function L(e) {
|
|
203
|
+
const t = Object.prototype.toString.call(e);
|
|
204
|
+
let n = /^\[[O|o]bject (.*)\]$/.exec(t), i = typeof e;
|
|
205
|
+
return n && n.length > 0 && (i = n[1].toLowerCase()), i;
|
|
206
|
+
}
|
|
207
|
+
function Q(e, t) {
|
|
208
|
+
const r = L(e), n = b(t);
|
|
209
|
+
return n && n != "any" ? r == n : !0;
|
|
210
|
+
}
|
|
187
211
|
export {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
212
|
+
T as getDataType,
|
|
213
|
+
b as getDataTypeType,
|
|
214
|
+
S as getFunBody,
|
|
215
|
+
Y as getFunctionFormat,
|
|
216
|
+
L as getObjType,
|
|
192
217
|
V as getString,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
218
|
+
C as getTypeValue,
|
|
219
|
+
G as isDefaultType,
|
|
220
|
+
Q as isTypeEqual,
|
|
196
221
|
K as parseParamString,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
222
|
+
v as parseTypeDefinition,
|
|
223
|
+
z as prettierArrFormat,
|
|
224
|
+
M as prettierCss,
|
|
200
225
|
y as prettierFormat,
|
|
201
|
-
|
|
226
|
+
I as prettierFunFormat,
|
|
202
227
|
q as prettierHtml,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
228
|
+
J as prettierJs,
|
|
229
|
+
N as prettierObjFormat,
|
|
230
|
+
H as prettierTs,
|
|
231
|
+
O as setDataType,
|
|
232
|
+
R as vueFormat
|
|
208
233
|
};
|