@fangzhongya/vue-archive 0.0.3-3 → 0.0.3-4
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 +78 -9
- package/dist/node/index.js +78 -9
- package/dist/packages/components/compo/index.vue.cjs +1 -1
- package/dist/packages/components/compo/index.vue.js +48 -42
- package/dist/packages/components/use/code.cjs +12 -12
- package/dist/packages/components/use/code.d.ts +12 -0
- package/dist/packages/components/use/code.js +95 -67
- package/dist/packages/components/use/index.cjs +1 -1
- package/dist/packages/components/use/index.js +1 -1
- package/dist/packages/components/use/set-props.vue.cjs +1 -1
- package/dist/packages/components/use/set-props.vue.js +46 -63
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -66527,22 +66527,76 @@ ${vueFormat(getFunBody(st.body), " ")}
|
|
|
66527
66527
|
}
|
|
66528
66528
|
}
|
|
66529
66529
|
function getChange(str) {
|
|
66530
|
-
|
|
66531
|
-
|
|
66532
|
-
|
|
66533
|
-
|
|
66534
|
-
|
|
66535
|
-
|
|
66536
|
-
|
|
66530
|
+
const tr = str.trim();
|
|
66531
|
+
if (/^\(/.test(tr)) {
|
|
66532
|
+
return new Function("", str);
|
|
66533
|
+
} else {
|
|
66534
|
+
return new Function(
|
|
66535
|
+
"",
|
|
66536
|
+
`{
|
|
66537
|
+
var a = ${str};
|
|
66538
|
+
return a;
|
|
66539
|
+
}`
|
|
66540
|
+
);
|
|
66541
|
+
}
|
|
66537
66542
|
}
|
|
66538
66543
|
function setValStringify(v, key, propsText) {
|
|
66539
66544
|
const text = propsText ? propsText[key] : "";
|
|
66540
66545
|
if (text) {
|
|
66541
66546
|
return text;
|
|
66542
66547
|
} else {
|
|
66543
|
-
|
|
66548
|
+
if (typeof v == "string") {
|
|
66549
|
+
return JSON.stringify(getChange(v + ""));
|
|
66550
|
+
} else {
|
|
66551
|
+
return JSON.stringify(v);
|
|
66552
|
+
}
|
|
66544
66553
|
}
|
|
66545
66554
|
}
|
|
66555
|
+
function getSpecType(val) {
|
|
66556
|
+
let tarr = getType2(val.type);
|
|
66557
|
+
let type = "any";
|
|
66558
|
+
if (tarr.length == 1) {
|
|
66559
|
+
type = tarr[0].split("<")[0];
|
|
66560
|
+
}
|
|
66561
|
+
const zdtype = type;
|
|
66562
|
+
let selectable = (val.selectable || "").trim();
|
|
66563
|
+
let arr = [];
|
|
66564
|
+
if (selectable && type != "boolean") {
|
|
66565
|
+
selectable.split(",").forEach((v) => {
|
|
66566
|
+
if (v) {
|
|
66567
|
+
let z = v.split(":");
|
|
66568
|
+
arr.push({
|
|
66569
|
+
label: v,
|
|
66570
|
+
prop: z[0].trim()
|
|
66571
|
+
});
|
|
66572
|
+
}
|
|
66573
|
+
});
|
|
66574
|
+
if (type == "function") {
|
|
66575
|
+
type = "function";
|
|
66576
|
+
} else if (type == "array") {
|
|
66577
|
+
type = "choice";
|
|
66578
|
+
} else {
|
|
66579
|
+
type = "select";
|
|
66580
|
+
}
|
|
66581
|
+
}
|
|
66582
|
+
return {
|
|
66583
|
+
arr,
|
|
66584
|
+
zdtype,
|
|
66585
|
+
type,
|
|
66586
|
+
dataType: tarr
|
|
66587
|
+
};
|
|
66588
|
+
}
|
|
66589
|
+
function getType2(value) {
|
|
66590
|
+
let arr = [];
|
|
66591
|
+
let str = (value || "").trim().toLowerCase();
|
|
66592
|
+
str.split(",").forEach((v) => {
|
|
66593
|
+
v = v.trim();
|
|
66594
|
+
if (v) {
|
|
66595
|
+
arr.push(v);
|
|
66596
|
+
}
|
|
66597
|
+
});
|
|
66598
|
+
return [...new Set(arr)].sort();
|
|
66599
|
+
}
|
|
66546
66600
|
|
|
66547
66601
|
// packages/node/index.ts
|
|
66548
66602
|
var Fang;
|
|
@@ -66610,6 +66664,21 @@ function gettests(obj, arr, n) {
|
|
|
66610
66664
|
setMd(obj, arr);
|
|
66611
66665
|
}
|
|
66612
66666
|
}
|
|
66667
|
+
function getDefaultValue(obj) {
|
|
66668
|
+
const vo = getSpecType(obj).zdtype;
|
|
66669
|
+
const d = (obj.default || "").trim();
|
|
66670
|
+
if (vo == "function") {
|
|
66671
|
+
return new Function("", d);
|
|
66672
|
+
} else {
|
|
66673
|
+
return new Function(
|
|
66674
|
+
"",
|
|
66675
|
+
`{
|
|
66676
|
+
var a = ${d};
|
|
66677
|
+
return a;
|
|
66678
|
+
}`
|
|
66679
|
+
);
|
|
66680
|
+
}
|
|
66681
|
+
}
|
|
66613
66682
|
function setVue(propsname, param, url) {
|
|
66614
66683
|
const ps = getPropsValue(param.propss);
|
|
66615
66684
|
const es = getEmitsValue(param.emitss);
|
|
@@ -66620,7 +66689,7 @@ function setVue(propsname, param, url) {
|
|
|
66620
66689
|
let arr = name.split("/");
|
|
66621
66690
|
name = (arr[0] || "").trim();
|
|
66622
66691
|
if (name) {
|
|
66623
|
-
propsObj[name] = val
|
|
66692
|
+
propsObj[name] = getDefaultValue(val);
|
|
66624
66693
|
if (arr && arr.length > 1) {
|
|
66625
66694
|
es.push({
|
|
66626
66695
|
name: "update:" + name,
|
package/dist/node/index.js
CHANGED
|
@@ -66527,22 +66527,76 @@ ${vueFormat(getFunBody(st.body), " ")}
|
|
|
66527
66527
|
}
|
|
66528
66528
|
}
|
|
66529
66529
|
function getChange(str) {
|
|
66530
|
-
|
|
66531
|
-
|
|
66532
|
-
|
|
66533
|
-
|
|
66534
|
-
|
|
66535
|
-
|
|
66536
|
-
|
|
66530
|
+
const tr = str.trim();
|
|
66531
|
+
if (/^\(/.test(tr)) {
|
|
66532
|
+
return new Function("", str);
|
|
66533
|
+
} else {
|
|
66534
|
+
return new Function(
|
|
66535
|
+
"",
|
|
66536
|
+
`{
|
|
66537
|
+
var a = ${str};
|
|
66538
|
+
return a;
|
|
66539
|
+
}`
|
|
66540
|
+
);
|
|
66541
|
+
}
|
|
66537
66542
|
}
|
|
66538
66543
|
function setValStringify(v, key, propsText) {
|
|
66539
66544
|
const text = propsText ? propsText[key] : "";
|
|
66540
66545
|
if (text) {
|
|
66541
66546
|
return text;
|
|
66542
66547
|
} else {
|
|
66543
|
-
|
|
66548
|
+
if (typeof v == "string") {
|
|
66549
|
+
return JSON.stringify(getChange(v + ""));
|
|
66550
|
+
} else {
|
|
66551
|
+
return JSON.stringify(v);
|
|
66552
|
+
}
|
|
66544
66553
|
}
|
|
66545
66554
|
}
|
|
66555
|
+
function getSpecType(val) {
|
|
66556
|
+
let tarr = getType2(val.type);
|
|
66557
|
+
let type = "any";
|
|
66558
|
+
if (tarr.length == 1) {
|
|
66559
|
+
type = tarr[0].split("<")[0];
|
|
66560
|
+
}
|
|
66561
|
+
const zdtype = type;
|
|
66562
|
+
let selectable = (val.selectable || "").trim();
|
|
66563
|
+
let arr = [];
|
|
66564
|
+
if (selectable && type != "boolean") {
|
|
66565
|
+
selectable.split(",").forEach((v) => {
|
|
66566
|
+
if (v) {
|
|
66567
|
+
let z = v.split(":");
|
|
66568
|
+
arr.push({
|
|
66569
|
+
label: v,
|
|
66570
|
+
prop: z[0].trim()
|
|
66571
|
+
});
|
|
66572
|
+
}
|
|
66573
|
+
});
|
|
66574
|
+
if (type == "function") {
|
|
66575
|
+
type = "function";
|
|
66576
|
+
} else if (type == "array") {
|
|
66577
|
+
type = "choice";
|
|
66578
|
+
} else {
|
|
66579
|
+
type = "select";
|
|
66580
|
+
}
|
|
66581
|
+
}
|
|
66582
|
+
return {
|
|
66583
|
+
arr,
|
|
66584
|
+
zdtype,
|
|
66585
|
+
type,
|
|
66586
|
+
dataType: tarr
|
|
66587
|
+
};
|
|
66588
|
+
}
|
|
66589
|
+
function getType2(value) {
|
|
66590
|
+
let arr = [];
|
|
66591
|
+
let str = (value || "").trim().toLowerCase();
|
|
66592
|
+
str.split(",").forEach((v) => {
|
|
66593
|
+
v = v.trim();
|
|
66594
|
+
if (v) {
|
|
66595
|
+
arr.push(v);
|
|
66596
|
+
}
|
|
66597
|
+
});
|
|
66598
|
+
return [...new Set(arr)].sort();
|
|
66599
|
+
}
|
|
66546
66600
|
|
|
66547
66601
|
// packages/node/index.ts
|
|
66548
66602
|
var Fang;
|
|
@@ -66610,6 +66664,21 @@ function gettests(obj, arr, n) {
|
|
|
66610
66664
|
setMd(obj, arr);
|
|
66611
66665
|
}
|
|
66612
66666
|
}
|
|
66667
|
+
function getDefaultValue(obj) {
|
|
66668
|
+
const vo = getSpecType(obj).zdtype;
|
|
66669
|
+
const d = (obj.default || "").trim();
|
|
66670
|
+
if (vo == "function") {
|
|
66671
|
+
return new Function("", d);
|
|
66672
|
+
} else {
|
|
66673
|
+
return new Function(
|
|
66674
|
+
"",
|
|
66675
|
+
`{
|
|
66676
|
+
var a = ${d};
|
|
66677
|
+
return a;
|
|
66678
|
+
}`
|
|
66679
|
+
);
|
|
66680
|
+
}
|
|
66681
|
+
}
|
|
66613
66682
|
function setVue(propsname, param, url) {
|
|
66614
66683
|
const ps = getPropsValue(param.propss);
|
|
66615
66684
|
const es = getEmitsValue(param.emitss);
|
|
@@ -66620,7 +66689,7 @@ function setVue(propsname, param, url) {
|
|
|
66620
66689
|
let arr = name.split("/");
|
|
66621
66690
|
name = (arr[0] || "").trim();
|
|
66622
66691
|
if (name) {
|
|
66623
|
-
propsObj[name] = val
|
|
66692
|
+
propsObj[name] = getDefaultValue(val);
|
|
66624
66693
|
if (arr && arr.length > 1) {
|
|
66625
66694
|
es.push({
|
|
66626
66695
|
name: "update:" + name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),
|
|
1
|
+
"use strict";const e=require("vue"),B=require("../use/index.cjs"),x=require("./info.vue.cjs"),y=require("./props.vue.cjs"),q=require("../../config.cjs"),C=require("../md/index.vue.cjs");require("./index.cjs");const d=require("../../utils/glob.cjs"),h={class:"compo"},N={key:0,class:"compo-md"},V={key:0,class:"compo-md-list"},E={key:1,class:"compo-use"},b=e.defineComponent({__name:"index",props:{value:Object},setup(c){const n=c,k=q.getConfig("useparam"),a=e.ref(""),u=e.reactive({md:!0}),s=e.ref([]),v=e.ref([]),p=e.ref([]),i=e.ref([]),m=e.ref([]);function f(l){let{propss:t,slots:o,emitss:r,exposes:g}=l;v.value=t,m.value=o,p.value=r,i.value=g}e.watch(()=>n.value,()=>{_()});function _(){var l,t,o;(l=n.value)!=null&&l.key&&(d.getLocalTextComponents((t=n.value)==null?void 0:t.key).then(r=>{a.value=r}),s.value=d.getKeyMds((o=n.value)==null?void 0:o.key)||[])}return _(),(l,t)=>(e.openBlock(),e.createElementBlock("div",h,[e.createVNode(x,{value:c.value},null,8,["value"]),e.createVNode(y,{onChange:f,value:a.value},null,8,["value"]),s.value&&s.value.length?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",{onClick:t[0]||(t[0]=o=>u.md=!u.md),class:"compo-md-name"}," 说明文档 "),u.md?(e.openBlock(),e.createElementBlock("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,o=>(e.openBlock(),e.createBlock(C,{value:o},null,8,["value"]))),256))])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("div",E,[e.createVNode(e.unref(B),{value:n.value,param:{props:v.value,slot:m.value,emits:p.value,expose:i.value}},null,8,["value","param"])])):e.createCommentVNode("",!0)]))}});module.exports=b;
|
|
@@ -1,70 +1,76 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { getConfig as
|
|
6
|
-
import
|
|
1
|
+
import { defineComponent as $, ref as o, reactive as B, watch as N, openBlock as s, createElementBlock as n, createVNode as c, createElementVNode as V, Fragment as E, renderList as L, createBlock as b, createCommentVNode as v, unref as x } from "vue";
|
|
2
|
+
import j from "../use/index.js";
|
|
3
|
+
import w from "./info.vue.js";
|
|
4
|
+
import D from "./props.vue.js";
|
|
5
|
+
import { getConfig as F } from "../../config.js";
|
|
6
|
+
import K from "../md/index.vue.js";
|
|
7
7
|
import "./index.js";
|
|
8
|
-
import { getLocalTextComponents as
|
|
9
|
-
const
|
|
8
|
+
import { getLocalTextComponents as M, getKeyMds as O } from "../../utils/glob.js";
|
|
9
|
+
const T = { class: "compo" }, U = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "compo-md"
|
|
12
|
-
},
|
|
12
|
+
}, q = {
|
|
13
13
|
key: 0,
|
|
14
14
|
class: "compo-md-list"
|
|
15
|
-
},
|
|
15
|
+
}, z = {
|
|
16
16
|
key: 1,
|
|
17
17
|
class: "compo-use"
|
|
18
|
-
},
|
|
18
|
+
}, S = /* @__PURE__ */ $({
|
|
19
19
|
__name: "index",
|
|
20
20
|
props: {
|
|
21
21
|
value: Object
|
|
22
22
|
},
|
|
23
|
-
setup(
|
|
24
|
-
const
|
|
23
|
+
setup(i) {
|
|
24
|
+
const a = i, h = F("useparam"), p = o(""), m = B({
|
|
25
25
|
md: !0
|
|
26
|
-
}),
|
|
27
|
-
function
|
|
28
|
-
|
|
26
|
+
}), u = o([]), d = o([]), f = o([]), _ = o([]), k = o([]);
|
|
27
|
+
function y(l) {
|
|
28
|
+
let { propss: e, slots: t, emitss: r, exposes: C } = l;
|
|
29
|
+
d.value = e, k.value = t, f.value = r, _.value = C;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
() =>
|
|
31
|
+
N(
|
|
32
|
+
() => a.value,
|
|
32
33
|
() => {
|
|
33
|
-
|
|
34
|
+
g();
|
|
34
35
|
}
|
|
35
36
|
);
|
|
36
|
-
function
|
|
37
|
-
var
|
|
38
|
-
(
|
|
39
|
-
(
|
|
40
|
-
p.value =
|
|
37
|
+
function g() {
|
|
38
|
+
var l, e, t;
|
|
39
|
+
(l = a.value) != null && l.key && (M((e = a.value) == null ? void 0 : e.key).then(
|
|
40
|
+
(r) => {
|
|
41
|
+
p.value = r;
|
|
41
42
|
}
|
|
42
|
-
),
|
|
43
|
+
), u.value = O((t = a.value) == null ? void 0 : t.key) || []);
|
|
43
44
|
}
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
onChange:
|
|
45
|
+
return g(), (l, e) => (s(), n("div", T, [
|
|
46
|
+
c(w, { value: i.value }, null, 8, ["value"]),
|
|
47
|
+
c(D, {
|
|
48
|
+
onChange: y,
|
|
48
49
|
value: p.value
|
|
49
50
|
}, null, 8, ["value"]),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
onClick:
|
|
51
|
+
u.value && u.value.length ? (s(), n("div", U, [
|
|
52
|
+
V("div", {
|
|
53
|
+
onClick: e[0] || (e[0] = (t) => m.md = !m.md),
|
|
53
54
|
class: "compo-md-name"
|
|
54
55
|
}, " 说明文档 "),
|
|
55
|
-
|
|
56
|
-
(
|
|
57
|
-
])) :
|
|
58
|
-
])) :
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
value:
|
|
62
|
-
param:
|
|
56
|
+
m.md ? (s(), n("div", q, [
|
|
57
|
+
(s(!0), n(E, null, L(u.value, (t) => (s(), b(K, { value: t }, null, 8, ["value"]))), 256))
|
|
58
|
+
])) : v("", !0)
|
|
59
|
+
])) : v("", !0),
|
|
60
|
+
x(h) ? (s(), n("div", z, [
|
|
61
|
+
c(x(j), {
|
|
62
|
+
value: a.value,
|
|
63
|
+
param: {
|
|
64
|
+
props: d.value,
|
|
65
|
+
slot: k.value,
|
|
66
|
+
emits: f.value,
|
|
67
|
+
expose: _.value
|
|
68
|
+
}
|
|
63
69
|
}, null, 8, ["value", "param"])
|
|
64
|
-
])) :
|
|
70
|
+
])) : v("", !0)
|
|
65
71
|
]));
|
|
66
72
|
}
|
|
67
73
|
});
|
|
68
74
|
export {
|
|
69
|
-
|
|
75
|
+
S as default
|
|
70
76
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=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"),b=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.cjs"),h=require("./util.cjs");function S(t,e,n,r){const i=[],s=[];let l=!0;Object.keys(e).forEach(o=>{let f=e[o];if(/^on[A-Z]/.test(o)&&typeof f=="function"){let u=o.substring(2);const a=o.split(":");let c;if(a.length>1?(c=a[0]+a.slice(1).map(p=>d.firstUpper(p)).join(""),u=b.firstLower(u)):(c=a[0],u=$.humpToLine(u)),a.includes("-")){let p=c.split("-");p=p.map((m,y)=>y!=0?d.firstUpper(m):m),c=p.join("")}i.push(" @"+u+'="'+c+'"'),s.push("function "+c+"(...arr) {"),s.push(" console.log('"+c+"', arr)"),s.push("}")}else if(i.push(" :"+o+'="'+o+'"'),typeof f=="function")s.push("const "+o+" = "+j(f,o,r));else if(l&&(l=!1,s.unshift("import { ref } from 'vue';")),typeof f>"u")s.push("const "+o+" = ref();");else{let u=J(f,o,r);s.push("const "+o+" = ref("+u+");")}}),i.length>0&&i.unshift("");const g=F(n);return`<!--${t}-->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
|
-
<${t}${
|
|
5
|
-
`)}>${
|
|
4
|
+
<${t}${i.join(`
|
|
5
|
+
`)}>${g.join(`
|
|
6
6
|
`)}
|
|
7
7
|
</${t}>
|
|
8
8
|
</div>
|
|
9
9
|
</template>
|
|
10
10
|
<script lang="ts" setup>
|
|
11
|
-
${
|
|
11
|
+
${s.join(`
|
|
12
12
|
`)}
|
|
13
13
|
<\/script>
|
|
14
|
-
`}function
|
|
15
|
-
${
|
|
16
|
-
</template>`;
|
|
17
|
-
${
|
|
18
|
-
}`;return`function${
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
`}function F(t={}){const e=[];return Object.keys(t).forEach(n=>{const r=t[n];if(r){const i=` <template #${n}="scope">
|
|
15
|
+
${h.vueFormat(r," ")}
|
|
16
|
+
</template>`;e.push(i)}}),e&&e.length>0&&e.unshift(""),e}function j(t,e,n){const r=n?n[e]:"";if(r)return"function"+r;{const i=h.getFunctionFormat(h.prettierFormat(t.toString()));if(i){let s=`{
|
|
17
|
+
${h.vueFormat(h.getFunBody(i.body)," ")}
|
|
18
|
+
}`;return`function${i.param}${s}`}else return"undefined"}}function O(t){const e=t.trim();return/^\(/.test(e)?new Function("",t):new Function("",`{
|
|
19
|
+
var a = ${t};
|
|
20
|
+
return a;
|
|
21
|
+
}`)}function J(t,e,n){const r=n?n[e]:"";return r||JSON.stringify(typeof t=="string"?O(t+""):t)}function w(t){let e=E(t.type),n="any";e.length==1&&(n=e[0].split("<")[0]);const r=n;let i=(t.selectable||"").trim(),s=[];return i&&n!="boolean"&&(i.split(",").forEach(l=>{if(l){let g=l.split(":");s.push({label:l,prop:g[0].trim()})}}),n=="function"?n="function":n=="array"?n="choice":n="select"),{arr:s,zdtype:r,type:n,dataType:e}}function E(t){let e=[];return(t||"").trim().toLowerCase().split(",").forEach(r=>{r=r.trim(),r&&e.push(r)}),[...new Set(e)].sort()}exports.getHmtl=S;exports.getSpecType=w;
|
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
import type { ObjStr, ObjUnk } from '../../config';
|
|
2
|
+
import type { Spec } from '../../utils/index';
|
|
2
3
|
export declare function getHmtl(propsname: string, value: ObjUnk, slotValue?: ObjStr, propsText?: ObjStr): string;
|
|
4
|
+
type SelectsObj = {
|
|
5
|
+
label: string;
|
|
6
|
+
prop: unknown;
|
|
7
|
+
};
|
|
8
|
+
export declare function getSpecType(val: Spec): {
|
|
9
|
+
arr: SelectsObj[];
|
|
10
|
+
zdtype: string;
|
|
11
|
+
type: string;
|
|
12
|
+
dataType: string[];
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -1,108 +1,136 @@
|
|
|
1
|
-
import { humpToLine as
|
|
2
|
-
import { firstUpper as
|
|
3
|
-
import { firstLower as
|
|
4
|
-
import { vueFormat as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
let
|
|
8
|
-
Object.keys(
|
|
9
|
-
let c =
|
|
10
|
-
if (/^on[A-Z]/.test(
|
|
11
|
-
let f =
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
if (
|
|
15
|
-
let a =
|
|
16
|
-
a = a.map((
|
|
1
|
+
import { humpToLine as y } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js";
|
|
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 b } 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 F, prettierFormat as S, getFunBody as j } from "./util.js";
|
|
5
|
+
function H(t, e, n, r) {
|
|
6
|
+
const i = [], s = [];
|
|
7
|
+
let u = !0;
|
|
8
|
+
Object.keys(e).forEach((o) => {
|
|
9
|
+
let c = e[o];
|
|
10
|
+
if (/^on[A-Z]/.test(o) && typeof c == "function") {
|
|
11
|
+
let f = o.substring(2);
|
|
12
|
+
const p = o.split(":");
|
|
13
|
+
let l;
|
|
14
|
+
if (p.length > 1 ? (l = p[0] + p.slice(1).map((a) => g(a)).join(""), f = b(f)) : (l = p[0], f = y(f)), p.includes("-")) {
|
|
15
|
+
let a = l.split("-");
|
|
16
|
+
a = a.map((h, $) => $ != 0 ? g(h) : h), l = a.join("");
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
" @" + f + '="' +
|
|
20
|
-
),
|
|
21
|
-
" console.log('" +
|
|
22
|
-
),
|
|
23
|
-
} else if (
|
|
24
|
-
" :" +
|
|
18
|
+
i.push(
|
|
19
|
+
" @" + f + '="' + l + '"'
|
|
20
|
+
), s.push("function " + l + "(...arr) {"), s.push(
|
|
21
|
+
" console.log('" + l + "', arr)"
|
|
22
|
+
), s.push("}");
|
|
23
|
+
} else if (i.push(
|
|
24
|
+
" :" + o + '="' + o + '"'
|
|
25
25
|
), typeof c == "function")
|
|
26
|
-
|
|
27
|
-
"const " +
|
|
26
|
+
s.push(
|
|
27
|
+
"const " + o + " = " + E(
|
|
28
28
|
c,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
o,
|
|
30
|
+
r
|
|
31
31
|
)
|
|
32
32
|
);
|
|
33
|
-
else if (
|
|
33
|
+
else if (u && (u = !1, s.unshift(
|
|
34
34
|
"import { ref } from 'vue';"
|
|
35
35
|
)), typeof c > "u")
|
|
36
|
-
|
|
36
|
+
s.push("const " + o + " = ref();");
|
|
37
37
|
else {
|
|
38
|
-
let f =
|
|
38
|
+
let f = L(
|
|
39
39
|
c,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
o,
|
|
41
|
+
r
|
|
42
42
|
);
|
|
43
|
-
|
|
44
|
-
"const " +
|
|
43
|
+
s.push(
|
|
44
|
+
"const " + o + " = ref(" + f + ");"
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
|
-
}),
|
|
48
|
-
const
|
|
47
|
+
}), i.length > 0 && i.unshift("");
|
|
48
|
+
const m = w(n);
|
|
49
49
|
return `<!--${t}-->
|
|
50
50
|
<template>
|
|
51
51
|
<div>
|
|
52
|
-
<${t}${
|
|
53
|
-
`)}>${
|
|
52
|
+
<${t}${i.join(`
|
|
53
|
+
`)}>${m.join(`
|
|
54
54
|
`)}
|
|
55
55
|
</${t}>
|
|
56
56
|
</div>
|
|
57
57
|
</template>
|
|
58
58
|
<script lang="ts" setup>
|
|
59
|
-
${
|
|
59
|
+
${s.join(`
|
|
60
60
|
`)}
|
|
61
61
|
<\/script>
|
|
62
62
|
`;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
return Object.keys(t).forEach((
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
${
|
|
64
|
+
function w(t = {}) {
|
|
65
|
+
const e = [];
|
|
66
|
+
return Object.keys(t).forEach((n) => {
|
|
67
|
+
const r = t[n];
|
|
68
|
+
if (r) {
|
|
69
|
+
const i = ` <template #${n}="scope">
|
|
70
|
+
${d(r, " ")}
|
|
71
71
|
</template>`;
|
|
72
|
-
|
|
72
|
+
e.push(i);
|
|
73
73
|
}
|
|
74
|
-
}),
|
|
74
|
+
}), e && e.length > 0 && e.unshift(""), e;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
return "function" +
|
|
76
|
+
function E(t, e, n) {
|
|
77
|
+
const r = n ? n[e] : "";
|
|
78
|
+
if (r)
|
|
79
|
+
return "function" + r;
|
|
80
80
|
{
|
|
81
|
-
const
|
|
82
|
-
|
|
81
|
+
const i = F(
|
|
82
|
+
S(t.toString())
|
|
83
83
|
);
|
|
84
|
-
if (
|
|
85
|
-
let
|
|
86
|
-
${
|
|
84
|
+
if (i) {
|
|
85
|
+
let s = `{
|
|
86
|
+
${d(j(i.body), " ")}
|
|
87
87
|
}`;
|
|
88
|
-
return `function${
|
|
88
|
+
return `function${i.param}${s}`;
|
|
89
89
|
} else
|
|
90
90
|
return "undefined";
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
93
|
+
function O(t) {
|
|
94
|
+
const e = t.trim();
|
|
95
|
+
return /^\(/.test(e) ? new Function("", t) : new Function(
|
|
95
96
|
"",
|
|
96
97
|
`{
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
var a = ${t};
|
|
99
|
+
return a;
|
|
100
|
+
}`
|
|
100
101
|
);
|
|
101
102
|
}
|
|
102
|
-
function
|
|
103
|
-
const
|
|
104
|
-
return
|
|
103
|
+
function L(t, e, n) {
|
|
104
|
+
const r = n ? n[e] : "";
|
|
105
|
+
return r || JSON.stringify(typeof t == "string" ? O(t + "") : t);
|
|
106
|
+
}
|
|
107
|
+
function T(t) {
|
|
108
|
+
let e = z(t.type), n = "any";
|
|
109
|
+
e.length == 1 && (n = e[0].split("<")[0]);
|
|
110
|
+
const r = n;
|
|
111
|
+
let i = (t.selectable || "").trim(), s = [];
|
|
112
|
+
return i && n != "boolean" && (i.split(",").forEach((u) => {
|
|
113
|
+
if (u) {
|
|
114
|
+
let m = u.split(":");
|
|
115
|
+
s.push({
|
|
116
|
+
label: u,
|
|
117
|
+
prop: m[0].trim()
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}), n == "function" ? n = "function" : n == "array" ? n = "choice" : n = "select"), {
|
|
121
|
+
arr: s,
|
|
122
|
+
zdtype: r,
|
|
123
|
+
type: n,
|
|
124
|
+
dataType: e
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function z(t) {
|
|
128
|
+
let e = [];
|
|
129
|
+
return (t || "").trim().toLowerCase().split(",").forEach((r) => {
|
|
130
|
+
r = r.trim(), r && e.push(r);
|
|
131
|
+
}), [...new Set(e)].sort();
|
|
105
132
|
}
|
|
106
133
|
export {
|
|
107
|
-
|
|
134
|
+
H as getHmtl,
|
|
135
|
+
T as getSpecType
|
|
108
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t=require("vue"),x=require("./set-props.vue.cjs"),q=require("./set-emit.vue.cjs"),E=require("./set-code.vue.cjs"),b=require("./set-expose.vue.cjs"),C=require("./set-slot.vue.cjs"),i=require("../../utils/props.cjs"),V=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.cjs"),j=t.defineComponent({props:{value:{type:Object},param:{type:Object}},render(O,T,v,D,a){console.log("render",new Date().getTime());const r=t.reactive({emitValue:{},slotValue:{}}),n=v.value;let c="div";n.component?c=t.defineAsyncComponent(n.component):n.name&&(c=t.resolveComponent(n.name));const u=v.param,d=i.getPropsValue(u.props),m=i.getEmitsValue(u.emits),y=i.getExposeValue(u.expose),h=i.getSlotValue(u.slot),l={},f={};d.forEach(s=>{let e=s.name;if(!e.includes(".")){let o=e.split("/");e=(o[0]||"").trim(),e&&(l[e]=a.propsValue[e],o&&o.length>1&&m.push({name:"update:"+e,description:s.description,selectable:"value:["+s.type+"]"}))}}),m.forEach(s=>{let e=s.name;if(e.includes("-")){let p=e.split("-");p=p.map((_,U)=>V.firstUpper(_)),e=p.join("")}else e=V.firstUpper(e);const o="on"+e;l[o]=(...p)=>{const _={arr:p,_date_:new Date().getTime()};r.emitValue[s.name]=_}});let g;return h.forEach(s=>{const e=s.name||"default";f[e]=o=>{if(r.slotValue[e])return t.h(t.defineComponent({props:{scope:{type:Object}},template:r.slotValue[e]}),{scope:o})}}),t.h("div",{class:"use"},[t.h("div",{class:"use-props"},t.h(x,{name:n.name,list:d,onChange:(s,e)=>{a.propsValue=s,a.propsText=e}})),t.h("div",{class:"use-component"},t.h(c,{...l,ref:s=>{g=s}},f)),t.h("div",{class:"use-code"},t.h(E,{name:n.name,value:l,propsText:a.propsText,slotValue:r.slotValue})),t.h("div",{class:"use-emit"},t.h(q,{name:n.name,list:m,value:r.emitValue})),t.h("div",{class:"use-expose"},t.h(b,{name:n.name,list:y,getRef:()=>g})),t.h("div",{class:"use-slot"},t.h(C,{name:n.name,list:h,onChange:(s,e)=>{r.slotValue[s]=e}}))])},data(){return{propsValue:{},propsText:{}}}});module.exports=j;
|
|
@@ -26,7 +26,7 @@ const K = g({
|
|
|
26
26
|
}), o = f.value;
|
|
27
27
|
let i = "div";
|
|
28
28
|
o.component ? i = j(o.component) : o.name && (i = T(o.name));
|
|
29
|
-
const p = f.param, d = D(p.
|
|
29
|
+
const p = f.param, d = D(p.props), c = w(p.emits), x = U(p.expose), V = k(p.slot), l = {}, v = {};
|
|
30
30
|
d.forEach((s) => {
|
|
31
31
|
let e = s.name;
|
|
32
32
|
if (!e.includes(".")) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t=require("vue"),V=require("./retrie/index.vue.cjs"),T=require("./code.cjs"),k={key:0,class:"set-props"},x=t.defineComponent({__name:"set-props",props:{name:String,list:Array},emits:["change"],setup(p,{emit:f}){const c=p,u=t.ref({}),m=t.ref(0),a=t.ref({}),l=t.ref([]);function d(){var e;a.value={};const n=[];(e=c.list)==null||e.forEach(s=>{let r=s.name;if(r.includes(".")?r="":r=(r.split("/")[0]||"").trim(),r){a.value[r]=(s.default||"").trim();const{arr:i,type:v,dataType:b}=T.getSpecType(s);u.value[r]=i;let g={label:_(r,s),prop:r,type:v,dataType:b,select:r};i.push(g)}}),l.value=n}function _(n,e){let s=n+": { "+(e.type||"any")+" } "+e.description;return e.default&&(s+=" 默认值="+e.default),e.selectable&&(s+=" 可选值="+e.selectable),s}function h(n,e){let s=Object.assign({},n);f("change",s,e)}let o;function y(){clearTimeout(o),o=setTimeout(()=>{d()},400)}return t.watch(()=>c.name,()=>{l.value=[],t.nextTick(()=>{y()})},{immediate:!0}),(n,e)=>l.value&&l.value.length>0?(t.openBlock(),t.createElementBlock("div",k,[t.createVNode(V,{refresh:m.value,modelValue:a.value,selects:u.value,list:l.value,name:c.name,onQuery:h},null,8,["refresh","modelValue","selects","list","name"])])):t.createCommentVNode("",!0)}});module.exports=x;
|
|
@@ -1,92 +1,75 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { defineComponent as v, ref as r, watch as T, nextTick as k, openBlock as x, createElementBlock as j, createVNode as B, createCommentVNode as C } from "vue";
|
|
2
|
+
import E from "./retrie/index.vue.js";
|
|
3
|
+
import { getSpecType as N } from "./code.js";
|
|
4
|
+
const S = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "set-props"
|
|
6
|
-
},
|
|
7
|
+
}, Q = /* @__PURE__ */ v({
|
|
7
8
|
__name: "set-props",
|
|
8
9
|
props: {
|
|
9
10
|
name: String,
|
|
10
11
|
list: Array
|
|
11
12
|
},
|
|
12
13
|
emits: ["change"],
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
function
|
|
14
|
+
setup(m, { emit: p }) {
|
|
15
|
+
const a = m, c = r({}), f = r(0), o = r({}), n = r([]);
|
|
16
|
+
function d() {
|
|
16
17
|
var e;
|
|
17
18
|
o.value = {};
|
|
18
|
-
const
|
|
19
|
-
(e =
|
|
20
|
-
let
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
label: u,
|
|
32
|
-
prop: w[0].trim()
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}), f.value[t] = h, r == "function" ? r = "function" : r == "array" ? r = "choice" : r = "select";
|
|
36
|
-
}
|
|
37
|
-
let E = {
|
|
38
|
-
label: g(t, l),
|
|
39
|
-
prop: t,
|
|
40
|
-
type: r,
|
|
41
|
-
dataType: c,
|
|
42
|
-
select: t
|
|
19
|
+
const l = [];
|
|
20
|
+
(e = a.list) == null || e.forEach((t) => {
|
|
21
|
+
let s = t.name;
|
|
22
|
+
if (s.includes(".") ? s = "" : s = (s.split("/")[0] || "").trim(), s) {
|
|
23
|
+
o.value[s] = (t.default || "").trim();
|
|
24
|
+
const { arr: i, type: b, dataType: g } = N(t);
|
|
25
|
+
c.value[s] = i;
|
|
26
|
+
let V = {
|
|
27
|
+
label: h(s, t),
|
|
28
|
+
prop: s,
|
|
29
|
+
type: b,
|
|
30
|
+
dataType: g,
|
|
31
|
+
select: s
|
|
43
32
|
};
|
|
44
|
-
|
|
33
|
+
i.push(V);
|
|
45
34
|
}
|
|
46
|
-
}),
|
|
35
|
+
}), n.value = l;
|
|
47
36
|
}
|
|
48
|
-
function
|
|
49
|
-
let
|
|
50
|
-
return e.default && (
|
|
37
|
+
function h(l, e) {
|
|
38
|
+
let t = l + ": { " + (e.type || "any") + " } " + e.description;
|
|
39
|
+
return e.default && (t += " 默认值=" + e.default), e.selectable && (t += " 可选值=" + e.selectable), t;
|
|
51
40
|
}
|
|
52
|
-
function
|
|
53
|
-
let
|
|
54
|
-
|
|
55
|
-
t = t.trim(), t && e.push(t);
|
|
56
|
-
}), [...new Set(e)].sort();
|
|
41
|
+
function _(l, e) {
|
|
42
|
+
let t = Object.assign({}, l);
|
|
43
|
+
p("change", t, e);
|
|
57
44
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
let p;
|
|
63
|
-
function k() {
|
|
64
|
-
clearTimeout(p), p = setTimeout(() => {
|
|
65
|
-
_();
|
|
45
|
+
let u;
|
|
46
|
+
function y() {
|
|
47
|
+
clearTimeout(u), u = setTimeout(() => {
|
|
48
|
+
d();
|
|
66
49
|
}, 400);
|
|
67
50
|
}
|
|
68
|
-
return
|
|
69
|
-
() =>
|
|
51
|
+
return T(
|
|
52
|
+
() => a.name,
|
|
70
53
|
() => {
|
|
71
|
-
|
|
72
|
-
|
|
54
|
+
n.value = [], k(() => {
|
|
55
|
+
y();
|
|
73
56
|
});
|
|
74
57
|
},
|
|
75
58
|
{
|
|
76
59
|
immediate: !0
|
|
77
60
|
}
|
|
78
|
-
), (
|
|
79
|
-
|
|
80
|
-
refresh:
|
|
61
|
+
), (l, e) => n.value && n.value.length > 0 ? (x(), j("div", S, [
|
|
62
|
+
B(E, {
|
|
63
|
+
refresh: f.value,
|
|
81
64
|
modelValue: o.value,
|
|
82
|
-
selects:
|
|
83
|
-
list:
|
|
84
|
-
name:
|
|
85
|
-
onQuery:
|
|
65
|
+
selects: c.value,
|
|
66
|
+
list: n.value,
|
|
67
|
+
name: a.name,
|
|
68
|
+
onQuery: _
|
|
86
69
|
}, null, 8, ["refresh", "modelValue", "selects", "list", "name"])
|
|
87
|
-
])) :
|
|
70
|
+
])) : C("", !0);
|
|
88
71
|
}
|
|
89
72
|
});
|
|
90
73
|
export {
|
|
91
|
-
|
|
74
|
+
Q as default
|
|
92
75
|
};
|