@fangzhongya/vue-archive 0.0.44 → 0.0.45
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 +12 -8
- package/dist/node/index.js +12 -8
- package/dist/packages/components/use/code.cjs +8 -8
- package/dist/packages/components/use/code.d.ts +1 -1
- package/dist/packages/components/use/code.js +103 -98
- 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 +15 -17
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -3520,7 +3520,7 @@ function getSpecType(val) {
|
|
|
3520
3520
|
let z = v.split(":");
|
|
3521
3521
|
arr.push({
|
|
3522
3522
|
label: v,
|
|
3523
|
-
prop: z[0].trim()
|
|
3523
|
+
prop: getObjValue(z[0].trim())
|
|
3524
3524
|
});
|
|
3525
3525
|
}
|
|
3526
3526
|
});
|
|
@@ -3562,11 +3562,16 @@ function getObjValue(d) {
|
|
|
3562
3562
|
return "" + d;
|
|
3563
3563
|
}
|
|
3564
3564
|
}
|
|
3565
|
-
function getDefaultValue(obj) {
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3565
|
+
function getDefaultValue(obj, is = true) {
|
|
3566
|
+
if (is) {
|
|
3567
|
+
const vo = getSpecType(obj);
|
|
3568
|
+
const v = getTypeValue(vo.dataType);
|
|
3569
|
+
const d = (obj.default || "").trim();
|
|
3570
|
+
return getObjValue(d || v);
|
|
3571
|
+
} else {
|
|
3572
|
+
const d = (obj.default || "").trim();
|
|
3573
|
+
return getObjValue(d);
|
|
3574
|
+
}
|
|
3570
3575
|
}
|
|
3571
3576
|
|
|
3572
3577
|
// packages/components/compo/index.ts
|
|
@@ -4035,8 +4040,7 @@ function setVue(propsname, param, url) {
|
|
|
4035
4040
|
let arr = name.split("/");
|
|
4036
4041
|
name = (arr[0] || "").trim();
|
|
4037
4042
|
if (name) {
|
|
4038
|
-
|
|
4039
|
-
propsObj[name] = dv;
|
|
4043
|
+
propsObj[name] = getDefaultValue(val);
|
|
4040
4044
|
if (arr && arr.length > 1) {
|
|
4041
4045
|
es.push({
|
|
4042
4046
|
name: "update:" + name,
|
package/dist/node/index.js
CHANGED
|
@@ -3505,7 +3505,7 @@ function getSpecType(val) {
|
|
|
3505
3505
|
let z = v.split(":");
|
|
3506
3506
|
arr.push({
|
|
3507
3507
|
label: v,
|
|
3508
|
-
prop: z[0].trim()
|
|
3508
|
+
prop: getObjValue(z[0].trim())
|
|
3509
3509
|
});
|
|
3510
3510
|
}
|
|
3511
3511
|
});
|
|
@@ -3547,11 +3547,16 @@ function getObjValue(d) {
|
|
|
3547
3547
|
return "" + d;
|
|
3548
3548
|
}
|
|
3549
3549
|
}
|
|
3550
|
-
function getDefaultValue(obj) {
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3550
|
+
function getDefaultValue(obj, is = true) {
|
|
3551
|
+
if (is) {
|
|
3552
|
+
const vo = getSpecType(obj);
|
|
3553
|
+
const v = getTypeValue(vo.dataType);
|
|
3554
|
+
const d = (obj.default || "").trim();
|
|
3555
|
+
return getObjValue(d || v);
|
|
3556
|
+
} else {
|
|
3557
|
+
const d = (obj.default || "").trim();
|
|
3558
|
+
return getObjValue(d);
|
|
3559
|
+
}
|
|
3555
3560
|
}
|
|
3556
3561
|
|
|
3557
3562
|
// packages/components/compo/index.ts
|
|
@@ -4020,8 +4025,7 @@ function setVue(propsname, param, url) {
|
|
|
4020
4025
|
let arr = name.split("/");
|
|
4021
4026
|
name = (arr[0] || "").trim();
|
|
4022
4027
|
if (name) {
|
|
4023
|
-
|
|
4024
|
-
propsObj[name] = dv;
|
|
4028
|
+
propsObj[name] = getDefaultValue(val);
|
|
4025
4029
|
if (arr && arr.length > 1) {
|
|
4026
4030
|
es.push({
|
|
4027
4031
|
name: "update:" + name,
|
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
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"),q=require("../../utils/props.cjs"),N=require("@fangzhongya/utils/basic/string/toFunction"),v=["class"];function V(e,n){return e.filter(t=>t.name==n)[0]}function w(e){return e.map(n=>(n.prop||"...arr")+":"+l.setDataType(n.dataType)).join(",")}function A(e,n,t,s,u,h){const p=[],r=[];let b=!0;const x=q.getPropsValue(n.propss||[]),z=q.getEmitsValue(n.emitss||[]),B=q.getExposeValue(n.exposes||[]),U=q.getSlotValue(n.slots||[]);Object.keys(t).forEach(o=>{let m=t[o];if(/^on[A-Z]/.test(o)&&typeof m=="function"){let i=o.substring(2);const c=o.split(":");let g;if(c.length>1?(g=c[0]+c.slice(1).map(f=>D.firstUpper(f)).join(""),i=J.firstLower(i)):(g=c[0],i=H.humpToLine(i)),c.includes("-")){let f=g.split("-");f=f.map(($,F)=>F!=0?D.firstUpper($):$),g=f.join("")}p.push(" @"+i+'="'+g+'"');const a=V(z,i)||{},y=a.selectable||"",S=l.parseParamString(y),d=w(S);r.push(`// ${a.description} ${a.name}: (${a.selectable})`),r.push("function "+g+"("+d+") {"),S.forEach(f=>{const $=f.name||"arr";r.push(" console.log('"+f.label+"', "+$+")")}),r.push("}")}else{let i=o;v.includes(o)&&(i=o+"1"),p.push(" :"+o+'="'+i+'"');const c=V(x,o)||{},g=E(c);if(r.push(`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`),typeof m=="function")r.push("const "+o+" = "+P(m,o,u));else if(b&&(b=!1,r.unshift("import { ref } from 'vue';")),typeof m>"u")if(g.type=="function"){const a=Z(c);r.push("const "+i+" = "+a+";")}else{const a=l.getTypeValue(g.dataType);r.push("const "+i+" = ref("+(a==="undefined"?"":a)+");")}else{let a=j(m,o,u);r.push("const "+i+" = 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(o=>{const m=V(B,o.name)||{};r.push(`// ${m.description} ${m.name}:(${m.selectable}) ${m.type}`);const i=o.name+"Value",c=l.parseParamString(m?.selectable||""),g=[],a=o.params||[];c.forEach((y,S)=>{const d=y.name;if(d){const f=d+o.name,$=a[S];if(r.push(`// ${y.label}`),typeof $=="function")r.push("const "+f+" = "+P($,d,o.text));else if(typeof $>"u")r.push("const "+f+" = "+l.getTypeValue(y.dataType)+";");else{let F=j($,d,o.text);r.push("const "+f+" = "+F+";")}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 C=M(s,U);return`<!--${e}-->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
4
|
<${e}${p.join(`
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
${r.join(`
|
|
12
12
|
`)}
|
|
13
13
|
<\/script>
|
|
14
|
-
`}function M(e={},
|
|
14
|
+
`}function M(e={},n){const t=[];return Object.keys(e).forEach(s=>{const u=V(n,s)||{},h=e[s];if(h){const p=` <!-- ${u.description} ${u.name}:(${u.selectable}) -->
|
|
15
15
|
<template #${s}="scope">
|
|
16
|
-
${
|
|
17
|
-
</template>`;
|
|
18
|
-
${
|
|
19
|
-
}`;return`function (${
|
|
20
|
-
${
|
|
21
|
-
}`;return`function (${
|
|
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||L(e.toString())}function L(e){const n=N.getFunctionFormat(l.prettierFormat(e));if(n){let t=`{
|
|
18
|
+
${l.vueFormat(l.getFunBody(n.body)," ")}
|
|
19
|
+
}`;return`function (${n.param}) ${t}`}else return"undefined"}function Z(e){const n=l.parseParamString(e.selectable),t=w(n);let s="";e.return&&(s="return ");let u=`{
|
|
20
|
+
${l.vueFormat(l.getFunBody(s)," ")}
|
|
21
|
+
}`;return`function (${t}) ${u}`}function G(e){const n=e.trim();return/^\(/.test(n)?L(n):JSON.stringify(e)}function j(e,n,t){const s=t?t[n]:"";return s?typeof s=="string"?T(s):s:typeof e=="string"?G(e+""):JSON.stringify(e)}function E(e){let n=I(e?.type),t="any";n.length==1&&(t=n[0].split("<")[0]);const s=t;let u=(e?.selectable||"").trim(),h=[];return u&&t!="boolean"&&(u.includes("|")?u.split("|").forEach(p=>{if(p){let r=p.split(":");h.push({label:p,prop:T(r[0].trim())})}}):h=l.parseParamString(u),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 T(e){try{return new Function(`{ return ${e} }`)()}catch{return""+e}}function K(e,n=!0){if(n){const t=E(e),s=l.getTypeValue(t.dataType),u=(e.default||"").trim();return T(u||s)}else{const t=(e.default||"").trim();return T(t)}}exports.getDefaultValue=K;exports.getHmtl=A;exports.getSpecType=E;exports.setValStringify=j;
|
|
@@ -6,93 +6,93 @@ import "@fangzhongya/utils/basic/string/appearNum";
|
|
|
6
6
|
import { firstLower as Z } 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 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 F, parseParamString as V, setDataType as q, vueFormat as T, 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
|
-
function S(t,
|
|
17
|
-
return t.filter((
|
|
16
|
+
function S(t, n) {
|
|
17
|
+
return t.filter((e) => e.name == n)[0];
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return t.map((
|
|
19
|
+
function L(t) {
|
|
20
|
+
return t.map((n) => (n.prop || "...arr") + ":" + q(n.dataType)).join(",");
|
|
21
21
|
}
|
|
22
|
-
function ht(t,
|
|
23
|
-
const p = [],
|
|
22
|
+
function ht(t, n, e, s, c, h) {
|
|
23
|
+
const p = [], r = [];
|
|
24
24
|
let y = !0;
|
|
25
|
-
const C = I(
|
|
26
|
-
Object.keys(
|
|
27
|
-
let a =
|
|
28
|
-
if (/^on[A-Z]/.test(
|
|
29
|
-
let i =
|
|
30
|
-
const
|
|
25
|
+
const C = I(n.propss || []), J = K(n.emitss || []), N = M(n.exposes || []), A = Q(n.slots || []);
|
|
26
|
+
Object.keys(e).forEach((o) => {
|
|
27
|
+
let a = e[o];
|
|
28
|
+
if (/^on[A-Z]/.test(o) && typeof a == "function") {
|
|
29
|
+
let i = o.substring(2);
|
|
30
|
+
const u = o.split(":");
|
|
31
31
|
let m;
|
|
32
|
-
if (
|
|
32
|
+
if (u.length > 1 ? (m = u[0] + u.slice(1).map((f) => D(f)).join(""), i = Z(i)) : (m = u[0], i = U(i)), u.includes("-")) {
|
|
33
33
|
let f = m.split("-");
|
|
34
|
-
f = f.map(($,
|
|
34
|
+
f = f.map(($, E) => E != 0 ? D($) : $), m = f.join("");
|
|
35
35
|
}
|
|
36
36
|
p.push(" @" + i + '="' + m + '"');
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const l = S(J, i) || {}, d = l.selectable || "", b = V(d), g = L(b);
|
|
38
|
+
r.push(`// ${l.description} ${l.name}: (${l.selectable})`), r.push("function " + m + "(" + g + ") {"), b.forEach((f) => {
|
|
39
39
|
const $ = f.name || "arr";
|
|
40
|
-
|
|
41
|
-
}),
|
|
40
|
+
r.push(" console.log('" + f.label + "', " + $ + ")");
|
|
41
|
+
}), r.push("}");
|
|
42
42
|
} else {
|
|
43
|
-
let i =
|
|
44
|
-
W.includes(
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
`// ${
|
|
43
|
+
let i = o;
|
|
44
|
+
W.includes(o) && (i = o + "1"), p.push(" :" + o + '="' + i + '"');
|
|
45
|
+
const u = S(C, o) || {}, m = B(u);
|
|
46
|
+
if (r.push(
|
|
47
|
+
`// ${u.description} ${u.name}: {${u.type}} (${u.selectable})`
|
|
48
48
|
), typeof a == "function")
|
|
49
|
-
|
|
50
|
-
"const " +
|
|
49
|
+
r.push(
|
|
50
|
+
"const " + o + " = " + w(a, o, c)
|
|
51
51
|
);
|
|
52
|
-
else if (y && (y = !1,
|
|
52
|
+
else if (y && (y = !1, r.unshift("import { ref } from 'vue';")), typeof a > "u")
|
|
53
53
|
if (m.type == "function") {
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const l = Y(u);
|
|
55
|
+
r.push("const " + i + " = " + l + ";");
|
|
56
56
|
} else {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
"const " + i + " = ref(" + (
|
|
57
|
+
const l = F(m.dataType);
|
|
58
|
+
r.push(
|
|
59
|
+
"const " + i + " = ref(" + (l === "undefined" ? "" : l) + ");"
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
let
|
|
64
|
-
|
|
63
|
+
let l = x(a, o, c);
|
|
64
|
+
r.push("const " + i + " = ref(" + l + ");");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const a = S(N,
|
|
71
|
-
|
|
68
|
+
const O = Object.values(h || {});
|
|
69
|
+
O.length > 0 && (y && (y = !1, r.unshift("import { ref } from 'vue';")), p.unshift(' ref="refDom"'), r.push("const refDom = ref()"), O.forEach((o) => {
|
|
70
|
+
const a = S(N, o.name) || {};
|
|
71
|
+
r.push(
|
|
72
72
|
`// ${a.description} ${a.name}:(${a.selectable}) ${a.type}`
|
|
73
73
|
);
|
|
74
|
-
const i =
|
|
75
|
-
|
|
74
|
+
const i = o.name + "Value", u = V(a?.selectable || ""), m = [], l = o.params || [];
|
|
75
|
+
u.forEach((d, b) => {
|
|
76
76
|
const g = d.name;
|
|
77
77
|
if (g) {
|
|
78
|
-
const f = g +
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
"const " + f + " = " +
|
|
78
|
+
const f = g + o.name, $ = l[b];
|
|
79
|
+
if (r.push(`// ${d.label}`), typeof $ == "function")
|
|
80
|
+
r.push(
|
|
81
|
+
"const " + f + " = " + w($, g, o.text)
|
|
82
82
|
);
|
|
83
83
|
else if (typeof $ > "u")
|
|
84
|
-
|
|
85
|
-
"const " + f + " = " +
|
|
84
|
+
r.push(
|
|
85
|
+
"const " + f + " = " + F(d.dataType) + ";"
|
|
86
86
|
);
|
|
87
87
|
else {
|
|
88
|
-
let
|
|
89
|
-
|
|
88
|
+
let E = x($, g, o.text);
|
|
89
|
+
r.push("const " + f + " = " + E + ";");
|
|
90
90
|
}
|
|
91
91
|
m.push(f);
|
|
92
92
|
}
|
|
93
|
-
}),
|
|
94
|
-
`const ${i} = refDom.value?.${
|
|
95
|
-
) :
|
|
93
|
+
}), o.type === "function" ? r.push(
|
|
94
|
+
`const ${i} = refDom.value?.${o.name}(${m.join(", ")})`
|
|
95
|
+
) : r.push(`const ${i} = refDom.value?.${o.name}`), r.push(`console.log('"${a.type}"', ${i})`);
|
|
96
96
|
})), p.length > 0 && p.unshift("");
|
|
97
97
|
const H = X(s, A);
|
|
98
98
|
return `<!--${t}-->
|
|
@@ -105,95 +105,100 @@ function ht(t, e, n, s, l, h) {
|
|
|
105
105
|
</div>
|
|
106
106
|
</template>
|
|
107
107
|
<script lang="ts" setup>
|
|
108
|
-
${
|
|
108
|
+
${r.join(`
|
|
109
109
|
`)}
|
|
110
110
|
<\/script>
|
|
111
111
|
`;
|
|
112
112
|
}
|
|
113
|
-
function X(t = {},
|
|
114
|
-
const
|
|
113
|
+
function X(t = {}, n) {
|
|
114
|
+
const e = [];
|
|
115
115
|
return Object.keys(t).forEach((s) => {
|
|
116
|
-
const
|
|
116
|
+
const c = S(n, s) || {}, h = t[s];
|
|
117
117
|
if (h) {
|
|
118
|
-
const p = ` <!-- ${
|
|
118
|
+
const p = ` <!-- ${c.description} ${c.name}:(${c.selectable}) -->
|
|
119
119
|
<template #${s}="scope">
|
|
120
|
-
${
|
|
120
|
+
${T(h, " ")}
|
|
121
121
|
</template>`;
|
|
122
|
-
|
|
122
|
+
e.push(p);
|
|
123
123
|
}
|
|
124
|
-
}),
|
|
124
|
+
}), e && e.length > 0 && e.unshift(""), e;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
const s =
|
|
128
|
-
return s ||
|
|
126
|
+
function w(t, n, e) {
|
|
127
|
+
const s = e ? e[n] : "";
|
|
128
|
+
return s || P(t.toString());
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
133
|
-
let
|
|
134
|
-
${
|
|
130
|
+
function P(t) {
|
|
131
|
+
const n = R(G(t));
|
|
132
|
+
if (n) {
|
|
133
|
+
let e = `{
|
|
134
|
+
${T(z(n.body), " ")}
|
|
135
135
|
}`;
|
|
136
|
-
return `function (${
|
|
136
|
+
return `function (${n.param}) ${e}`;
|
|
137
137
|
} else
|
|
138
138
|
return "undefined";
|
|
139
139
|
}
|
|
140
140
|
function Y(t) {
|
|
141
|
-
const
|
|
141
|
+
const n = V(t.selectable), e = L(n);
|
|
142
142
|
let s = "";
|
|
143
143
|
t.return && (s = "return ");
|
|
144
|
-
let
|
|
145
|
-
${
|
|
144
|
+
let c = `{
|
|
145
|
+
${T(z(s), " ")}
|
|
146
146
|
}`;
|
|
147
|
-
return `function (${
|
|
147
|
+
return `function (${e}) ${c}`;
|
|
148
148
|
}
|
|
149
149
|
function _(t) {
|
|
150
|
-
const
|
|
151
|
-
return /^\(/.test(
|
|
150
|
+
const n = t.trim();
|
|
151
|
+
return /^\(/.test(n) ? P(n) : JSON.stringify(t);
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
const s =
|
|
155
|
-
return s ? typeof s == "string" ?
|
|
153
|
+
function x(t, n, e) {
|
|
154
|
+
const s = e ? e[n] : "";
|
|
155
|
+
return s ? typeof s == "string" ? j(s) : s : typeof t == "string" ? _(t + "") : JSON.stringify(t);
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
let
|
|
159
|
-
|
|
160
|
-
const s =
|
|
161
|
-
let
|
|
162
|
-
return
|
|
157
|
+
function B(t) {
|
|
158
|
+
let n = v(t?.type), e = "any";
|
|
159
|
+
n.length == 1 && (e = n[0].split("<")[0]);
|
|
160
|
+
const s = e;
|
|
161
|
+
let c = (t?.selectable || "").trim(), h = [];
|
|
162
|
+
return c && e != "boolean" && (c.includes("|") ? c.split("|").forEach((p) => {
|
|
163
163
|
if (p) {
|
|
164
|
-
let
|
|
164
|
+
let r = p.split(":");
|
|
165
165
|
h.push({
|
|
166
166
|
label: p,
|
|
167
|
-
prop:
|
|
167
|
+
prop: j(r[0].trim())
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
}) : h =
|
|
170
|
+
}) : h = V(c), e == "function" ? e = "function" : e == "array" ? e = "choice" : h.length > 1 && (e = "select")), {
|
|
171
171
|
arr: h,
|
|
172
172
|
zdtype: s,
|
|
173
|
-
type:
|
|
174
|
-
dataType:
|
|
173
|
+
type: e,
|
|
174
|
+
dataType: n
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
function v(t) {
|
|
178
|
-
let
|
|
178
|
+
let n = [];
|
|
179
179
|
return (t || "").trim().toLowerCase().split(",").forEach((s) => {
|
|
180
|
-
s = s.trim(), s &&
|
|
181
|
-
}), [...new Set(
|
|
180
|
+
s = s.trim(), s && n.push(s);
|
|
181
|
+
}), [...new Set(n)].sort();
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function j(t) {
|
|
184
184
|
try {
|
|
185
185
|
return new Function(`{ return ${t} }`)();
|
|
186
186
|
} catch {
|
|
187
187
|
return "" + t;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
function $t(t) {
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
function $t(t, n = !0) {
|
|
191
|
+
if (n) {
|
|
192
|
+
const e = B(t), s = F(e.dataType), c = (t.default || "").trim();
|
|
193
|
+
return j(c || s);
|
|
194
|
+
} else {
|
|
195
|
+
const e = (t.default || "").trim();
|
|
196
|
+
return j(e);
|
|
197
|
+
}
|
|
193
198
|
}
|
|
194
199
|
export {
|
|
195
200
|
$t as getDefaultValue,
|
|
196
201
|
ht as getHmtl,
|
|
197
|
-
|
|
198
|
-
|
|
202
|
+
B as getSpecType,
|
|
203
|
+
x as setValStringify
|
|
199
204
|
};
|
|
@@ -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"),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||{},
|
|
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||{},f=l.getPropsValue(i.propss||[]),m=l.getEmitsValue(i.emitss||[]),V=l.getExposeValue(i.exposes||[]),h=l.getSlotValue(i.slots||[]),a={},q={};f.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,!1),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 h.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-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-props"},s.h(g,{name:r.name,list:f,onChange:(t,e)=>{u.propsValue=t,u.propsText=e}})),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:h,onChange:(t,e)=>{p.slotValue[t]=e}}))])},data(){return{propsValue:{},propsText:{},exposeText:{}}}});module.exports=j;
|
|
@@ -43,7 +43,7 @@ const me = _({
|
|
|
43
43
|
let e = t.name;
|
|
44
44
|
if (!e.includes(".")) {
|
|
45
45
|
let p = e.split("/");
|
|
46
|
-
e = (p[0] || "").trim(), e && (i[e] = r.propsValue[e] ?? D(t), p && p.length > 1 && c.push({
|
|
46
|
+
e = (p[0] || "").trim(), e && (i[e] = r.propsValue[e] ?? D(t, !1), p && p.length > 1 && c.push({
|
|
47
47
|
name: "update:" + e,
|
|
48
48
|
description: t.description,
|
|
49
49
|
selectable: "value:[" + t.type + "]"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("vue"),
|
|
1
|
+
"use strict";const s=require("vue"),q=require("./retrie/index.vue.cjs");;/* empty css */const o=require("./code.cjs"),T={key:0,class:"set-props"},k=s.defineComponent({__name:"set-props",props:{name:String,list:Array},emits:["change"],setup(i,{emit:p}){const l=i,f=p,c=s.ref({}),m=s.ref(0),a=s.ref({}),n=s.ref([]);function d(){a.value={};const r=[];l.list?.forEach(t=>{let e=t.name;if(!e.includes(".")&&(e=(e.split("/")[0]||"").trim(),e)){a.value[e]=o.getDefaultValue(t,!1);const{arr:g,type:v,dataType:b}=o.getSpecType(t);c.value[e]=g;let V={label:_(e,t),prop:e,type:v,dataType:b,select:e};r.push(V)}}),n.value=r}function _(r,t){let e=r+": { "+(t.type||"any")+" } "+t.description;return t.default&&(e+=" 默认值="+t.default),t.selectable&&(e+=" 可选值="+t.selectable),e}function h(r,t){let e=Object.assign({},r);f("change",e,t)}let u;function y(){clearTimeout(u),u=setTimeout(()=>{d()},400)}return s.watch(()=>l.name,()=>{n.value=[],y()},{immediate:!0}),(r,t)=>n.value&&n.value.length>0?(s.openBlock(),s.createElementBlock("div",T,[s.createVNode(q,{refresh:m.value,modelValue:a.value,selects:c.value,list:n.value,name:l.name,onQuery:h},null,8,["refresh","modelValue","selects","list","name"])])):s.createCommentVNode("",!0)}});module.exports=k;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as v, ref as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as v, ref as a, watch as T, createElementBlock as k, createCommentVNode as j, openBlock as x, createVNode as B } from "vue";
|
|
2
|
+
import C from "./retrie/index.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { getDefaultValue as
|
|
5
|
-
const
|
|
4
|
+
import { getDefaultValue as E, getSpecType as N } from "./code.js";
|
|
5
|
+
const S = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "set-props"
|
|
8
|
-
},
|
|
8
|
+
}, Q = /* @__PURE__ */ v({
|
|
9
9
|
__name: "set-props",
|
|
10
10
|
props: {
|
|
11
11
|
name: String,
|
|
@@ -13,15 +13,15 @@ const w = {
|
|
|
13
13
|
},
|
|
14
14
|
emits: ["change"],
|
|
15
15
|
setup(i, { emit: u }) {
|
|
16
|
-
const
|
|
16
|
+
const n = i, m = u, r = a({}), p = a(0), o = a({}), l = a([]);
|
|
17
17
|
function f() {
|
|
18
18
|
o.value = {};
|
|
19
19
|
const s = [];
|
|
20
|
-
|
|
20
|
+
n.list?.forEach((t) => {
|
|
21
21
|
let e = t.name;
|
|
22
22
|
if (!e.includes(".") && (e = (e.split("/")[0] || "").trim(), e)) {
|
|
23
|
-
o.value[e] =
|
|
24
|
-
const { arr: y, type: b, dataType: g } =
|
|
23
|
+
o.value[e] = E(t, !1);
|
|
24
|
+
const { arr: y, type: b, dataType: g } = N(t);
|
|
25
25
|
r.value[e] = y;
|
|
26
26
|
let V = {
|
|
27
27
|
label: d(e, t),
|
|
@@ -49,27 +49,25 @@ const w = {
|
|
|
49
49
|
}, 400);
|
|
50
50
|
}
|
|
51
51
|
return T(
|
|
52
|
-
() =>
|
|
52
|
+
() => n.name,
|
|
53
53
|
() => {
|
|
54
|
-
l.value = [],
|
|
55
|
-
_();
|
|
56
|
-
});
|
|
54
|
+
l.value = [], _();
|
|
57
55
|
},
|
|
58
56
|
{
|
|
59
57
|
immediate: !0
|
|
60
58
|
}
|
|
61
|
-
), (s, t) => l.value && l.value.length > 0 ? (
|
|
62
|
-
C
|
|
59
|
+
), (s, t) => l.value && l.value.length > 0 ? (x(), k("div", S, [
|
|
60
|
+
B(C, {
|
|
63
61
|
refresh: p.value,
|
|
64
62
|
modelValue: o.value,
|
|
65
63
|
selects: r.value,
|
|
66
64
|
list: l.value,
|
|
67
|
-
name:
|
|
65
|
+
name: n.name,
|
|
68
66
|
onQuery: h
|
|
69
67
|
}, null, 8, ["refresh", "modelValue", "selects", "list", "name"])
|
|
70
68
|
])) : j("", !0);
|
|
71
69
|
}
|
|
72
70
|
});
|
|
73
71
|
export {
|
|
74
|
-
|
|
72
|
+
Q as default
|
|
75
73
|
};
|