@fangzhongya/vue-archive 0.0.45 → 0.0.46
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 +55 -14
- package/dist/node/index.js +55 -14
- package/dist/packages/components/compo/index.cjs +1 -1
- package/dist/packages/components/compo/index.js +98 -85
- package/dist/packages/components/use/code.cjs +6 -6
- package/dist/packages/components/use/code.js +74 -66
- package/dist/packages/components/use/retrie/array/index.vue.cjs +2 -2
- package/dist/packages/components/use/retrie/array/index.vue.js +16 -16
- package/dist/packages/components/use/retrie/object/index.vue.cjs +2 -2
- package/dist/packages/components/use/retrie/object/index.vue.js +17 -17
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -3452,7 +3452,13 @@ ${vueFormat(v, " ")}
|
|
|
3452
3452
|
function getFunctionBody(v, key, propsText) {
|
|
3453
3453
|
const text = propsText ? propsText[key] : "";
|
|
3454
3454
|
if (text) {
|
|
3455
|
-
|
|
3455
|
+
if (text.includes("=>")) {
|
|
3456
|
+
return text;
|
|
3457
|
+
} else if (text.includes("function")) {
|
|
3458
|
+
return text;
|
|
3459
|
+
} else {
|
|
3460
|
+
return funstr(v.toString());
|
|
3461
|
+
}
|
|
3456
3462
|
} else {
|
|
3457
3463
|
return funstr(v.toString());
|
|
3458
3464
|
}
|
|
@@ -3555,22 +3561,33 @@ function getType(value) {
|
|
|
3555
3561
|
});
|
|
3556
3562
|
return [...new Set(arr)].sort();
|
|
3557
3563
|
}
|
|
3558
|
-
function getObjValue(d) {
|
|
3564
|
+
function getObjValue(d, type) {
|
|
3559
3565
|
try {
|
|
3560
|
-
|
|
3566
|
+
if (type?.toLowerCase() == "function") {
|
|
3567
|
+
if (typeof d === "string") {
|
|
3568
|
+
if (/^\((.|\n|\r)*\)$/.test(d)) {
|
|
3569
|
+
d = d.substring(1, d.length - 1);
|
|
3570
|
+
return new Function(`{ return ${d} }`)();
|
|
3571
|
+
}
|
|
3572
|
+
} else {
|
|
3573
|
+
return d;
|
|
3574
|
+
}
|
|
3575
|
+
} else {
|
|
3576
|
+
return new Function(`{ return ${d} }`)();
|
|
3577
|
+
}
|
|
3561
3578
|
} catch (error) {
|
|
3562
3579
|
return "" + d;
|
|
3563
3580
|
}
|
|
3564
3581
|
}
|
|
3565
3582
|
function getDefaultValue(obj, is = true) {
|
|
3583
|
+
const vo = getSpecType(obj);
|
|
3584
|
+
const v = getTypeValue(vo.dataType);
|
|
3566
3585
|
if (is) {
|
|
3567
|
-
const vo = getSpecType(obj);
|
|
3568
|
-
const v = getTypeValue(vo.dataType);
|
|
3569
3586
|
const d = (obj.default || "").trim();
|
|
3570
|
-
return getObjValue(d || v);
|
|
3587
|
+
return getObjValue(d || v, vo.dataType[0]);
|
|
3571
3588
|
} else {
|
|
3572
3589
|
const d = (obj.default || "").trim();
|
|
3573
|
-
return getObjValue(d);
|
|
3590
|
+
return getObjValue(d, vo.dataType[0]);
|
|
3574
3591
|
}
|
|
3575
3592
|
}
|
|
3576
3593
|
|
|
@@ -3595,13 +3612,37 @@ function getDefault(ss, iss) {
|
|
|
3595
3612
|
const cs = css.map((o) => o[0]);
|
|
3596
3613
|
let ci = cs.indexOf(c);
|
|
3597
3614
|
if (ci != -1) {
|
|
3598
|
-
let
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3615
|
+
let bracketStack = [c];
|
|
3616
|
+
for (let i = 1; i < ss.length; i++) {
|
|
3617
|
+
const char = ss[i];
|
|
3618
|
+
if (cs.includes(char)) {
|
|
3619
|
+
bracketStack.push(char);
|
|
3620
|
+
} else {
|
|
3621
|
+
let is = false;
|
|
3622
|
+
char === "]" && bracketStack[bracketStack.length - 1] === "[";
|
|
3623
|
+
for (let v of css) {
|
|
3624
|
+
if (char === v[1] && bracketStack[bracketStack.length - 1] === v[0]) {
|
|
3625
|
+
is = true;
|
|
3626
|
+
break;
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
if (is) {
|
|
3630
|
+
bracketStack.pop();
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
if (bracketStack.length === 0) {
|
|
3634
|
+
if (iss && ss[i + 1] === " ") {
|
|
3635
|
+
return ss.substring(0, i + 1);
|
|
3636
|
+
} else {
|
|
3637
|
+
return ss.substring(0, i + 1);
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
} else {
|
|
3642
|
+
if (iss) {
|
|
3643
|
+
return ss.substring(0, ss.indexOf(" "));
|
|
3644
|
+
} else {
|
|
3645
|
+
return ss;
|
|
3605
3646
|
}
|
|
3606
3647
|
}
|
|
3607
3648
|
}
|
package/dist/node/index.js
CHANGED
|
@@ -3437,7 +3437,13 @@ ${vueFormat(v, " ")}
|
|
|
3437
3437
|
function getFunctionBody(v, key, propsText) {
|
|
3438
3438
|
const text = propsText ? propsText[key] : "";
|
|
3439
3439
|
if (text) {
|
|
3440
|
-
|
|
3440
|
+
if (text.includes("=>")) {
|
|
3441
|
+
return text;
|
|
3442
|
+
} else if (text.includes("function")) {
|
|
3443
|
+
return text;
|
|
3444
|
+
} else {
|
|
3445
|
+
return funstr(v.toString());
|
|
3446
|
+
}
|
|
3441
3447
|
} else {
|
|
3442
3448
|
return funstr(v.toString());
|
|
3443
3449
|
}
|
|
@@ -3540,22 +3546,33 @@ function getType(value) {
|
|
|
3540
3546
|
});
|
|
3541
3547
|
return [...new Set(arr)].sort();
|
|
3542
3548
|
}
|
|
3543
|
-
function getObjValue(d) {
|
|
3549
|
+
function getObjValue(d, type) {
|
|
3544
3550
|
try {
|
|
3545
|
-
|
|
3551
|
+
if (type?.toLowerCase() == "function") {
|
|
3552
|
+
if (typeof d === "string") {
|
|
3553
|
+
if (/^\((.|\n|\r)*\)$/.test(d)) {
|
|
3554
|
+
d = d.substring(1, d.length - 1);
|
|
3555
|
+
return new Function(`{ return ${d} }`)();
|
|
3556
|
+
}
|
|
3557
|
+
} else {
|
|
3558
|
+
return d;
|
|
3559
|
+
}
|
|
3560
|
+
} else {
|
|
3561
|
+
return new Function(`{ return ${d} }`)();
|
|
3562
|
+
}
|
|
3546
3563
|
} catch (error) {
|
|
3547
3564
|
return "" + d;
|
|
3548
3565
|
}
|
|
3549
3566
|
}
|
|
3550
3567
|
function getDefaultValue(obj, is = true) {
|
|
3568
|
+
const vo = getSpecType(obj);
|
|
3569
|
+
const v = getTypeValue(vo.dataType);
|
|
3551
3570
|
if (is) {
|
|
3552
|
-
const vo = getSpecType(obj);
|
|
3553
|
-
const v = getTypeValue(vo.dataType);
|
|
3554
3571
|
const d = (obj.default || "").trim();
|
|
3555
|
-
return getObjValue(d || v);
|
|
3572
|
+
return getObjValue(d || v, vo.dataType[0]);
|
|
3556
3573
|
} else {
|
|
3557
3574
|
const d = (obj.default || "").trim();
|
|
3558
|
-
return getObjValue(d);
|
|
3575
|
+
return getObjValue(d, vo.dataType[0]);
|
|
3559
3576
|
}
|
|
3560
3577
|
}
|
|
3561
3578
|
|
|
@@ -3580,13 +3597,37 @@ function getDefault(ss, iss) {
|
|
|
3580
3597
|
const cs = css.map((o) => o[0]);
|
|
3581
3598
|
let ci = cs.indexOf(c);
|
|
3582
3599
|
if (ci != -1) {
|
|
3583
|
-
let
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3600
|
+
let bracketStack = [c];
|
|
3601
|
+
for (let i = 1; i < ss.length; i++) {
|
|
3602
|
+
const char = ss[i];
|
|
3603
|
+
if (cs.includes(char)) {
|
|
3604
|
+
bracketStack.push(char);
|
|
3605
|
+
} else {
|
|
3606
|
+
let is = false;
|
|
3607
|
+
char === "]" && bracketStack[bracketStack.length - 1] === "[";
|
|
3608
|
+
for (let v of css) {
|
|
3609
|
+
if (char === v[1] && bracketStack[bracketStack.length - 1] === v[0]) {
|
|
3610
|
+
is = true;
|
|
3611
|
+
break;
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
if (is) {
|
|
3615
|
+
bracketStack.pop();
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
if (bracketStack.length === 0) {
|
|
3619
|
+
if (iss && ss[i + 1] === " ") {
|
|
3620
|
+
return ss.substring(0, i + 1);
|
|
3621
|
+
} else {
|
|
3622
|
+
return ss.substring(0, i + 1);
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
} else {
|
|
3627
|
+
if (iss) {
|
|
3628
|
+
return ss.substring(0, ss.indexOf(" "));
|
|
3629
|
+
} else {
|
|
3630
|
+
return ss;
|
|
3590
3631
|
}
|
|
3591
3632
|
}
|
|
3592
3633
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../../utils/index.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");require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");require("@fangzhongya/utils/html/getVueText");const o=require("../../utils/props.cjs"),c={titles:[],propss:[],slots:[],emitss:[],exposes:[]};function h(e,s){let r=e.charAt(0),l=[['"','"'],["'","'"],["`","`"],["(",")"],["{","}"],["[","]"]];const t=l.map(n=>n[0]);if(t.indexOf(r)!=-1){let n=[r];for(let a=1;a<e.length;a++){const u=e[a];if(t.includes(u))n.push(u);else{let m=!1;for(let f of l)if(u===f[1]&&n[n.length-1]===f[0]){m=!0;break}m&&n.pop()}if(n.length===0)return s&&e[a+1]===" ",e.substring(0,a+1)}}else return s?e.substring(0,e.indexOf(" ")):e}function E(e){delete e.problems,delete e.source;let s=e.tag,r=e.name,l=e.description,t=e.default,i="";if(s=="default")r=r.trim(),r=h(r)||r;else if(s=="selectable")r=r.trim();else{if(r.includes("=")){const u=r.split("=");r=u[0];const m=u[1]+" "+l,f=h(m,!0);f?(t=f,l=m.replace(f,"")):t=e.default||u[1]||""}const a=/\s*\((.*)\)\s/gi.exec(l);a&&a.length>0&&(i=a[1],l=l.replace(a[0],""))}return e.name=r,e.default=t||"",e.description=l,e.selectable=i,e}function q(e){let s=["title","text","author","date"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),g(l),r.arr.forEach(t=>{b(t.key,t.value)})}function g(e){c.titles.push(e)}function O(e){let s=["props","name","type","default","selectable","description","descriptions","return"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),p(l,"props"),r.arr.forEach(t=>{b(t.key,t.value)})}function T(e){let s=["slot","name","selectable","description","descriptions"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),p(l,"slot"),r.arr.forEach(t=>{b(t.key,t.value)})}function y(e){let s=["emits","name","selectable","description","descriptions"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),p(l,"emits"),r.arr.forEach(t=>{b(t.key,t.value)})}function k(e){let s=["expose","name","type","return","selectable","description","descriptions"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),p(l,"expose"),r.arr.forEach(t=>{b(t.key,t.value)})}function p(e,s){const r=c[s+"name"]||[],l=e.name??e[s]?.name,t=r.indexOf(l);t>=0&&(c[s+"s"].splice(t,1),r.splice(t,1)),c[s+"s"].push(e),r.push(l),c[s+"name"]=r}function j(){Object.keys(c).forEach(e=>{c[e]=[]})}function d(e,s){const r={descriptions:e?.description||""},l=[];return e?.tags&&e.tags?.forEach(t=>{let i=t.tag,n=E(t);if(!r.hasOwnProperty(i))r[i]=n;else{const a={};a[i]=n,l.push({key:i,value:a})}}),{arr:l,obj:r}}function b(e,s){switch(e){case"title":return g(s),!0;case"text":return g(s),!0;case"props":return p(s,"props"),!0;case"slot":return p(s,"slot"),!0;case"emits":return p(s,"emits"),!0;case"expose":return p(s,"expose"),!0;default:return!1}}function S(e,s){switch(e){case"title":return q(s),!0;case"props":return O(s),!0;case"slot":return T(s),!0;case"emits":return y(s),!0;case"expose":return k(s),!0;default:return!1}}function w(e){return j(),e?.forEach(s=>{let r=s?.tags||[],l=r?.length||0;if(l>0)for(let t=0;t<l;t++){const i=r[t]||{};if(S(i.tag,s))break}}),c}function N(e){let s=x.getTextNotes(e);return w(s)}const P=[{label:"属性名",prop:"name",formatter:o.props.name},{label:"说明",prop:"description",formatter:o.props.description},{label:"类型",prop:"type",formatter:o.props.type},{label:"可选值",prop:"selectable",formatter:o.props.selectable},{label:"默认值",prop:"default",formatter:o.props.default}],v=[{label:"事件名",prop:"name",formatter:o.emits.name},{label:"说明",prop:"description",formatter:o.emits.description},{label:"回调参数",prop:"selectable",formatter:o.emits.selectable}],F=[{label:"方法名",prop:"name",formatter:o.expose.name},{label:"说明",prop:"description",formatter:o.expose.description},{label:"参数",prop:"selectable",formatter:o.expose.selectable},{label:"返回值",prop:"type",formatter(e){return o.expose.return(e)??o.expose.type(e)}}],z=[{label:"插槽名",prop:"name",formatter:o.slot.name},{label:"说明",prop:"description",formatter:o.slot.description},{label:"作用域参数",prop:"selectable",formatter:o.slot.selectable}];exports.getNotesText=N;exports.temits=v;exports.texpose=F;exports.tprops=P;exports.tslot=z;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getTextNotes as
|
|
1
|
+
import { getTextNotes as k } from "../../utils/index.js";
|
|
2
2
|
import "@fangzhongya/utils/basic/object/mergeObject";
|
|
3
3
|
import "@fangzhongya/utils/basic/array/toggleArray";
|
|
4
4
|
import "@fangzhongya/utils/name/humpToLine";
|
|
@@ -11,8 +11,8 @@ import "@fangzhongya/utils/basic/string/firstUpper";
|
|
|
11
11
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
12
12
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
13
13
|
import "@fangzhongya/utils/html/getVueText";
|
|
14
|
-
import { props as
|
|
15
|
-
const
|
|
14
|
+
import { props as m, emits as g, expose as d, slot as x } from "../../utils/props.js";
|
|
15
|
+
const i = {
|
|
16
16
|
titles: [],
|
|
17
17
|
propss: [],
|
|
18
18
|
slots: [],
|
|
@@ -27,36 +27,49 @@ function O(e, s) {
|
|
|
27
27
|
["(", ")"],
|
|
28
28
|
["{", "}"],
|
|
29
29
|
["[", "]"]
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
];
|
|
31
|
+
const t = l.map((a) => a[0]);
|
|
32
|
+
if (t.indexOf(r) != -1) {
|
|
33
|
+
let a = [r];
|
|
34
|
+
for (let o = 1; o < e.length; o++) {
|
|
35
|
+
const p = e[o];
|
|
36
|
+
if (t.includes(p))
|
|
37
|
+
a.push(p);
|
|
38
|
+
else {
|
|
39
|
+
let u = !1;
|
|
40
|
+
for (let f of l)
|
|
41
|
+
if (p === f[1] && a[a.length - 1] === f[0]) {
|
|
42
|
+
u = !0;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
u && a.pop();
|
|
46
|
+
}
|
|
47
|
+
if (a.length === 0)
|
|
48
|
+
return s && e[o + 1] === " ", e.substring(0, o + 1);
|
|
49
|
+
}
|
|
50
|
+
} else
|
|
51
|
+
return s ? e.substring(0, e.indexOf(" ")) : e;
|
|
39
52
|
}
|
|
40
|
-
function
|
|
53
|
+
function T(e) {
|
|
41
54
|
delete e.problems, delete e.source;
|
|
42
|
-
let s = e.tag, r = e.name, l = e.description, t = e.default,
|
|
55
|
+
let s = e.tag, r = e.name, l = e.description, t = e.default, n = "";
|
|
43
56
|
if (s == "default")
|
|
44
57
|
r = r.trim(), r = O(r) || r;
|
|
45
58
|
else if (s == "selectable")
|
|
46
59
|
r = r.trim();
|
|
47
60
|
else {
|
|
48
61
|
if (r.includes("=")) {
|
|
49
|
-
const
|
|
50
|
-
r =
|
|
51
|
-
const
|
|
52
|
-
|
|
62
|
+
const p = r.split("=");
|
|
63
|
+
r = p[0];
|
|
64
|
+
const u = p[1] + " " + l, f = O(u, !0);
|
|
65
|
+
f ? (t = f, l = u.replace(f, "")) : t = e.default || p[1] || "";
|
|
53
66
|
}
|
|
54
|
-
const
|
|
55
|
-
|
|
67
|
+
const o = /\s*\((.*)\)\s/gi.exec(l);
|
|
68
|
+
o && o.length > 0 && (n = o[1], l = l.replace(o[0], ""));
|
|
56
69
|
}
|
|
57
|
-
return e.name = r, e.default = t || "", e.description = l, e.selectable =
|
|
70
|
+
return e.name = r, e.default = t || "", e.description = l, e.selectable = n, e;
|
|
58
71
|
}
|
|
59
|
-
function
|
|
72
|
+
function y(e) {
|
|
60
73
|
let s = [
|
|
61
74
|
"title",
|
|
62
75
|
// 'name',
|
|
@@ -65,15 +78,15 @@ function w(e) {
|
|
|
65
78
|
"date"
|
|
66
79
|
// 'description',
|
|
67
80
|
// 'descriptions',
|
|
68
|
-
], r =
|
|
81
|
+
], r = b(e), l = {};
|
|
69
82
|
s.forEach((t) => {
|
|
70
83
|
l[t] = r.obj[t];
|
|
71
|
-
}),
|
|
72
|
-
|
|
84
|
+
}), E(l), r.arr.forEach((t) => {
|
|
85
|
+
h(t.key, t.value);
|
|
73
86
|
});
|
|
74
87
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
88
|
+
function E(e) {
|
|
89
|
+
i.titles.push(e);
|
|
77
90
|
}
|
|
78
91
|
function j(e) {
|
|
79
92
|
let s = [
|
|
@@ -85,27 +98,27 @@ function j(e) {
|
|
|
85
98
|
"description",
|
|
86
99
|
"descriptions",
|
|
87
100
|
"return"
|
|
88
|
-
], r =
|
|
101
|
+
], r = b(e), l = {};
|
|
89
102
|
s.forEach((t) => {
|
|
90
103
|
l[t] = r.obj[t];
|
|
91
|
-
}),
|
|
92
|
-
|
|
104
|
+
}), c(l, "props"), r.arr.forEach((t) => {
|
|
105
|
+
h(t.key, t.value);
|
|
93
106
|
});
|
|
94
107
|
}
|
|
95
|
-
function
|
|
96
|
-
let s = ["slot", "name", "selectable", "description", "descriptions"], r =
|
|
108
|
+
function w(e) {
|
|
109
|
+
let s = ["slot", "name", "selectable", "description", "descriptions"], r = b(e), l = {};
|
|
97
110
|
s.forEach((t) => {
|
|
98
111
|
l[t] = r.obj[t];
|
|
99
|
-
}),
|
|
100
|
-
|
|
112
|
+
}), c(l, "slot"), r.arr.forEach((t) => {
|
|
113
|
+
h(t.key, t.value);
|
|
101
114
|
});
|
|
102
115
|
}
|
|
103
116
|
function F(e) {
|
|
104
|
-
let s = ["emits", "name", "selectable", "description", "descriptions"], r =
|
|
117
|
+
let s = ["emits", "name", "selectable", "description", "descriptions"], r = b(e), l = {};
|
|
105
118
|
s.forEach((t) => {
|
|
106
119
|
l[t] = r.obj[t];
|
|
107
|
-
}),
|
|
108
|
-
|
|
120
|
+
}), c(l, "emits"), r.arr.forEach((t) => {
|
|
121
|
+
h(t.key, t.value);
|
|
109
122
|
});
|
|
110
123
|
}
|
|
111
124
|
function N(e) {
|
|
@@ -117,35 +130,35 @@ function N(e) {
|
|
|
117
130
|
"selectable",
|
|
118
131
|
"description",
|
|
119
132
|
"descriptions"
|
|
120
|
-
], r =
|
|
133
|
+
], r = b(e), l = {};
|
|
121
134
|
s.forEach((t) => {
|
|
122
135
|
l[t] = r.obj[t];
|
|
123
|
-
}),
|
|
124
|
-
|
|
136
|
+
}), c(l, "expose"), r.arr.forEach((t) => {
|
|
137
|
+
h(t.key, t.value);
|
|
125
138
|
});
|
|
126
139
|
}
|
|
127
|
-
function
|
|
128
|
-
const r =
|
|
129
|
-
t >= 0 && (
|
|
140
|
+
function c(e, s) {
|
|
141
|
+
const r = i[s + "name"] || [], l = e.name ?? e[s]?.name, t = r.indexOf(l);
|
|
142
|
+
t >= 0 && (i[s + "s"].splice(t, 1), r.splice(t, 1)), i[s + "s"].push(e), r.push(l), i[s + "name"] = r;
|
|
130
143
|
}
|
|
131
144
|
function P() {
|
|
132
|
-
Object.keys(
|
|
133
|
-
|
|
145
|
+
Object.keys(i).forEach((e) => {
|
|
146
|
+
i[e] = [];
|
|
134
147
|
});
|
|
135
148
|
}
|
|
136
|
-
function
|
|
149
|
+
function b(e, s) {
|
|
137
150
|
const r = {
|
|
138
151
|
descriptions: e?.description || ""
|
|
139
152
|
}, l = [];
|
|
140
153
|
return e?.tags && e.tags?.forEach((t) => {
|
|
141
|
-
let
|
|
142
|
-
if (!r.hasOwnProperty(
|
|
143
|
-
r[
|
|
154
|
+
let n = t.tag, a = T(t);
|
|
155
|
+
if (!r.hasOwnProperty(n))
|
|
156
|
+
r[n] = a;
|
|
144
157
|
else {
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
key:
|
|
148
|
-
value:
|
|
158
|
+
const o = {};
|
|
159
|
+
o[n] = a, l.push({
|
|
160
|
+
key: n,
|
|
161
|
+
value: o
|
|
149
162
|
});
|
|
150
163
|
}
|
|
151
164
|
}), {
|
|
@@ -153,32 +166,32 @@ function u(e, s) {
|
|
|
153
166
|
obj: r
|
|
154
167
|
};
|
|
155
168
|
}
|
|
156
|
-
function
|
|
169
|
+
function h(e, s) {
|
|
157
170
|
switch (e) {
|
|
158
171
|
case "title":
|
|
159
|
-
return
|
|
172
|
+
return E(s), !0;
|
|
160
173
|
case "text":
|
|
161
|
-
return
|
|
174
|
+
return E(s), !0;
|
|
162
175
|
case "props":
|
|
163
|
-
return
|
|
176
|
+
return c(s, "props"), !0;
|
|
164
177
|
case "slot":
|
|
165
|
-
return
|
|
178
|
+
return c(s, "slot"), !0;
|
|
166
179
|
case "emits":
|
|
167
|
-
return
|
|
180
|
+
return c(s, "emits"), !0;
|
|
168
181
|
case "expose":
|
|
169
|
-
return
|
|
182
|
+
return c(s, "expose"), !0;
|
|
170
183
|
default:
|
|
171
184
|
return !1;
|
|
172
185
|
}
|
|
173
186
|
}
|
|
174
|
-
function
|
|
187
|
+
function S(e, s) {
|
|
175
188
|
switch (e) {
|
|
176
189
|
case "title":
|
|
177
|
-
return
|
|
190
|
+
return y(s), !0;
|
|
178
191
|
case "props":
|
|
179
192
|
return j(s), !0;
|
|
180
193
|
case "slot":
|
|
181
|
-
return
|
|
194
|
+
return w(s), !0;
|
|
182
195
|
case "emits":
|
|
183
196
|
return F(s), !0;
|
|
184
197
|
case "expose":
|
|
@@ -187,46 +200,46 @@ function z(e, s) {
|
|
|
187
200
|
return !1;
|
|
188
201
|
}
|
|
189
202
|
}
|
|
190
|
-
function
|
|
203
|
+
function v(e) {
|
|
191
204
|
return P(), e?.forEach((s) => {
|
|
192
205
|
let r = s?.tags || [], l = r?.length || 0;
|
|
193
206
|
if (l > 0)
|
|
194
207
|
for (let t = 0; t < l; t++) {
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
208
|
+
const n = r[t] || {};
|
|
209
|
+
if (S(n.tag, s))
|
|
197
210
|
break;
|
|
198
211
|
}
|
|
199
|
-
}),
|
|
212
|
+
}), i;
|
|
200
213
|
}
|
|
201
|
-
function
|
|
202
|
-
let s =
|
|
203
|
-
return
|
|
214
|
+
function Q(e) {
|
|
215
|
+
let s = k(e);
|
|
216
|
+
return v(s);
|
|
204
217
|
}
|
|
205
|
-
const
|
|
218
|
+
const R = [
|
|
206
219
|
{
|
|
207
220
|
label: "属性名",
|
|
208
221
|
prop: "name",
|
|
209
|
-
formatter:
|
|
222
|
+
formatter: m.name
|
|
210
223
|
},
|
|
211
224
|
{
|
|
212
225
|
label: "说明",
|
|
213
226
|
prop: "description",
|
|
214
|
-
formatter:
|
|
227
|
+
formatter: m.description
|
|
215
228
|
},
|
|
216
229
|
{
|
|
217
230
|
label: "类型",
|
|
218
231
|
prop: "type",
|
|
219
|
-
formatter:
|
|
232
|
+
formatter: m.type
|
|
220
233
|
},
|
|
221
234
|
{
|
|
222
235
|
label: "可选值",
|
|
223
236
|
prop: "selectable",
|
|
224
|
-
formatter:
|
|
237
|
+
formatter: m.selectable
|
|
225
238
|
},
|
|
226
239
|
{
|
|
227
240
|
label: "默认值",
|
|
228
241
|
prop: "default",
|
|
229
|
-
formatter:
|
|
242
|
+
formatter: m.default
|
|
230
243
|
}
|
|
231
244
|
], U = [
|
|
232
245
|
{
|
|
@@ -248,46 +261,46 @@ const Q = [
|
|
|
248
261
|
{
|
|
249
262
|
label: "方法名",
|
|
250
263
|
prop: "name",
|
|
251
|
-
formatter:
|
|
264
|
+
formatter: d.name
|
|
252
265
|
},
|
|
253
266
|
{
|
|
254
267
|
label: "说明",
|
|
255
268
|
prop: "description",
|
|
256
|
-
formatter:
|
|
269
|
+
formatter: d.description
|
|
257
270
|
},
|
|
258
271
|
{
|
|
259
272
|
label: "参数",
|
|
260
273
|
prop: "selectable",
|
|
261
|
-
formatter:
|
|
274
|
+
formatter: d.selectable
|
|
262
275
|
},
|
|
263
276
|
{
|
|
264
277
|
label: "返回值",
|
|
265
278
|
prop: "type",
|
|
266
279
|
formatter(e) {
|
|
267
|
-
return
|
|
280
|
+
return d.return(e) ?? d.type(e);
|
|
268
281
|
}
|
|
269
282
|
}
|
|
270
283
|
], W = [
|
|
271
284
|
{
|
|
272
285
|
label: "插槽名",
|
|
273
286
|
prop: "name",
|
|
274
|
-
formatter:
|
|
287
|
+
formatter: x.name
|
|
275
288
|
},
|
|
276
289
|
{
|
|
277
290
|
label: "说明",
|
|
278
291
|
prop: "description",
|
|
279
|
-
formatter:
|
|
292
|
+
formatter: x.description
|
|
280
293
|
},
|
|
281
294
|
{
|
|
282
295
|
label: "作用域参数",
|
|
283
296
|
prop: "selectable",
|
|
284
|
-
formatter:
|
|
297
|
+
formatter: x.selectable
|
|
285
298
|
}
|
|
286
299
|
];
|
|
287
300
|
export {
|
|
288
|
-
|
|
301
|
+
Q as getNotesText,
|
|
289
302
|
U as temits,
|
|
290
303
|
V as texpose,
|
|
291
|
-
|
|
304
|
+
R as tprops,
|
|
292
305
|
W as tslot
|
|
293
306
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const H=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const J=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 l=require("./util.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const H=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const J=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 l=require("./util.cjs"),T=require("../../utils/props.cjs"),N=require("@fangzhongya/utils/basic/string/toFunction"),A=["class"];function q(e,n){return e.filter(t=>t.name==n)[0]}function L(e){return e.map(n=>(n.prop||"...arr")+":"+l.setDataType(n.dataType)).join(",")}function M(e,n,t,s,o,h){const p=[],r=[];let b=!0;const x=T.getPropsValue(n.propss||[]),z=T.getEmitsValue(n.emitss||[]),B=T.getExposeValue(n.exposes||[]),C=T.getSlotValue(n.slots||[]);Object.keys(t).forEach(i=>{let m=t[i];if(/^on[A-Z]/.test(i)&&typeof m=="function"){let u=i.substring(2);const c=i.split(":");let g;if(c.length>1?(g=c[0]+c.slice(1).map(f=>D.firstUpper(f)).join(""),u=J.firstLower(u)):(g=c[0],u=H.humpToLine(u)),c.includes("-")){let f=g.split("-");f=f.map(($,F)=>F!=0?D.firstUpper($):$),g=f.join("")}p.push(" @"+u+'="'+g+'"');const a=q(z,u)||{},d=a.selectable||"",S=l.parseParamString(d),y=L(S);r.push(`// ${a.description} ${a.name}: (${a.selectable})`),r.push("function "+g+"("+y+") {"),S.forEach(f=>{const $=f.name||"arr";r.push(" console.log('"+f.label+"', "+$+")")}),r.push("}")}else{let u=i;A.includes(i)&&(u=i+"1"),p.push(" :"+i+'="'+u+'"');const c=q(x,i)||{},g=w(c);if(r.push(`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`),typeof m=="function")r.push("const "+i+" = "+P(m,i,o));else if(b&&(b=!1,r.unshift("import { ref } from 'vue';")),typeof m>"u")if(g.type=="function"){const a=v(c);r.push("const "+u+" = "+a+";")}else{const a=l.getTypeValue(g.dataType);r.push("const "+u+" = ref("+(a==="undefined"?"":a)+");")}else{let a=E(m,i,o);r.push("const "+u+" = ref("+a+");")}}});const O=Object.values(h||{});O.length>0&&(b&&(b=!1,r.unshift("import { ref } from 'vue';")),p.unshift(' ref="refDom"'),r.push("const refDom = ref()"),O.forEach(i=>{const m=q(B,i.name)||{};r.push(`// ${m.description} ${m.name}:(${m.selectable}) ${m.type}`);const u=i.name+"Value",c=l.parseParamString(m?.selectable||""),g=[],a=i.params||[];c.forEach((d,S)=>{const y=d.name;if(y){const f=y+i.name,$=a[S];if(r.push(`// ${d.label}`),typeof $=="function")r.push("const "+f+" = "+P($,y,i.text));else if(typeof $>"u")r.push("const "+f+" = "+l.getTypeValue(d.dataType)+";");else{let F=E($,y,i.text);r.push("const "+f+" = "+F+";")}g.push(f)}}),i.type==="function"?r.push(`const ${u} = refDom.value?.${i.name}(${g.join(", ")})`):r.push(`const ${u} = refDom.value?.${i.name}`),r.push(`console.log('"${m.type}"', ${u})`)})),p.length>0&&p.unshift("");const U=Z(s,C);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>
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
${r.join(`
|
|
12
12
|
`)}
|
|
13
13
|
<\/script>
|
|
14
|
-
`}function
|
|
14
|
+
`}function Z(e={},n){const t=[];return Object.keys(e).forEach(s=>{const o=q(n,s)||{},h=e[s];if(h){const p=` <!-- ${o.description} ${o.name}:(${o.selectable}) -->
|
|
15
15
|
<template #${s}="scope">
|
|
16
16
|
${l.vueFormat(h," ")}
|
|
17
|
-
</template>`;t.push(p)}}),t&&t.length>0&&t.unshift(""),t}function P(e,n,t){const s=t?t[n]:"";return s||
|
|
17
|
+
</template>`;t.push(p)}}),t&&t.length>0&&t.unshift(""),t}function P(e,n,t){const s=t?t[n]:"";return s&&(s.includes("=>")||s.includes("function"))?s:j(e.toString())}function j(e){const n=N.getFunctionFormat(l.prettierFormat(e));if(n){let t=`{
|
|
18
18
|
${l.vueFormat(l.getFunBody(n.body)," ")}
|
|
19
|
-
}`;return`function (${n.param}) ${t}`}else return"undefined"}function
|
|
19
|
+
}`;return`function (${n.param}) ${t}`}else return"undefined"}function v(e){const n=l.parseParamString(e.selectable),t=L(n);let s="";e.return&&(s="return ");let o=`{
|
|
20
20
|
${l.vueFormat(l.getFunBody(s)," ")}
|
|
21
|
-
}`;return`function (${t}) ${
|
|
21
|
+
}`;return`function (${t}) ${o}`}function G(e){const n=e.trim();return/^\(/.test(n)?j(n):JSON.stringify(e)}function E(e,n,t){const s=t?t[n]:"";return s?typeof s=="string"?V(s):s:typeof e=="string"?G(e+""):JSON.stringify(e)}function w(e){let n=I(e?.type),t="any";n.length==1&&(t=n[0].split("<")[0]);const s=t;let o=(e?.selectable||"").trim(),h=[];return o&&t!="boolean"&&(o.includes("|")?o.split("|").forEach(p=>{if(p){let r=p.split(":");h.push({label:p,prop:V(r[0].trim())})}}):h=l.parseParamString(o),t=="function"?t="function":t=="array"?t="choice":h.length>1&&(t="select")),{arr:h,zdtype:s,type:t,dataType:n}}function I(e){let n=[];return(e||"").trim().toLowerCase().split(",").forEach(s=>{s=s.trim(),s&&n.push(s)}),[...new Set(n)].sort()}function V(e,n){try{if(n?.toLowerCase()=="function")if(typeof e=="string"){if(/^\((.|\n|\r)*\)$/.test(e))return e=e.substring(1,e.length-1),new Function(`{ return ${e} }`)()}else return e;else return new Function(`{ return ${e} }`)()}catch{return""+e}}function K(e,n=!0){const t=w(e),s=l.getTypeValue(t.dataType);if(n){const o=(e.default||"").trim();return V(o||s,t.dataType[0])}else{const o=(e.default||"").trim();return V(o,t.dataType[0])}}exports.getDefaultValue=K;exports.getHmtl=M;exports.getSpecType=w;exports.setValStringify=E;
|
|
@@ -9,90 +9,90 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
|
9
9
|
import { firstUpper as D } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
10
10
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
11
11
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
12
|
-
import { getTypeValue as
|
|
12
|
+
import { getTypeValue as E, parseParamString as T, setDataType as q, vueFormat as w, prettierFormat as G, getFunBody as z } from "./util.js";
|
|
13
13
|
import { getPropsValue as I, getEmitsValue as K, getExposeValue as M, getSlotValue as Q } from "../../utils/props.js";
|
|
14
14
|
import { getFunctionFormat as R } from "@fangzhongya/utils/basic/string/toFunction";
|
|
15
15
|
const W = ["class"];
|
|
16
16
|
function S(t, n) {
|
|
17
17
|
return t.filter((e) => e.name == n)[0];
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function C(t) {
|
|
20
20
|
return t.map((n) => (n.prop || "...arr") + ":" + q(n.dataType)).join(",");
|
|
21
21
|
}
|
|
22
|
-
function ht(t, n, e, s,
|
|
22
|
+
function ht(t, n, e, s, i, h) {
|
|
23
23
|
const p = [], r = [];
|
|
24
|
-
let
|
|
25
|
-
const
|
|
24
|
+
let d = !0;
|
|
25
|
+
const B = I(n.propss || []), J = K(n.emitss || []), N = M(n.exposes || []), A = Q(n.slots || []);
|
|
26
26
|
Object.keys(e).forEach((o) => {
|
|
27
27
|
let a = e[o];
|
|
28
28
|
if (/^on[A-Z]/.test(o) && typeof a == "function") {
|
|
29
|
-
let
|
|
29
|
+
let c = o.substring(2);
|
|
30
30
|
const u = o.split(":");
|
|
31
31
|
let m;
|
|
32
|
-
if (u.length > 1 ? (m = u[0] + u.slice(1).map((f) => D(f)).join(""),
|
|
32
|
+
if (u.length > 1 ? (m = u[0] + u.slice(1).map((f) => D(f)).join(""), c = Z(c)) : (m = u[0], c = U(c)), u.includes("-")) {
|
|
33
33
|
let f = m.split("-");
|
|
34
|
-
f = f.map((
|
|
34
|
+
f = f.map((g, j) => j != 0 ? D(g) : g), m = f.join("");
|
|
35
35
|
}
|
|
36
|
-
p.push(" @" +
|
|
37
|
-
const l = S(J,
|
|
38
|
-
r.push(`// ${l.description} ${l.name}: (${l.selectable})`), r.push("function " + m + "(" +
|
|
39
|
-
const
|
|
40
|
-
r.push(" console.log('" + f.label + "', " +
|
|
36
|
+
p.push(" @" + c + '="' + m + '"');
|
|
37
|
+
const l = S(J, c) || {}, y = l.selectable || "", b = T(y), $ = C(b);
|
|
38
|
+
r.push(`// ${l.description} ${l.name}: (${l.selectable})`), r.push("function " + m + "(" + $ + ") {"), b.forEach((f) => {
|
|
39
|
+
const g = f.name || "arr";
|
|
40
|
+
r.push(" console.log('" + f.label + "', " + g + ")");
|
|
41
41
|
}), r.push("}");
|
|
42
42
|
} else {
|
|
43
|
-
let
|
|
44
|
-
W.includes(o) && (
|
|
45
|
-
const u = S(
|
|
43
|
+
let c = o;
|
|
44
|
+
W.includes(o) && (c = o + "1"), p.push(" :" + o + '="' + c + '"');
|
|
45
|
+
const u = S(B, o) || {}, m = P(u);
|
|
46
46
|
if (r.push(
|
|
47
47
|
`// ${u.description} ${u.name}: {${u.type}} (${u.selectable})`
|
|
48
48
|
), typeof a == "function")
|
|
49
49
|
r.push(
|
|
50
|
-
"const " + o + " = " +
|
|
50
|
+
"const " + o + " = " + x(a, o, i)
|
|
51
51
|
);
|
|
52
|
-
else if (
|
|
52
|
+
else if (d && (d = !1, r.unshift("import { ref } from 'vue';")), typeof a > "u")
|
|
53
53
|
if (m.type == "function") {
|
|
54
54
|
const l = Y(u);
|
|
55
|
-
r.push("const " +
|
|
55
|
+
r.push("const " + c + " = " + l + ";");
|
|
56
56
|
} else {
|
|
57
|
-
const l =
|
|
57
|
+
const l = E(m.dataType);
|
|
58
58
|
r.push(
|
|
59
|
-
"const " +
|
|
59
|
+
"const " + c + " = ref(" + (l === "undefined" ? "" : l) + ");"
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
let l =
|
|
64
|
-
r.push("const " +
|
|
63
|
+
let l = L(a, o, i);
|
|
64
|
+
r.push("const " + c + " = ref(" + l + ");");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
const O = Object.values(h || {});
|
|
69
|
-
O.length > 0 && (
|
|
69
|
+
O.length > 0 && (d && (d = !1, r.unshift("import { ref } from 'vue';")), p.unshift(' ref="refDom"'), r.push("const refDom = ref()"), O.forEach((o) => {
|
|
70
70
|
const a = S(N, o.name) || {};
|
|
71
71
|
r.push(
|
|
72
72
|
`// ${a.description} ${a.name}:(${a.selectable}) ${a.type}`
|
|
73
73
|
);
|
|
74
|
-
const
|
|
75
|
-
u.forEach((
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
const f =
|
|
79
|
-
if (r.push(`// ${
|
|
74
|
+
const c = o.name + "Value", u = T(a?.selectable || ""), m = [], l = o.params || [];
|
|
75
|
+
u.forEach((y, b) => {
|
|
76
|
+
const $ = y.name;
|
|
77
|
+
if ($) {
|
|
78
|
+
const f = $ + o.name, g = l[b];
|
|
79
|
+
if (r.push(`// ${y.label}`), typeof g == "function")
|
|
80
80
|
r.push(
|
|
81
|
-
"const " + f + " = " +
|
|
81
|
+
"const " + f + " = " + x(g, $, o.text)
|
|
82
82
|
);
|
|
83
|
-
else if (typeof
|
|
83
|
+
else if (typeof g > "u")
|
|
84
84
|
r.push(
|
|
85
|
-
"const " + f + " = " +
|
|
85
|
+
"const " + f + " = " + E(y.dataType) + ";"
|
|
86
86
|
);
|
|
87
87
|
else {
|
|
88
|
-
let
|
|
89
|
-
r.push("const " + f + " = " +
|
|
88
|
+
let j = L(g, $, o.text);
|
|
89
|
+
r.push("const " + f + " = " + j + ";");
|
|
90
90
|
}
|
|
91
91
|
m.push(f);
|
|
92
92
|
}
|
|
93
93
|
}), o.type === "function" ? r.push(
|
|
94
|
-
`const ${
|
|
95
|
-
) : r.push(`const ${
|
|
94
|
+
`const ${c} = refDom.value?.${o.name}(${m.join(", ")})`
|
|
95
|
+
) : r.push(`const ${c} = refDom.value?.${o.name}`), r.push(`console.log('"${a.type}"', ${c})`);
|
|
96
96
|
})), p.length > 0 && p.unshift("");
|
|
97
97
|
const H = X(s, A);
|
|
98
98
|
return `<!--${t}-->
|
|
@@ -113,61 +113,61 @@ ${r.join(`
|
|
|
113
113
|
function X(t = {}, n) {
|
|
114
114
|
const e = [];
|
|
115
115
|
return Object.keys(t).forEach((s) => {
|
|
116
|
-
const
|
|
116
|
+
const i = S(n, s) || {}, h = t[s];
|
|
117
117
|
if (h) {
|
|
118
|
-
const p = ` <!-- ${
|
|
118
|
+
const p = ` <!-- ${i.description} ${i.name}:(${i.selectable}) -->
|
|
119
119
|
<template #${s}="scope">
|
|
120
|
-
${
|
|
120
|
+
${w(h, " ")}
|
|
121
121
|
</template>`;
|
|
122
122
|
e.push(p);
|
|
123
123
|
}
|
|
124
124
|
}), e && e.length > 0 && e.unshift(""), e;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function x(t, n, e) {
|
|
127
127
|
const s = e ? e[n] : "";
|
|
128
|
-
return s ||
|
|
128
|
+
return s && (s.includes("=>") || s.includes("function")) ? s : F(t.toString());
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function F(t) {
|
|
131
131
|
const n = R(G(t));
|
|
132
132
|
if (n) {
|
|
133
133
|
let e = `{
|
|
134
|
-
${
|
|
134
|
+
${w(z(n.body), " ")}
|
|
135
135
|
}`;
|
|
136
136
|
return `function (${n.param}) ${e}`;
|
|
137
137
|
} else
|
|
138
138
|
return "undefined";
|
|
139
139
|
}
|
|
140
140
|
function Y(t) {
|
|
141
|
-
const n =
|
|
141
|
+
const n = T(t.selectable), e = C(n);
|
|
142
142
|
let s = "";
|
|
143
143
|
t.return && (s = "return ");
|
|
144
|
-
let
|
|
145
|
-
${
|
|
144
|
+
let i = `{
|
|
145
|
+
${w(z(s), " ")}
|
|
146
146
|
}`;
|
|
147
|
-
return `function (${e}) ${
|
|
147
|
+
return `function (${e}) ${i}`;
|
|
148
148
|
}
|
|
149
149
|
function _(t) {
|
|
150
150
|
const n = t.trim();
|
|
151
|
-
return /^\(/.test(n) ?
|
|
151
|
+
return /^\(/.test(n) ? F(n) : JSON.stringify(t);
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function L(t, n, e) {
|
|
154
154
|
const s = e ? e[n] : "";
|
|
155
|
-
return s ? typeof s == "string" ?
|
|
155
|
+
return s ? typeof s == "string" ? V(s) : s : typeof t == "string" ? _(t + "") : JSON.stringify(t);
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function P(t) {
|
|
158
158
|
let n = v(t?.type), e = "any";
|
|
159
159
|
n.length == 1 && (e = n[0].split("<")[0]);
|
|
160
160
|
const s = e;
|
|
161
|
-
let
|
|
162
|
-
return
|
|
161
|
+
let i = (t?.selectable || "").trim(), h = [];
|
|
162
|
+
return i && e != "boolean" && (i.includes("|") ? i.split("|").forEach((p) => {
|
|
163
163
|
if (p) {
|
|
164
164
|
let r = p.split(":");
|
|
165
165
|
h.push({
|
|
166
166
|
label: p,
|
|
167
|
-
prop:
|
|
167
|
+
prop: V(r[0].trim())
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
}) : h =
|
|
170
|
+
}) : h = T(i), e == "function" ? e = "function" : e == "array" ? e = "choice" : h.length > 1 && (e = "select")), {
|
|
171
171
|
arr: h,
|
|
172
172
|
zdtype: s,
|
|
173
173
|
type: e,
|
|
@@ -180,25 +180,33 @@ function v(t) {
|
|
|
180
180
|
s = s.trim(), s && n.push(s);
|
|
181
181
|
}), [...new Set(n)].sort();
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function V(t, n) {
|
|
184
184
|
try {
|
|
185
|
-
|
|
185
|
+
if (n?.toLowerCase() == "function")
|
|
186
|
+
if (typeof t == "string") {
|
|
187
|
+
if (/^\((.|\n|\r)*\)$/.test(t))
|
|
188
|
+
return t = t.substring(1, t.length - 1), new Function(`{ return ${t} }`)();
|
|
189
|
+
} else
|
|
190
|
+
return t;
|
|
191
|
+
else
|
|
192
|
+
return new Function(`{ return ${t} }`)();
|
|
186
193
|
} catch {
|
|
187
194
|
return "" + t;
|
|
188
195
|
}
|
|
189
196
|
}
|
|
190
|
-
function
|
|
197
|
+
function gt(t, n = !0) {
|
|
198
|
+
const e = P(t), s = E(e.dataType);
|
|
191
199
|
if (n) {
|
|
192
|
-
const
|
|
193
|
-
return
|
|
200
|
+
const i = (t.default || "").trim();
|
|
201
|
+
return V(i || s, e.dataType[0]);
|
|
194
202
|
} else {
|
|
195
|
-
const
|
|
196
|
-
return
|
|
203
|
+
const i = (t.default || "").trim();
|
|
204
|
+
return V(i, e.dataType[0]);
|
|
197
205
|
}
|
|
198
206
|
}
|
|
199
207
|
export {
|
|
200
|
-
|
|
208
|
+
gt as getDefaultValue,
|
|
201
209
|
ht as getHmtl,
|
|
202
|
-
|
|
203
|
-
|
|
210
|
+
P as getSpecType,
|
|
211
|
+
L as setValStringify
|
|
204
212
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("vue"),m=require("../input/index.vue.cjs");;/* empty css */const f=require("../../util.cjs"),d={class:"form-array"},p=n.defineComponent({__name:"index",props:{modelValue:{type:null}},emits:["value","error"],setup(i,{emit:c}){const u=i,o=c,l=n.ref("");n.watch(()=>u.modelValue,()=>{let e=u.modelValue;l.value=a(e)||e},{immediate:!0});function s(e){return new Function("",`{return ${e}}`)}function a(e){let r;if(e)try{let t=e;typeof e=="string"?(t=s(e)(),r=f.prettierArrFormat(e)):r=JSON.stringify(e),t instanceof Array?(o("value",t,r),o("error",!1)):(o("error",!0),console.log("error","类型不匹配"))}catch(t){o("error",!0),console.log("error",t)}else r=`[
|
|
2
2
|
|
|
3
|
-
]`,
|
|
3
|
+
]`,o("value",void 0,r),o("error",!1);return r}return(e,r)=>(n.openBlock(),n.createElementBlock("div",d,[n.createVNode(m,{modelValue:l.value,"onUpdate:modelValue":r[0]||(r[0]=t=>l.value=t),check:a},null,8,["modelValue"])]))}});module.exports=p;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as c, ref as f, watch as s, createElementBlock as p, openBlock as d, createVNode as v } from "vue";
|
|
2
|
+
import _ from "../input/index.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { prettierArrFormat as
|
|
5
|
-
const
|
|
4
|
+
import { prettierArrFormat as V } from "../../util.js";
|
|
5
|
+
const g = { class: "form-array" }, A = /* @__PURE__ */ c({
|
|
6
6
|
__name: "index",
|
|
7
7
|
props: {
|
|
8
8
|
modelValue: {
|
|
@@ -10,9 +10,9 @@ const h = { class: "form-array" }, A = /* @__PURE__ */ s({
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
emits: ["value", "error"],
|
|
13
|
-
setup(
|
|
14
|
-
const n =
|
|
15
|
-
|
|
13
|
+
setup(u, { emit: i }) {
|
|
14
|
+
const n = u, t = i, l = f("");
|
|
15
|
+
s(
|
|
16
16
|
() => n.modelValue,
|
|
17
17
|
() => {
|
|
18
18
|
let e = n.modelValue;
|
|
@@ -22,28 +22,28 @@ const h = { class: "form-array" }, A = /* @__PURE__ */ s({
|
|
|
22
22
|
immediate: !0
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
|
-
function
|
|
25
|
+
function m(e) {
|
|
26
26
|
return new Function("", `{return ${e}}`);
|
|
27
27
|
}
|
|
28
28
|
function a(e) {
|
|
29
29
|
let r;
|
|
30
30
|
if (e)
|
|
31
31
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} catch (
|
|
35
|
-
|
|
32
|
+
let o = e;
|
|
33
|
+
typeof e == "string" ? (o = m(e)(), r = V(e)) : r = JSON.stringify(e), o instanceof Array ? (t("value", o, r), t("error", !1)) : (t("error", !0), console.log("error", "类型不匹配"));
|
|
34
|
+
} catch (o) {
|
|
35
|
+
t("error", !0), console.log("error", o);
|
|
36
36
|
}
|
|
37
37
|
else
|
|
38
38
|
r = `[
|
|
39
39
|
|
|
40
|
-
]`,
|
|
40
|
+
]`, t("value", void 0, r), t("error", !1);
|
|
41
41
|
return r;
|
|
42
42
|
}
|
|
43
|
-
return (e, r) => (
|
|
44
|
-
_
|
|
43
|
+
return (e, r) => (d(), p("div", g, [
|
|
44
|
+
v(_, {
|
|
45
45
|
modelValue: l.value,
|
|
46
|
-
"onUpdate:modelValue": r[0] || (r[0] = (
|
|
46
|
+
"onUpdate:modelValue": r[0] || (r[0] = (o) => l.value = o),
|
|
47
47
|
check: a
|
|
48
48
|
}, null, 8, ["modelValue"])
|
|
49
49
|
]));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const l=require("vue"),m=require("../input/index.vue.cjs");;/* empty css */const f=require("../../util.cjs"),p={class:"form-object"},d=l.defineComponent({__name:"index",props:{modelValue:{type:null}},emits:["value","error"],setup(c,{emit:a}){const u=c,o=a,n=l.ref("");l.watch(()=>u.modelValue,()=>{let e=u.modelValue;n.value=i(e)||e},{immediate:!0});function s(e){return new Function("",`{ return ${e} }`)}function i(e){let r;if(e)try{let t=e;typeof e=="string"?(t=s(e)(),r=f.prettierObjFormat(e)):r=JSON.stringify(e),typeof t=="object"?(o("value",t,r),o("error",!1)):(o("error",!0),console.log("error","类型不匹配"))}catch(t){o("error",!0),console.log("error",t)}else r=`{
|
|
2
2
|
|
|
3
|
-
}`,
|
|
3
|
+
}`,o("value",void 0,r),o("error",!1);return r}return(e,r)=>(l.openBlock(),l.createElementBlock("div",p,[l.createVNode(m,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=t=>n.value=t),check:i},null,8,["modelValue"])]))}});module.exports=d;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as c, ref as f, watch as s, createElementBlock as p, openBlock as d, createVNode as v } from "vue";
|
|
2
|
+
import _ from "../input/index.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { prettierObjFormat as
|
|
5
|
-
const
|
|
4
|
+
import { prettierObjFormat as V } from "../../util.js";
|
|
5
|
+
const g = { class: "form-object" }, x = /* @__PURE__ */ c({
|
|
6
6
|
__name: "index",
|
|
7
7
|
props: {
|
|
8
8
|
modelValue: {
|
|
@@ -10,9 +10,9 @@ const h = { class: "form-object" }, y = /* @__PURE__ */ s({
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
emits: ["value", "error"],
|
|
13
|
-
setup(
|
|
14
|
-
const n =
|
|
15
|
-
|
|
13
|
+
setup(a, { emit: i }) {
|
|
14
|
+
const n = a, t = i, l = f("");
|
|
15
|
+
s(
|
|
16
16
|
() => n.modelValue,
|
|
17
17
|
() => {
|
|
18
18
|
let e = n.modelValue;
|
|
@@ -22,33 +22,33 @@ const h = { class: "form-object" }, y = /* @__PURE__ */ s({
|
|
|
22
22
|
immediate: !0
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
|
-
function
|
|
25
|
+
function m(e) {
|
|
26
26
|
return new Function("", `{ return ${e} }`);
|
|
27
27
|
}
|
|
28
28
|
function u(e) {
|
|
29
29
|
let r;
|
|
30
30
|
if (e)
|
|
31
31
|
try {
|
|
32
|
-
|
|
33
|
-
typeof
|
|
34
|
-
} catch (
|
|
35
|
-
|
|
32
|
+
let o = e;
|
|
33
|
+
typeof e == "string" ? (o = m(e)(), r = V(e)) : r = JSON.stringify(e), typeof o == "object" ? (t("value", o, r), t("error", !1)) : (t("error", !0), console.log("error", "类型不匹配"));
|
|
34
|
+
} catch (o) {
|
|
35
|
+
t("error", !0), console.log("error", o);
|
|
36
36
|
}
|
|
37
37
|
else
|
|
38
38
|
r = `{
|
|
39
39
|
|
|
40
|
-
}`,
|
|
40
|
+
}`, t("value", void 0, r), t("error", !1);
|
|
41
41
|
return r;
|
|
42
42
|
}
|
|
43
|
-
return (e, r) => (
|
|
44
|
-
_
|
|
43
|
+
return (e, r) => (d(), p("div", g, [
|
|
44
|
+
v(_, {
|
|
45
45
|
modelValue: l.value,
|
|
46
|
-
"onUpdate:modelValue": r[0] || (r[0] = (
|
|
46
|
+
"onUpdate:modelValue": r[0] || (r[0] = (o) => l.value = o),
|
|
47
47
|
check: u
|
|
48
48
|
}, null, 8, ["modelValue"])
|
|
49
49
|
]));
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
x as default
|
|
54
54
|
};
|