@fangzhongya/vue-archive 0.0.3-5 → 0.0.3-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node/index.cjs
CHANGED
|
@@ -66513,29 +66513,32 @@ function getFunctionBody(v, key, propsText) {
|
|
|
66513
66513
|
if (text) {
|
|
66514
66514
|
return "function" + text;
|
|
66515
66515
|
} else {
|
|
66516
|
-
|
|
66517
|
-
|
|
66518
|
-
|
|
66519
|
-
|
|
66520
|
-
|
|
66516
|
+
return funstr(v.toString());
|
|
66517
|
+
}
|
|
66518
|
+
}
|
|
66519
|
+
function funstr(v) {
|
|
66520
|
+
const st = getFunctionFormat(prettierFormat(v));
|
|
66521
|
+
if (st) {
|
|
66522
|
+
let body = `{
|
|
66521
66523
|
${vueFormat(getFunBody(st.body), " ")}
|
|
66522
66524
|
}`;
|
|
66523
|
-
|
|
66524
|
-
|
|
66525
|
-
|
|
66526
|
-
}
|
|
66525
|
+
return `function${st.param}${body}`;
|
|
66526
|
+
} else {
|
|
66527
|
+
return "undefined";
|
|
66527
66528
|
}
|
|
66528
66529
|
}
|
|
66529
66530
|
function getChange(str) {
|
|
66530
66531
|
const tr = str.trim();
|
|
66531
66532
|
if (/^\(/.test(tr)) {
|
|
66532
|
-
return
|
|
66533
|
+
return funstr(tr);
|
|
66533
66534
|
} else {
|
|
66534
|
-
return
|
|
66535
|
-
|
|
66536
|
-
|
|
66535
|
+
return JSON.stringify(
|
|
66536
|
+
new Function(
|
|
66537
|
+
"",
|
|
66538
|
+
`{
|
|
66537
66539
|
return ${str}
|
|
66538
66540
|
}`
|
|
66541
|
+
)
|
|
66539
66542
|
);
|
|
66540
66543
|
}
|
|
66541
66544
|
}
|
|
@@ -66545,7 +66548,7 @@ function setValStringify(v, key, propsText) {
|
|
|
66545
66548
|
return text;
|
|
66546
66549
|
} else {
|
|
66547
66550
|
if (typeof v == "string") {
|
|
66548
|
-
return
|
|
66551
|
+
return getChange(v + "");
|
|
66549
66552
|
} else {
|
|
66550
66553
|
return JSON.stringify(v);
|
|
66551
66554
|
}
|
|
@@ -66667,7 +66670,11 @@ function getDefaultValue(obj) {
|
|
|
66667
66670
|
const vo = getSpecType(obj).zdtype;
|
|
66668
66671
|
const d = (obj.default || "").trim();
|
|
66669
66672
|
if (vo == "function") {
|
|
66670
|
-
|
|
66673
|
+
let fb = getFunctionFormat(d);
|
|
66674
|
+
if (fb) {
|
|
66675
|
+
return new Function(fb.param, fb.body);
|
|
66676
|
+
}
|
|
66677
|
+
return d;
|
|
66671
66678
|
} else {
|
|
66672
66679
|
return new Function(
|
|
66673
66680
|
"",
|
package/dist/node/index.js
CHANGED
|
@@ -66513,29 +66513,32 @@ function getFunctionBody(v, key, propsText) {
|
|
|
66513
66513
|
if (text) {
|
|
66514
66514
|
return "function" + text;
|
|
66515
66515
|
} else {
|
|
66516
|
-
|
|
66517
|
-
|
|
66518
|
-
|
|
66519
|
-
|
|
66520
|
-
|
|
66516
|
+
return funstr(v.toString());
|
|
66517
|
+
}
|
|
66518
|
+
}
|
|
66519
|
+
function funstr(v) {
|
|
66520
|
+
const st = getFunctionFormat(prettierFormat(v));
|
|
66521
|
+
if (st) {
|
|
66522
|
+
let body = `{
|
|
66521
66523
|
${vueFormat(getFunBody(st.body), " ")}
|
|
66522
66524
|
}`;
|
|
66523
|
-
|
|
66524
|
-
|
|
66525
|
-
|
|
66526
|
-
}
|
|
66525
|
+
return `function${st.param}${body}`;
|
|
66526
|
+
} else {
|
|
66527
|
+
return "undefined";
|
|
66527
66528
|
}
|
|
66528
66529
|
}
|
|
66529
66530
|
function getChange(str) {
|
|
66530
66531
|
const tr = str.trim();
|
|
66531
66532
|
if (/^\(/.test(tr)) {
|
|
66532
|
-
return
|
|
66533
|
+
return funstr(tr);
|
|
66533
66534
|
} else {
|
|
66534
|
-
return
|
|
66535
|
-
|
|
66536
|
-
|
|
66535
|
+
return JSON.stringify(
|
|
66536
|
+
new Function(
|
|
66537
|
+
"",
|
|
66538
|
+
`{
|
|
66537
66539
|
return ${str}
|
|
66538
66540
|
}`
|
|
66541
|
+
)
|
|
66539
66542
|
);
|
|
66540
66543
|
}
|
|
66541
66544
|
}
|
|
@@ -66545,7 +66548,7 @@ function setValStringify(v, key, propsText) {
|
|
|
66545
66548
|
return text;
|
|
66546
66549
|
} else {
|
|
66547
66550
|
if (typeof v == "string") {
|
|
66548
|
-
return
|
|
66551
|
+
return getChange(v + "");
|
|
66549
66552
|
} else {
|
|
66550
66553
|
return JSON.stringify(v);
|
|
66551
66554
|
}
|
|
@@ -66667,7 +66670,11 @@ function getDefaultValue(obj) {
|
|
|
66667
66670
|
const vo = getSpecType(obj).zdtype;
|
|
66668
66671
|
const d = (obj.default || "").trim();
|
|
66669
66672
|
if (vo == "function") {
|
|
66670
|
-
|
|
66673
|
+
let fb = getFunctionFormat(d);
|
|
66674
|
+
if (fb) {
|
|
66675
|
+
return new Function(fb.param, fb.body);
|
|
66676
|
+
}
|
|
66677
|
+
return d;
|
|
66671
66678
|
} else {
|
|
66672
66679
|
return new Function(
|
|
66673
66680
|
"",
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.cjs"),d=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.cjs"),F=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.cjs"),h=require("./util.cjs");function j(n,t,e,r){const o=[],i=[];let l=!0;Object.keys(t).forEach(s=>{let c=t[s];if(/^on[A-Z]/.test(s)&&typeof c=="function"){let u=s.substring(2);const a=s.split(":");let f;if(a.length>1?(f=a[0]+a.slice(1).map(p=>d.firstUpper(p)).join(""),u=F.firstLower(u)):(f=a[0],u=b.humpToLine(u)),a.includes("-")){let p=f.split("-");p=p.map((m,S)=>S!=0?d.firstUpper(m):m),f=p.join("")}o.push(" @"+u+'="'+f+'"'),i.push("function "+f+"(...arr) {"),i.push(" console.log('"+f+"', arr)"),i.push("}")}else if(o.push(" :"+s+'="'+s+'"'),typeof c=="function")i.push("const "+s+" = "+J(c,s,r));else if(l&&(l=!1,i.unshift("import { ref } from 'vue';")),typeof c>"u")i.push("const "+s+" = ref();");else{let u=$(c,s,r);i.push("const "+s+" = ref("+u+");")}}),o.length>0&&o.unshift("");const g=O(e);return`<!--${n}-->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
|
-
<${
|
|
4
|
+
<${n}${o.join(`
|
|
5
5
|
`)}>${g.join(`
|
|
6
6
|
`)}
|
|
7
|
-
</${
|
|
7
|
+
</${n}>
|
|
8
8
|
</div>
|
|
9
9
|
</template>
|
|
10
10
|
<script lang="ts" setup>
|
|
11
|
-
${
|
|
11
|
+
${i.join(`
|
|
12
12
|
`)}
|
|
13
13
|
<\/script>
|
|
14
|
-
`}function
|
|
14
|
+
`}function O(n={}){const t=[];return Object.keys(n).forEach(e=>{const r=n[e];if(r){const o=` <template #${e}="scope">
|
|
15
15
|
${h.vueFormat(r," ")}
|
|
16
|
-
</template>`;
|
|
17
|
-
${h.vueFormat(h.getFunBody(
|
|
18
|
-
}`;return`function${
|
|
19
|
-
return ${
|
|
20
|
-
}`)}function
|
|
16
|
+
</template>`;t.push(o)}}),t&&t.length>0&&t.unshift(""),t}function J(n,t,e){const r=e?e[t]:"";return r?"function"+r:y(n.toString())}function y(n){const t=h.getFunctionFormat(h.prettierFormat(n));if(t){let e=`{
|
|
17
|
+
${h.vueFormat(h.getFunBody(t.body)," ")}
|
|
18
|
+
}`;return`function${t.param}${e}`}else return"undefined"}function E(n){const t=n.trim();return/^\(/.test(t)?y(t):JSON.stringify(new Function("",`{
|
|
19
|
+
return ${n}
|
|
20
|
+
}`))}function $(n,t,e){const r=e?e[t]:"";return r||(typeof n=="string"?E(n+""):JSON.stringify(n))}function T(n){let t=q(n.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const r=e;let o=(n.selectable||"").trim(),i=[];return o&&e!="boolean"&&(o.split(",").forEach(l=>{if(l){let g=l.split(":");i.push({label:l,prop:g[0].trim()})}}),e=="function"?e="function":e=="array"?e="choice":e="select"),{arr:i,zdtype:r,type:e,dataType:t}}function q(n){let t=[];return(n||"").trim().toLowerCase().split(",").forEach(r=>{r=r.trim(),r&&t.push(r)}),[...new Set(t)].sort()}exports.getHmtl=j;exports.getSpecType=T;exports.setValStringify=$;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ObjStr, ObjUnk } from '../../config';
|
|
2
2
|
import type { Spec } from '../../utils/index';
|
|
3
3
|
export declare function getHmtl(propsname: string, value: ObjUnk, slotValue?: ObjStr, propsText?: ObjStr): string;
|
|
4
|
+
export declare function setValStringify(v: unknown, key: string, propsText?: ObjStr): string;
|
|
4
5
|
type SelectsObj = {
|
|
5
6
|
label: string;
|
|
6
7
|
prop: unknown;
|
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import { humpToLine as
|
|
1
|
+
import { humpToLine as b } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js";
|
|
2
2
|
import { firstUpper as g } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js";
|
|
3
|
-
import { firstLower as
|
|
4
|
-
import { vueFormat as d, getFunctionFormat as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
let
|
|
8
|
-
Object.keys(
|
|
9
|
-
let c =
|
|
10
|
-
if (/^on[A-Z]/.test(
|
|
11
|
-
let f =
|
|
12
|
-
const p =
|
|
13
|
-
let
|
|
14
|
-
if (p.length > 1 ? (
|
|
15
|
-
let a =
|
|
16
|
-
a = a.map((h,
|
|
3
|
+
import { firstLower as F } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js";
|
|
4
|
+
import { vueFormat as d, getFunctionFormat as S, prettierFormat as j, getFunBody as w } from "./util.js";
|
|
5
|
+
function T(n, t, e, r) {
|
|
6
|
+
const o = [], i = [];
|
|
7
|
+
let l = !0;
|
|
8
|
+
Object.keys(t).forEach((s) => {
|
|
9
|
+
let c = t[s];
|
|
10
|
+
if (/^on[A-Z]/.test(s) && typeof c == "function") {
|
|
11
|
+
let f = s.substring(2);
|
|
12
|
+
const p = s.split(":");
|
|
13
|
+
let u;
|
|
14
|
+
if (p.length > 1 ? (u = p[0] + p.slice(1).map((a) => g(a)).join(""), f = F(f)) : (u = p[0], f = b(f)), p.includes("-")) {
|
|
15
|
+
let a = u.split("-");
|
|
16
|
+
a = a.map((h, y) => y != 0 ? g(h) : h), u = a.join("");
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
" @" + f + '="' +
|
|
20
|
-
),
|
|
21
|
-
" console.log('" +
|
|
22
|
-
),
|
|
23
|
-
} else if (
|
|
24
|
-
" :" +
|
|
18
|
+
o.push(
|
|
19
|
+
" @" + f + '="' + u + '"'
|
|
20
|
+
), i.push("function " + u + "(...arr) {"), i.push(
|
|
21
|
+
" console.log('" + u + "', arr)"
|
|
22
|
+
), i.push("}");
|
|
23
|
+
} else if (o.push(
|
|
24
|
+
" :" + s + '="' + s + '"'
|
|
25
25
|
), typeof c == "function")
|
|
26
|
-
|
|
27
|
-
"const " +
|
|
26
|
+
i.push(
|
|
27
|
+
"const " + s + " = " + O(
|
|
28
28
|
c,
|
|
29
|
-
|
|
29
|
+
s,
|
|
30
30
|
r
|
|
31
31
|
)
|
|
32
32
|
);
|
|
33
|
-
else if (
|
|
33
|
+
else if (l && (l = !1, i.unshift(
|
|
34
34
|
"import { ref } from 'vue';"
|
|
35
35
|
)), typeof c > "u")
|
|
36
|
-
|
|
36
|
+
i.push("const " + s + " = ref();");
|
|
37
37
|
else {
|
|
38
|
-
let f =
|
|
38
|
+
let f = z(
|
|
39
39
|
c,
|
|
40
|
-
|
|
40
|
+
s,
|
|
41
41
|
r
|
|
42
42
|
);
|
|
43
|
-
|
|
44
|
-
"const " +
|
|
43
|
+
i.push(
|
|
44
|
+
"const " + s + " = ref(" + f + ");"
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
|
-
}),
|
|
48
|
-
const m =
|
|
49
|
-
return `<!--${
|
|
47
|
+
}), o.length > 0 && o.unshift("");
|
|
48
|
+
const m = E(e);
|
|
49
|
+
return `<!--${n}-->
|
|
50
50
|
<template>
|
|
51
51
|
<div>
|
|
52
|
-
<${
|
|
52
|
+
<${n}${o.join(`
|
|
53
53
|
`)}>${m.join(`
|
|
54
54
|
`)}
|
|
55
|
-
</${
|
|
55
|
+
</${n}>
|
|
56
56
|
</div>
|
|
57
57
|
</template>
|
|
58
58
|
<script lang="ts" setup>
|
|
59
|
-
${
|
|
59
|
+
${i.join(`
|
|
60
60
|
`)}
|
|
61
61
|
<\/script>
|
|
62
62
|
`;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
return Object.keys(
|
|
67
|
-
const r =
|
|
64
|
+
function E(n = {}) {
|
|
65
|
+
const t = [];
|
|
66
|
+
return Object.keys(n).forEach((e) => {
|
|
67
|
+
const r = n[e];
|
|
68
68
|
if (r) {
|
|
69
|
-
const
|
|
69
|
+
const o = ` <template #${e}="scope">
|
|
70
70
|
${d(r, " ")}
|
|
71
71
|
</template>`;
|
|
72
|
-
|
|
72
|
+
t.push(o);
|
|
73
73
|
}
|
|
74
|
-
}),
|
|
74
|
+
}), t && t.length > 0 && t.unshift(""), t;
|
|
75
|
+
}
|
|
76
|
+
function O(n, t, e) {
|
|
77
|
+
const r = e ? e[t] : "";
|
|
78
|
+
return r ? "function" + r : $(n.toString());
|
|
75
79
|
}
|
|
76
|
-
function
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const i = F(
|
|
82
|
-
S(t.toString())
|
|
83
|
-
);
|
|
84
|
-
if (i) {
|
|
85
|
-
let s = `{
|
|
86
|
-
${d(j(i.body), " ")}
|
|
80
|
+
function $(n) {
|
|
81
|
+
const t = S(j(n));
|
|
82
|
+
if (t) {
|
|
83
|
+
let e = `{
|
|
84
|
+
${d(w(t.body), " ")}
|
|
87
85
|
}`;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
86
|
+
return `function${t.param}${e}`;
|
|
87
|
+
} else
|
|
88
|
+
return "undefined";
|
|
92
89
|
}
|
|
93
|
-
function
|
|
94
|
-
const
|
|
95
|
-
return /^\(/.test(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
function L(n) {
|
|
91
|
+
const t = n.trim();
|
|
92
|
+
return /^\(/.test(t) ? $(t) : JSON.stringify(
|
|
93
|
+
new Function(
|
|
94
|
+
"",
|
|
95
|
+
`{
|
|
96
|
+
return ${n}
|
|
99
97
|
}`
|
|
98
|
+
)
|
|
100
99
|
);
|
|
101
100
|
}
|
|
102
|
-
function
|
|
103
|
-
const r =
|
|
104
|
-
return r ||
|
|
101
|
+
function z(n, t, e) {
|
|
102
|
+
const r = e ? e[t] : "";
|
|
103
|
+
return r || (typeof n == "string" ? L(n + "") : JSON.stringify(n));
|
|
105
104
|
}
|
|
106
|
-
function
|
|
107
|
-
let
|
|
108
|
-
|
|
109
|
-
const r =
|
|
110
|
-
let
|
|
111
|
-
return
|
|
112
|
-
if (
|
|
113
|
-
let m =
|
|
114
|
-
|
|
115
|
-
label:
|
|
105
|
+
function U(n) {
|
|
106
|
+
let t = B(n.type), e = "any";
|
|
107
|
+
t.length == 1 && (e = t[0].split("<")[0]);
|
|
108
|
+
const r = e;
|
|
109
|
+
let o = (n.selectable || "").trim(), i = [];
|
|
110
|
+
return o && e != "boolean" && (o.split(",").forEach((l) => {
|
|
111
|
+
if (l) {
|
|
112
|
+
let m = l.split(":");
|
|
113
|
+
i.push({
|
|
114
|
+
label: l,
|
|
116
115
|
prop: m[0].trim()
|
|
117
116
|
});
|
|
118
117
|
}
|
|
119
|
-
}),
|
|
120
|
-
arr:
|
|
118
|
+
}), e == "function" ? e = "function" : e == "array" ? e = "choice" : e = "select"), {
|
|
119
|
+
arr: i,
|
|
121
120
|
zdtype: r,
|
|
122
|
-
type:
|
|
123
|
-
dataType:
|
|
121
|
+
type: e,
|
|
122
|
+
dataType: t
|
|
124
123
|
};
|
|
125
124
|
}
|
|
126
|
-
function
|
|
127
|
-
let
|
|
128
|
-
return (
|
|
129
|
-
r = r.trim(), r &&
|
|
130
|
-
}), [...new Set(
|
|
125
|
+
function B(n) {
|
|
126
|
+
let t = [];
|
|
127
|
+
return (n || "").trim().toLowerCase().split(",").forEach((r) => {
|
|
128
|
+
r = r.trim(), r && t.push(r);
|
|
129
|
+
}), [...new Set(t)].sort();
|
|
131
130
|
}
|
|
132
131
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
T as getHmtl,
|
|
133
|
+
U as getSpecType,
|
|
134
|
+
z as setValStringify
|
|
135
135
|
};
|