@fangzhongya/vue-archive 0.0.35 → 0.0.36
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 +13 -13
- package/dist/node/index.js +13 -13
- package/dist/packages/components/use/code.cjs +12 -12
- package/dist/packages/components/use/code.d.ts +1 -0
- package/dist/packages/components/use/code.js +122 -110
- package/dist/packages/components/use/index.cjs +1 -1
- package/dist/packages/components/use/index.js +23 -22
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -3531,6 +3531,19 @@ function getType(value) {
|
|
|
3531
3531
|
});
|
|
3532
3532
|
return [...new Set(arr)].sort();
|
|
3533
3533
|
}
|
|
3534
|
+
function getObjValue(d) {
|
|
3535
|
+
try {
|
|
3536
|
+
return new Function(`{ return ${d} }`)();
|
|
3537
|
+
} catch (error) {
|
|
3538
|
+
return "" + d;
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
function getDefaultValue(obj) {
|
|
3542
|
+
const vo = getSpecType(obj);
|
|
3543
|
+
const v = getTypeValue(vo.dataType);
|
|
3544
|
+
const d = (obj.default || "").trim();
|
|
3545
|
+
return getObjValue(d || v);
|
|
3546
|
+
}
|
|
3534
3547
|
|
|
3535
3548
|
// packages/components/compo/index.ts
|
|
3536
3549
|
var notesObj = {
|
|
@@ -3986,19 +3999,6 @@ function gettests(obj, arr, n) {
|
|
|
3986
3999
|
}
|
|
3987
4000
|
}
|
|
3988
4001
|
}
|
|
3989
|
-
function getObjValue(d) {
|
|
3990
|
-
try {
|
|
3991
|
-
return new Function(`{ return ${d} }`)();
|
|
3992
|
-
} catch (error) {
|
|
3993
|
-
return "" + d;
|
|
3994
|
-
}
|
|
3995
|
-
}
|
|
3996
|
-
function getDefaultValue(obj) {
|
|
3997
|
-
const vo = getSpecType(obj);
|
|
3998
|
-
const v = getTypeValue(vo.dataType);
|
|
3999
|
-
const d = (obj.default || "").trim();
|
|
4000
|
-
return getObjValue(d || v);
|
|
4001
|
-
}
|
|
4002
4002
|
function setVue(propsname, param, url) {
|
|
4003
4003
|
const ps = getPropsValue2(param.propss || []);
|
|
4004
4004
|
const es = getEmitsValue(param.emitss || []);
|
package/dist/node/index.js
CHANGED
|
@@ -3516,6 +3516,19 @@ function getType(value) {
|
|
|
3516
3516
|
});
|
|
3517
3517
|
return [...new Set(arr)].sort();
|
|
3518
3518
|
}
|
|
3519
|
+
function getObjValue(d) {
|
|
3520
|
+
try {
|
|
3521
|
+
return new Function(`{ return ${d} }`)();
|
|
3522
|
+
} catch (error) {
|
|
3523
|
+
return "" + d;
|
|
3524
|
+
}
|
|
3525
|
+
}
|
|
3526
|
+
function getDefaultValue(obj) {
|
|
3527
|
+
const vo = getSpecType(obj);
|
|
3528
|
+
const v = getTypeValue(vo.dataType);
|
|
3529
|
+
const d = (obj.default || "").trim();
|
|
3530
|
+
return getObjValue(d || v);
|
|
3531
|
+
}
|
|
3519
3532
|
|
|
3520
3533
|
// packages/components/compo/index.ts
|
|
3521
3534
|
var notesObj = {
|
|
@@ -3971,19 +3984,6 @@ function gettests(obj, arr, n) {
|
|
|
3971
3984
|
}
|
|
3972
3985
|
}
|
|
3973
3986
|
}
|
|
3974
|
-
function getObjValue(d) {
|
|
3975
|
-
try {
|
|
3976
|
-
return new Function(`{ return ${d} }`)();
|
|
3977
|
-
} catch (error) {
|
|
3978
|
-
return "" + d;
|
|
3979
|
-
}
|
|
3980
|
-
}
|
|
3981
|
-
function getDefaultValue(obj) {
|
|
3982
|
-
const vo = getSpecType(obj);
|
|
3983
|
-
const v = getTypeValue(vo.dataType);
|
|
3984
|
-
const d = (obj.default || "").trim();
|
|
3985
|
-
return getObjValue(d || v);
|
|
3986
|
-
}
|
|
3987
3987
|
function setVue(propsname, param, url) {
|
|
3988
3988
|
const ps = getPropsValue2(param.propss || []);
|
|
3989
3989
|
const es = getEmitsValue(param.emitss || []);
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const C=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const H=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const C=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const H=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const O=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const c=require("./util.cjs"),q=require("../../utils/props.cjs"),J=require("@fangzhongya/utils/basic/string/toFunction"),N=["class"];function V(e,t){return e.filter(n=>n.name==t)[0]}function P(e){return e.map(t=>(t.prop||"...arr")+":"+c.setDataType(t.dataType)).join(",")}function v(e,t,n,s,l,$){const p=[],r=[];let b=!0;const L=q.getPropsValue(t.propss||[]),x=q.getEmitsValue(t.emitss||[]),z=q.getExposeValue(t.exposes||[]),B=q.getSlotValue(t.slots||[]);Object.keys(n).forEach(o=>{let m=n[o];if(/^on[A-Z]/.test(o)&&typeof m=="function"){let i=o.substring(2);const u=o.split(":");let g;if(u.length>1?(g=u[0]+u.slice(1).map(f=>O.firstUpper(f)).join(""),i=H.firstLower(i)):(g=u[0],i=C.humpToLine(i)),u.includes("-")){let f=g.split("-");f=f.map((h,T)=>T!=0?O.firstUpper(h):h),g=f.join("")}p.push(" @"+i+'="'+g+'"');const a=V(x,i)||{},y=a.selectable||"",S=c.parseParamString(y),d=P(S);r.push(`// ${a.description} ${a.name}: (${a.selectable})`),r.push("function "+g+"("+d+") {"),S.forEach(f=>{const h=f.name||"arr";r.push(" console.log('"+f.label+"', "+h+")")}),r.push("}")}else{let i=o;N.includes(o)&&(i=o+"1"),p.push(" :"+o+'="'+i+'"');const u=V(L,o)||{},g=j(u);if(r.push(`// ${u.description} ${u.name}: {${u.type}} (${u.selectable})`),typeof m=="function")r.push("const "+o+" = "+D(m,o,l));else if(b&&(b=!1,r.unshift("import { ref } from 'vue';")),typeof m>"u")if(g.type=="function"){const a=M(u);r.push("const "+i+" = "+a+";")}else{const a=c.getTypeValue(g.dataType);r.push("const "+i+" = ref("+(a==="undefined"?"":a)+");")}else{let a=F(m,o,l);r.push("const "+i+" = ref("+a+");")}}});const E=Object.values($||{});E.length>0&&(b&&(b=!1,r.unshift("import { ref } from 'vue';")),p.unshift(' ref="refDom"'),r.push("const refDom = ref()"),E.forEach(o=>{const m=V(z,o.name)||{};r.push(`// ${m.description} ${m.name}:(${m.selectable}) ${m.type}`);const i=o.name+"Value",u=c.parseParamString(m?.selectable||""),g=[],a=o.params||[];u.forEach((y,S)=>{const d=y.name;if(d){const f=d+o.name,h=a[S];if(r.push(`// ${y.label}`),typeof h=="function")r.push("const "+f+" = "+D(h,d,o.text));else if(typeof h>"u")r.push("const "+f+" = "+c.getTypeValue(y.dataType)+";");else{let T=F(h,d,o.text);r.push("const "+f+" = "+T+";")}g.push(f)}}),o.type==="function"?r.push(`const ${i} = refDom.value?.${o.name}(${g.join(", ")})`):r.push(`const ${i} = refDom.value?.${o.name}`),r.push(`console.log('"${m.type}"', ${i})`)})),p.length>0&&p.unshift("");const U=A(s,B);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>
|
|
9
9
|
</template>
|
|
10
10
|
<script lang="ts" setup>
|
|
11
|
-
${
|
|
11
|
+
${r.join(`
|
|
12
12
|
`)}
|
|
13
13
|
<\/script>
|
|
14
|
-
`}function
|
|
15
|
-
<template #${
|
|
16
|
-
${
|
|
17
|
-
</template>`;
|
|
18
|
-
${
|
|
19
|
-
}`;return`function (${t.param}) ${
|
|
20
|
-
${
|
|
21
|
-
}`;return`function (${
|
|
14
|
+
`}function A(e={},t){const n=[];return Object.keys(e).forEach(s=>{const l=V(t,s)||{},$=e[s];if($){const p=` <!-- ${l.description} ${l.name}:(${l.selectable}) -->
|
|
15
|
+
<template #${s}="scope">
|
|
16
|
+
${c.vueFormat($," ")}
|
|
17
|
+
</template>`;n.push(p)}}),n&&n.length>0&&n.unshift(""),n}function D(e,t,n){const s=n?n[t]:"";return s||w(e.toString())}function w(e){const t=J.getFunctionFormat(c.prettierFormat(e));if(t){let n=`{
|
|
18
|
+
${c.vueFormat(c.getFunBody(t.body)," ")}
|
|
19
|
+
}`;return`function (${t.param}) ${n}`}else return"undefined"}function M(e){const t=c.parseParamString(e.selectable),n=P(t);let s="";e.return&&(s="return ");let l=`{
|
|
20
|
+
${c.vueFormat(c.getFunBody(s)," ")}
|
|
21
|
+
}`;return`function (${n}) ${l}`}function Z(e){const t=e.trim();return/^\(/.test(t)?w(t):JSON.stringify(e)}function F(e,t,n){const s=n?n[t]:"";return s||(typeof e=="string"?Z(e+""):JSON.stringify(e))}function j(e){let t=G(e?.type),n="any";t.length==1&&(n=t[0].split("<")[0]);const s=n;let l=(e?.selectable||"").trim(),$=[];return l&&n!="boolean"&&(l.includes("|")?l.split("|").forEach(p=>{if(p){let r=p.split(":");$.push({label:p,prop:r[0].trim()})}}):$=c.parseParamString(l),n=="function"?n="function":n=="array"?n="choice":n="select"),{arr:$,zdtype:s,type:n,dataType:t}}function G(e){let t=[];return(e||"").trim().toLowerCase().split(",").forEach(s=>{s=s.trim(),s&&t.push(s)}),[...new Set(t)].sort()}function I(e){try{return new Function(`{ return ${e} }`)()}catch{return""+e}}function K(e){const t=j(e),n=c.getTypeValue(t.dataType),s=(e.default||"").trim();return I(s||n)}exports.getDefaultValue=K;exports.getHmtl=v;exports.getSpecType=j;exports.setValStringify=F;
|
|
@@ -1,187 +1,199 @@
|
|
|
1
1
|
import "@fangzhongya/utils/basic/object/mergeObject";
|
|
2
2
|
import "@fangzhongya/utils/basic/array/toggleArray";
|
|
3
|
-
import { humpToLine as
|
|
3
|
+
import { humpToLine as H } from "@fangzhongya/utils/name/humpToLine";
|
|
4
4
|
import "@fangzhongya/utils/name/lineToLargeHump";
|
|
5
5
|
import "@fangzhongya/utils/basic/string/appearNum";
|
|
6
|
-
import { firstLower as
|
|
6
|
+
import { firstLower as U } from "@fangzhongya/utils/basic/string/firstLower";
|
|
7
7
|
import "@fangzhongya/utils/basic/array/duplicateRemoval";
|
|
8
8
|
import "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
9
|
-
import { firstUpper as
|
|
9
|
+
import { firstUpper as O } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
10
10
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
11
11
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
12
|
-
import {
|
|
13
|
-
import { getPropsValue as
|
|
14
|
-
import { getFunctionFormat as
|
|
15
|
-
const
|
|
16
|
-
function S(
|
|
17
|
-
return
|
|
12
|
+
import { getTypeValue as E, parseParamString as j, setDataType as Z, vueFormat as F, prettierFormat as q, getFunBody as x } from "./util.js";
|
|
13
|
+
import { getPropsValue as G, getEmitsValue as I, getExposeValue as K, getSlotValue as M } from "../../utils/props.js";
|
|
14
|
+
import { getFunctionFormat as Q } from "@fangzhongya/utils/basic/string/toFunction";
|
|
15
|
+
const R = ["class"];
|
|
16
|
+
function S(t, e) {
|
|
17
|
+
return t.filter((n) => n.name == e)[0];
|
|
18
18
|
}
|
|
19
|
-
function z(
|
|
20
|
-
return
|
|
19
|
+
function z(t) {
|
|
20
|
+
return t.map((e) => (e.prop || "...arr") + ":" + Z(e.dataType)).join(",");
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const p = [],
|
|
22
|
+
function ht(t, e, n, s, u, $) {
|
|
23
|
+
const p = [], o = [];
|
|
24
24
|
let y = !0;
|
|
25
|
-
const
|
|
26
|
-
Object.keys(
|
|
27
|
-
let a =
|
|
28
|
-
if (/^on[A-Z]/.test(
|
|
29
|
-
let i =
|
|
30
|
-
const c =
|
|
25
|
+
const B = G(e.propss || []), C = I(e.emitss || []), J = K(e.exposes || []), N = M(e.slots || []);
|
|
26
|
+
Object.keys(n).forEach((r) => {
|
|
27
|
+
let a = n[r];
|
|
28
|
+
if (/^on[A-Z]/.test(r) && typeof a == "function") {
|
|
29
|
+
let i = r.substring(2);
|
|
30
|
+
const c = r.split(":");
|
|
31
31
|
let m;
|
|
32
|
-
if (c.length > 1 ? (m = c[0] + c.slice(1).map((
|
|
33
|
-
let
|
|
34
|
-
|
|
32
|
+
if (c.length > 1 ? (m = c[0] + c.slice(1).map((f) => O(f)).join(""), i = U(i)) : (m = c[0], i = H(i)), c.includes("-")) {
|
|
33
|
+
let f = m.split("-");
|
|
34
|
+
f = f.map((h, V) => V != 0 ? O(h) : h), m = f.join("");
|
|
35
35
|
}
|
|
36
36
|
p.push(" @" + i + '="' + m + '"');
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const h =
|
|
40
|
-
|
|
41
|
-
}),
|
|
37
|
+
const l = S(C, i) || {}, d = l.selectable || "", b = j(d), g = z(b);
|
|
38
|
+
o.push(`// ${l.description} ${l.name}: (${l.selectable})`), o.push("function " + m + "(" + g + ") {"), b.forEach((f) => {
|
|
39
|
+
const h = f.name || "arr";
|
|
40
|
+
o.push(" console.log('" + f.label + "', " + h + ")");
|
|
41
|
+
}), o.push("}");
|
|
42
42
|
} else {
|
|
43
|
-
let i =
|
|
44
|
-
|
|
45
|
-
const c = S(
|
|
46
|
-
if (
|
|
43
|
+
let i = r;
|
|
44
|
+
R.includes(r) && (i = r + "1"), p.push(" :" + r + '="' + i + '"');
|
|
45
|
+
const c = S(B, r) || {}, m = P(c);
|
|
46
|
+
if (o.push(
|
|
47
47
|
`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`
|
|
48
48
|
), typeof a == "function")
|
|
49
|
-
|
|
50
|
-
"const " +
|
|
49
|
+
o.push(
|
|
50
|
+
"const " + r + " = " + D(a, r, u)
|
|
51
51
|
);
|
|
52
|
-
else if (y && (y = !1,
|
|
52
|
+
else if (y && (y = !1, o.unshift("import { ref } from 'vue';")), typeof a > "u")
|
|
53
53
|
if (m.type == "function") {
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const l = X(c);
|
|
55
|
+
o.push("const " + i + " = " + l + ";");
|
|
56
56
|
} else {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
"const " + i + " = ref(" + (
|
|
57
|
+
const l = E(m.dataType);
|
|
58
|
+
o.push(
|
|
59
|
+
"const " + i + " = ref(" + (l === "undefined" ? "" : l) + ");"
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
let
|
|
64
|
-
|
|
63
|
+
let l = w(a, r, u);
|
|
64
|
+
o.push("const " + i + " = ref(" + l + ");");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const a = S(
|
|
71
|
-
|
|
68
|
+
const T = Object.values($ || {});
|
|
69
|
+
T.length > 0 && (y && (y = !1, o.unshift("import { ref } from 'vue';")), p.unshift(' ref="refDom"'), o.push("const refDom = ref()"), T.forEach((r) => {
|
|
70
|
+
const a = S(J, r.name) || {};
|
|
71
|
+
o.push(
|
|
72
72
|
`// ${a.description} ${a.name}:(${a.selectable}) ${a.type}`
|
|
73
73
|
);
|
|
74
|
-
const i =
|
|
74
|
+
const i = r.name + "Value", c = j(a?.selectable || ""), m = [], l = r.params || [];
|
|
75
75
|
c.forEach((d, b) => {
|
|
76
76
|
const g = d.name;
|
|
77
77
|
if (g) {
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
"const " +
|
|
78
|
+
const f = g + r.name, h = l[b];
|
|
79
|
+
if (o.push(`// ${d.label}`), typeof h == "function")
|
|
80
|
+
o.push(
|
|
81
|
+
"const " + f + " = " + D(h, g, r.text)
|
|
82
82
|
);
|
|
83
83
|
else if (typeof h > "u")
|
|
84
|
-
|
|
85
|
-
"const " +
|
|
84
|
+
o.push(
|
|
85
|
+
"const " + f + " = " + E(d.dataType) + ";"
|
|
86
86
|
);
|
|
87
87
|
else {
|
|
88
|
-
let
|
|
89
|
-
|
|
88
|
+
let V = w(h, g, r.text);
|
|
89
|
+
o.push("const " + f + " = " + V + ";");
|
|
90
90
|
}
|
|
91
|
-
m.push(
|
|
91
|
+
m.push(f);
|
|
92
92
|
}
|
|
93
|
-
}),
|
|
94
|
-
`const ${i} = refDom.value?.${
|
|
95
|
-
) :
|
|
93
|
+
}), r.type === "function" ? o.push(
|
|
94
|
+
`const ${i} = refDom.value?.${r.name}(${m.join(", ")})`
|
|
95
|
+
) : o.push(`const ${i} = refDom.value?.${r.name}`), o.push(`console.log('"${a.type}"', ${i})`);
|
|
96
96
|
})), p.length > 0 && p.unshift("");
|
|
97
|
-
const
|
|
98
|
-
return `<!--${
|
|
97
|
+
const A = W(s, N);
|
|
98
|
+
return `<!--${t}-->
|
|
99
99
|
<template>
|
|
100
100
|
<div>
|
|
101
|
-
<${
|
|
102
|
-
`)}>${
|
|
101
|
+
<${t}${p.join(`
|
|
102
|
+
`)}>${A.join(`
|
|
103
103
|
`)}
|
|
104
|
-
</${
|
|
104
|
+
</${t}>
|
|
105
105
|
</div>
|
|
106
106
|
</template>
|
|
107
107
|
<script lang="ts" setup>
|
|
108
|
-
${
|
|
108
|
+
${o.join(`
|
|
109
109
|
`)}
|
|
110
110
|
<\/script>
|
|
111
111
|
`;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
const
|
|
115
|
-
return Object.keys(
|
|
116
|
-
const
|
|
113
|
+
function W(t = {}, e) {
|
|
114
|
+
const n = [];
|
|
115
|
+
return Object.keys(t).forEach((s) => {
|
|
116
|
+
const u = S(e, s) || {}, $ = t[s];
|
|
117
117
|
if ($) {
|
|
118
|
-
const p = ` <!-- ${
|
|
119
|
-
<template #${
|
|
120
|
-
${
|
|
118
|
+
const p = ` <!-- ${u.description} ${u.name}:(${u.selectable}) -->
|
|
119
|
+
<template #${s}="scope">
|
|
120
|
+
${F($, " ")}
|
|
121
121
|
</template>`;
|
|
122
|
-
|
|
122
|
+
n.push(p);
|
|
123
123
|
}
|
|
124
|
-
}),
|
|
124
|
+
}), n && n.length > 0 && n.unshift(""), n;
|
|
125
125
|
}
|
|
126
|
-
function D(
|
|
127
|
-
const
|
|
128
|
-
return
|
|
126
|
+
function D(t, e, n) {
|
|
127
|
+
const s = n ? n[e] : "";
|
|
128
|
+
return s || L(t.toString());
|
|
129
129
|
}
|
|
130
|
-
function L(
|
|
131
|
-
const e =
|
|
130
|
+
function L(t) {
|
|
131
|
+
const e = Q(q(t));
|
|
132
132
|
if (e) {
|
|
133
|
-
let
|
|
134
|
-
${
|
|
133
|
+
let n = `{
|
|
134
|
+
${F(x(e.body), " ")}
|
|
135
135
|
}`;
|
|
136
|
-
return `function (${e.param}) ${
|
|
136
|
+
return `function (${e.param}) ${n}`;
|
|
137
137
|
} else
|
|
138
138
|
return "undefined";
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const e = j(
|
|
142
|
-
let
|
|
143
|
-
|
|
144
|
-
let
|
|
145
|
-
${
|
|
140
|
+
function X(t) {
|
|
141
|
+
const e = j(t.selectable), n = z(e);
|
|
142
|
+
let s = "";
|
|
143
|
+
t.return && (s = "return ");
|
|
144
|
+
let u = `{
|
|
145
|
+
${F(x(s), " ")}
|
|
146
146
|
}`;
|
|
147
|
-
return `function (${
|
|
147
|
+
return `function (${n}) ${u}`;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
const e =
|
|
151
|
-
return /^\(/.test(e) ? L(e) : JSON.stringify(
|
|
149
|
+
function Y(t) {
|
|
150
|
+
const e = t.trim();
|
|
151
|
+
return /^\(/.test(e) ? L(e) : JSON.stringify(t);
|
|
152
152
|
}
|
|
153
|
-
function w(
|
|
154
|
-
const
|
|
155
|
-
return
|
|
153
|
+
function w(t, e, n) {
|
|
154
|
+
const s = n ? n[e] : "";
|
|
155
|
+
return s || (typeof t == "string" ? Y(t + "") : JSON.stringify(t));
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
let e = _(
|
|
159
|
-
e.length == 1 && (
|
|
160
|
-
const
|
|
161
|
-
let
|
|
162
|
-
return
|
|
157
|
+
function P(t) {
|
|
158
|
+
let e = _(t?.type), n = "any";
|
|
159
|
+
e.length == 1 && (n = e[0].split("<")[0]);
|
|
160
|
+
const s = n;
|
|
161
|
+
let u = (t?.selectable || "").trim(), $ = [];
|
|
162
|
+
return u && n != "boolean" && (u.includes("|") ? u.split("|").forEach((p) => {
|
|
163
163
|
if (p) {
|
|
164
|
-
let
|
|
164
|
+
let o = p.split(":");
|
|
165
165
|
$.push({
|
|
166
166
|
label: p,
|
|
167
|
-
prop:
|
|
167
|
+
prop: o[0].trim()
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
}) : $ = j(
|
|
170
|
+
}) : $ = j(u), n == "function" ? n = "function" : n == "array" ? n = "choice" : n = "select"), {
|
|
171
171
|
arr: $,
|
|
172
|
-
zdtype:
|
|
173
|
-
type:
|
|
172
|
+
zdtype: s,
|
|
173
|
+
type: n,
|
|
174
174
|
dataType: e
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
function _(
|
|
177
|
+
function _(t) {
|
|
178
178
|
let e = [];
|
|
179
|
-
return (
|
|
180
|
-
|
|
179
|
+
return (t || "").trim().toLowerCase().split(",").forEach((s) => {
|
|
180
|
+
s = s.trim(), s && e.push(s);
|
|
181
181
|
}), [...new Set(e)].sort();
|
|
182
182
|
}
|
|
183
|
+
function v(t) {
|
|
184
|
+
try {
|
|
185
|
+
return new Function(`{ return ${t} }`)();
|
|
186
|
+
} catch {
|
|
187
|
+
return "" + t;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function $t(t) {
|
|
191
|
+
const e = P(t), n = E(e.dataType), s = (t.default || "").trim();
|
|
192
|
+
return v(s || n);
|
|
193
|
+
}
|
|
183
194
|
export {
|
|
184
|
-
|
|
185
|
-
|
|
195
|
+
$t as getDefaultValue,
|
|
196
|
+
ht as getHmtl,
|
|
197
|
+
P as getSpecType,
|
|
186
198
|
w as setValStringify
|
|
187
199
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("vue"),g=require("./set-props.vue.cjs"),y=require("./set-emit.vue.cjs");;/* empty css */const T=require("./set-code.vue.cjs"),C=require("./set-expose.vue.cjs");;/* empty css */const b=require("./set-slot.vue.cjs"),l=require("../../utils/props.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");const x=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const
|
|
1
|
+
"use strict";const s=require("vue"),g=require("./set-props.vue.cjs"),y=require("./set-emit.vue.cjs");;/* empty css */const T=require("./set-code.vue.cjs"),C=require("./set-expose.vue.cjs");;/* empty css */const b=require("./set-slot.vue.cjs"),E=require("./code.cjs"),l=require("../../utils/props.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");const x=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const j=s.defineComponent({props:{value:{type:Object},param:{type:Object}},render(O,U,v,D,u){const p=s.reactive({emitValue:{},slotValue:{}}),r=v.value;let c="div";r.component?c=s.defineAsyncComponent(r.component):r.name&&(c=s.resolveComponent(r.name));const i=v.param||{},h=l.getPropsValue(i.propss||[]),m=l.getEmitsValue(i.emitss||[]),V=l.getExposeValue(i.exposes||[]),f=l.getSlotValue(i.slots||[]),a={},q={};h.forEach(t=>{let e=t.name;if(!e.includes(".")){let o=e.split("/");e=(o[0]||"").trim(),e&&(a[e]=u.propsValue[e]??E.getDefaultValue(t),o&&o.length>1&&m.push({name:"update:"+e,description:t.description,selectable:"value:["+t.type+"]"}))}}),m.forEach(t=>{let e=t.name;if(e.includes("-")){let n=e.split("-");n=n.map((_,P)=>x.firstUpper(_)),e=n.join("")}else e=x.firstUpper(e);const o="on"+e;a[o]=(...n)=>{const _={arr:n,_date_:new Date().getTime()};p.emitValue[t.name]=_}});let d;return f.forEach(t=>{const e=t.name||"default";q[e]=o=>{if(p.slotValue[e]){const n=p.slotValue[e];return s.h(s.defineComponent({props:{scope:{type:Object}},template:n}),{scope:o})}}}),s.h("div",{class:"use"},[s.h("div",{class:"use-props"},s.h(g,{name:r.name,list:h,onChange:(t,e)=>{u.propsValue=t,u.propsText=e}})),s.h("div",{class:"use-component"},s.h(c,{...a,ref:t=>{d=t}},q)),s.h("div",{class:"use-code"},s.h(T,{name:r.name,param:i,value:a,propsText:u.propsText,exposeText:u.exposeText,slotValue:p.slotValue})),s.h("div",{class:"use-emit"},s.h(y,{name:r.name,list:m,value:p.emitValue})),s.h("div",{class:"use-expose"},s.h(C,{name:r.name,list:V,getRef:()=>d,onChange:t=>{u.exposeText=t}})),s.h("div",{class:"use-slot"},s.h(b,{name:r.name,list:f,onChange:(t,e)=>{p.slotValue[t]=e}}))])},data(){return{propsValue:{},propsText:{},exposeText:{}}}});module.exports=j;
|
|
@@ -6,7 +6,8 @@ import E from "./set-code.vue.js";
|
|
|
6
6
|
import O from "./set-expose.vue.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
import $ from "./set-slot.vue.js";
|
|
9
|
-
import {
|
|
9
|
+
import { getDefaultValue as D } from "./code.js";
|
|
10
|
+
import { getPropsValue as U, getEmitsValue as k, getExposeValue as w, getSlotValue as A } from "../../utils/props.js";
|
|
10
11
|
import "@fangzhongya/utils/basic/object/mergeObject";
|
|
11
12
|
import "@fangzhongya/utils/basic/array/toggleArray";
|
|
12
13
|
import "@fangzhongya/utils/name/humpToLine";
|
|
@@ -18,7 +19,7 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
|
18
19
|
import { firstUpper as g } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
19
20
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
20
21
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
21
|
-
const
|
|
22
|
+
const me = _({
|
|
22
23
|
/**
|
|
23
24
|
* @props {Stinrg} value 插入数据
|
|
24
25
|
*/
|
|
@@ -30,19 +31,19 @@ const oe = _({
|
|
|
30
31
|
type: Object
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
|
-
render(
|
|
34
|
-
const
|
|
34
|
+
render(P, R, f, S, r) {
|
|
35
|
+
const n = T({
|
|
35
36
|
emitValue: {},
|
|
36
37
|
slotValue: {}
|
|
37
38
|
}), o = f.value;
|
|
38
39
|
let l = "div";
|
|
39
40
|
o.component ? l = b(o.component) : o.name && (l = j(o.name));
|
|
40
|
-
const a = f.param || {}, d =
|
|
41
|
+
const a = f.param || {}, d = U(a.propss || []), c = k(a.emitss || []), h = w(a.exposes || []), V = A(a.slots || []), i = {}, x = {};
|
|
41
42
|
d.forEach((t) => {
|
|
42
43
|
let e = t.name;
|
|
43
44
|
if (!e.includes(".")) {
|
|
44
45
|
let p = e.split("/");
|
|
45
|
-
e = (p[0] || "").trim(), e && (i[e] =
|
|
46
|
+
e = (p[0] || "").trim(), e && (i[e] = r.propsValue[e] ?? D(t), p && p.length > 1 && c.push({
|
|
46
47
|
name: "update:" + e,
|
|
47
48
|
description: t.description,
|
|
48
49
|
selectable: "value:[" + t.type + "]"
|
|
@@ -52,7 +53,7 @@ const oe = _({
|
|
|
52
53
|
let e = t.name;
|
|
53
54
|
if (e.includes("-")) {
|
|
54
55
|
let m = e.split("-");
|
|
55
|
-
m = m.map((u,
|
|
56
|
+
m = m.map((u, q) => g(u)), e = m.join("");
|
|
56
57
|
} else
|
|
57
58
|
e = g(e);
|
|
58
59
|
const p = "on" + e;
|
|
@@ -61,15 +62,15 @@ const oe = _({
|
|
|
61
62
|
arr: m,
|
|
62
63
|
_date_: (/* @__PURE__ */ new Date()).getTime()
|
|
63
64
|
};
|
|
64
|
-
|
|
65
|
+
n.emitValue[t.name] = u;
|
|
65
66
|
};
|
|
66
67
|
});
|
|
67
68
|
let v;
|
|
68
|
-
return
|
|
69
|
+
return V.forEach((t) => {
|
|
69
70
|
const e = t.name || "default";
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
const m =
|
|
71
|
+
x[e] = (p) => {
|
|
72
|
+
if (n.slotValue[e]) {
|
|
73
|
+
const m = n.slotValue[e];
|
|
73
74
|
return s(
|
|
74
75
|
_({
|
|
75
76
|
props: {
|
|
@@ -100,7 +101,7 @@ const oe = _({
|
|
|
100
101
|
name: o.name,
|
|
101
102
|
list: d,
|
|
102
103
|
onChange: (t, e) => {
|
|
103
|
-
|
|
104
|
+
r.propsValue = t, r.propsText = e;
|
|
104
105
|
}
|
|
105
106
|
})
|
|
106
107
|
),
|
|
@@ -117,7 +118,7 @@ const oe = _({
|
|
|
117
118
|
v = t;
|
|
118
119
|
}
|
|
119
120
|
},
|
|
120
|
-
|
|
121
|
+
x
|
|
121
122
|
)
|
|
122
123
|
),
|
|
123
124
|
s(
|
|
@@ -129,9 +130,9 @@ const oe = _({
|
|
|
129
130
|
name: o.name,
|
|
130
131
|
param: a,
|
|
131
132
|
value: i,
|
|
132
|
-
propsText:
|
|
133
|
-
exposeText:
|
|
134
|
-
slotValue:
|
|
133
|
+
propsText: r.propsText,
|
|
134
|
+
exposeText: r.exposeText,
|
|
135
|
+
slotValue: n.slotValue
|
|
135
136
|
})
|
|
136
137
|
),
|
|
137
138
|
s(
|
|
@@ -142,7 +143,7 @@ const oe = _({
|
|
|
142
143
|
s(y, {
|
|
143
144
|
name: o.name,
|
|
144
145
|
list: c,
|
|
145
|
-
value:
|
|
146
|
+
value: n.emitValue
|
|
146
147
|
})
|
|
147
148
|
),
|
|
148
149
|
s(
|
|
@@ -155,7 +156,7 @@ const oe = _({
|
|
|
155
156
|
list: h,
|
|
156
157
|
getRef: () => v,
|
|
157
158
|
onChange: (t) => {
|
|
158
|
-
|
|
159
|
+
r.exposeText = t;
|
|
159
160
|
}
|
|
160
161
|
})
|
|
161
162
|
),
|
|
@@ -166,9 +167,9 @@ const oe = _({
|
|
|
166
167
|
},
|
|
167
168
|
s($, {
|
|
168
169
|
name: o.name,
|
|
169
|
-
list:
|
|
170
|
+
list: V,
|
|
170
171
|
onChange: (t, e) => {
|
|
171
|
-
|
|
172
|
+
n.slotValue[t] = e;
|
|
172
173
|
}
|
|
173
174
|
})
|
|
174
175
|
)
|
|
@@ -191,5 +192,5 @@ const oe = _({
|
|
|
191
192
|
// },
|
|
192
193
|
});
|
|
193
194
|
export {
|
|
194
|
-
|
|
195
|
+
me as default
|
|
195
196
|
};
|