@fangzhongya/vue-archive 0.0.44 → 0.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/index.cjs +61 -16
- package/dist/node/index.js +61 -16
- package/dist/packages/components/compo/index.cjs +1 -1
- package/dist/packages/components/compo/index.js +98 -85
- package/dist/packages/components/use/code.cjs +9 -9
- package/dist/packages/components/use/code.d.ts +1 -1
- package/dist/packages/components/use/code.js +117 -104
- package/dist/packages/components/use/index.cjs +1 -1
- package/dist/packages/components/use/index.js +1 -1
- package/dist/packages/components/use/retrie/array/index.vue.cjs +2 -2
- package/dist/packages/components/use/retrie/array/index.vue.js +16 -16
- package/dist/packages/components/use/retrie/object/index.vue.cjs +2 -2
- package/dist/packages/components/use/retrie/object/index.vue.js +17 -17
- package/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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const H=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const J=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const H=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const J=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const D=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const l=require("./util.cjs"),T=require("../../utils/props.cjs"),N=require("@fangzhongya/utils/basic/string/toFunction"),A=["class"];function q(e,n){return e.filter(t=>t.name==n)[0]}function L(e){return e.map(n=>(n.prop||"...arr")+":"+l.setDataType(n.dataType)).join(",")}function M(e,n,t,s,o,h){const p=[],r=[];let b=!0;const x=T.getPropsValue(n.propss||[]),z=T.getEmitsValue(n.emitss||[]),B=T.getExposeValue(n.exposes||[]),C=T.getSlotValue(n.slots||[]);Object.keys(t).forEach(i=>{let m=t[i];if(/^on[A-Z]/.test(i)&&typeof m=="function"){let u=i.substring(2);const c=i.split(":");let g;if(c.length>1?(g=c[0]+c.slice(1).map(f=>D.firstUpper(f)).join(""),u=J.firstLower(u)):(g=c[0],u=H.humpToLine(u)),c.includes("-")){let f=g.split("-");f=f.map(($,F)=>F!=0?D.firstUpper($):$),g=f.join("")}p.push(" @"+u+'="'+g+'"');const a=q(z,u)||{},d=a.selectable||"",S=l.parseParamString(d),y=L(S);r.push(`// ${a.description} ${a.name}: (${a.selectable})`),r.push("function "+g+"("+y+") {"),S.forEach(f=>{const $=f.name||"arr";r.push(" console.log('"+f.label+"', "+$+")")}),r.push("}")}else{let u=i;A.includes(i)&&(u=i+"1"),p.push(" :"+i+'="'+u+'"');const c=q(x,i)||{},g=w(c);if(r.push(`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`),typeof m=="function")r.push("const "+i+" = "+P(m,i,o));else if(b&&(b=!1,r.unshift("import { ref } from 'vue';")),typeof m>"u")if(g.type=="function"){const a=v(c);r.push("const "+u+" = "+a+";")}else{const a=l.getTypeValue(g.dataType);r.push("const "+u+" = ref("+(a==="undefined"?"":a)+");")}else{let a=E(m,i,o);r.push("const "+u+" = ref("+a+");")}}});const O=Object.values(h||{});O.length>0&&(b&&(b=!1,r.unshift("import { ref } from 'vue';")),p.unshift(' ref="refDom"'),r.push("const refDom = ref()"),O.forEach(i=>{const m=q(B,i.name)||{};r.push(`// ${m.description} ${m.name}:(${m.selectable}) ${m.type}`);const u=i.name+"Value",c=l.parseParamString(m?.selectable||""),g=[],a=i.params||[];c.forEach((d,S)=>{const y=d.name;if(y){const f=y+i.name,$=a[S];if(r.push(`// ${d.label}`),typeof $=="function")r.push("const "+f+" = "+P($,y,i.text));else if(typeof $>"u")r.push("const "+f+" = "+l.getTypeValue(d.dataType)+";");else{let F=E($,y,i.text);r.push("const "+f+" = "+F+";")}g.push(f)}}),i.type==="function"?r.push(`const ${u} = refDom.value?.${i.name}(${g.join(", ")})`):r.push(`const ${u} = refDom.value?.${i.name}`),r.push(`console.log('"${m.type}"', ${u})`)})),p.length>0&&p.unshift("");const U=Z(s,C);return`<!--${e}-->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
4
|
<${e}${p.join(`
|
|
5
|
-
`)}>${
|
|
5
|
+
`)}>${U.join(`
|
|
6
6
|
`)}
|
|
7
7
|
</${e}>
|
|
8
8
|
</div>
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
${r.join(`
|
|
12
12
|
`)}
|
|
13
13
|
<\/script>
|
|
14
|
-
`}function
|
|
14
|
+
`}function Z(e={},n){const t=[];return Object.keys(e).forEach(s=>{const o=q(n,s)||{},h=e[s];if(h){const p=` <!-- ${o.description} ${o.name}:(${o.selectable}) -->
|
|
15
15
|
<template #${s}="scope">
|
|
16
|
-
${
|
|
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&&(s.includes("=>")||s.includes("function"))?s:j(e.toString())}function j(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 v(e){const n=l.parseParamString(e.selectable),t=L(n);let s="";e.return&&(s="return ");let o=`{
|
|
20
|
+
${l.vueFormat(l.getFunBody(s)," ")}
|
|
21
|
+
}`;return`function (${t}) ${o}`}function G(e){const n=e.trim();return/^\(/.test(n)?j(n):JSON.stringify(e)}function E(e,n,t){const s=t?t[n]:"";return s?typeof s=="string"?V(s):s:typeof e=="string"?G(e+""):JSON.stringify(e)}function w(e){let n=I(e?.type),t="any";n.length==1&&(t=n[0].split("<")[0]);const s=t;let o=(e?.selectable||"").trim(),h=[];return o&&t!="boolean"&&(o.includes("|")?o.split("|").forEach(p=>{if(p){let r=p.split(":");h.push({label:p,prop:V(r[0].trim())})}}):h=l.parseParamString(o),t=="function"?t="function":t=="array"?t="choice":h.length>1&&(t="select")),{arr:h,zdtype:s,type:t,dataType:n}}function I(e){let n=[];return(e||"").trim().toLowerCase().split(",").forEach(s=>{s=s.trim(),s&&n.push(s)}),[...new Set(n)].sort()}function V(e,n){try{if(n?.toLowerCase()=="function")if(typeof e=="string"){if(/^\((.|\n|\r)*\)$/.test(e))return e=e.substring(1,e.length-1),new Function(`{ return ${e} }`)()}else return e;else return new Function(`{ return ${e} }`)()}catch{return""+e}}function K(e,n=!0){const t=w(e),s=l.getTypeValue(t.dataType);if(n){const o=(e.default||"").trim();return V(o||s,t.dataType[0])}else{const o=(e.default||"").trim();return V(o,t.dataType[0])}}exports.getDefaultValue=K;exports.getHmtl=M;exports.getSpecType=w;exports.setValStringify=E;
|
|
@@ -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 E, parseParamString as
|
|
12
|
+
import { getTypeValue as E, parseParamString as T, setDataType as q, vueFormat as w, prettierFormat as G, getFunBody as z } from "./util.js";
|
|
13
13
|
import { getPropsValue as I, getEmitsValue as K, getExposeValue as M, getSlotValue as Q } from "../../utils/props.js";
|
|
14
14
|
import { getFunctionFormat as R } from "@fangzhongya/utils/basic/string/toFunction";
|
|
15
15
|
const W = ["class"];
|
|
16
|
-
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 C(t) {
|
|
20
|
+
return t.map((n) => (n.prop || "...arr") + ":" + q(n.dataType)).join(",");
|
|
21
21
|
}
|
|
22
|
-
function ht(t,
|
|
23
|
-
const p = [],
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
Object.keys(
|
|
27
|
-
let a =
|
|
28
|
-
if (/^on[A-Z]/.test(
|
|
29
|
-
let
|
|
30
|
-
const
|
|
22
|
+
function ht(t, n, e, s, i, h) {
|
|
23
|
+
const p = [], r = [];
|
|
24
|
+
let d = !0;
|
|
25
|
+
const B = 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 c = 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(""), c = Z(c)) : (m = u[0], c = U(c)), u.includes("-")) {
|
|
33
33
|
let f = m.split("-");
|
|
34
|
-
f = f.map((
|
|
34
|
+
f = f.map((g, j) => j != 0 ? D(g) : g), m = f.join("");
|
|
35
35
|
}
|
|
36
|
-
p.push(" @" +
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
}),
|
|
36
|
+
p.push(" @" + c + '="' + m + '"');
|
|
37
|
+
const l = S(J, c) || {}, y = l.selectable || "", b = T(y), $ = C(b);
|
|
38
|
+
r.push(`// ${l.description} ${l.name}: (${l.selectable})`), r.push("function " + m + "(" + $ + ") {"), b.forEach((f) => {
|
|
39
|
+
const g = f.name || "arr";
|
|
40
|
+
r.push(" console.log('" + f.label + "', " + g + ")");
|
|
41
|
+
}), r.push("}");
|
|
42
42
|
} else {
|
|
43
|
-
let
|
|
44
|
-
W.includes(
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
`// ${
|
|
43
|
+
let c = o;
|
|
44
|
+
W.includes(o) && (c = o + "1"), p.push(" :" + o + '="' + c + '"');
|
|
45
|
+
const u = S(B, o) || {}, m = P(u);
|
|
46
|
+
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 + " = " + x(a, o, i)
|
|
51
51
|
);
|
|
52
|
-
else if (
|
|
52
|
+
else if (d && (d = !1, r.unshift("import { ref } from 'vue';")), typeof a > "u")
|
|
53
53
|
if (m.type == "function") {
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const l = Y(u);
|
|
55
|
+
r.push("const " + c + " = " + l + ";");
|
|
56
56
|
} else {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
"const " +
|
|
57
|
+
const l = E(m.dataType);
|
|
58
|
+
r.push(
|
|
59
|
+
"const " + c + " = ref(" + (l === "undefined" ? "" : l) + ");"
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
let
|
|
64
|
-
|
|
63
|
+
let l = L(a, o, i);
|
|
64
|
+
r.push("const " + c + " = 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 && (d && (d = !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
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
const f =
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
"const " + f + " = " +
|
|
74
|
+
const c = o.name + "Value", u = T(a?.selectable || ""), m = [], l = o.params || [];
|
|
75
|
+
u.forEach((y, b) => {
|
|
76
|
+
const $ = y.name;
|
|
77
|
+
if ($) {
|
|
78
|
+
const f = $ + o.name, g = l[b];
|
|
79
|
+
if (r.push(`// ${y.label}`), typeof g == "function")
|
|
80
|
+
r.push(
|
|
81
|
+
"const " + f + " = " + x(g, $, o.text)
|
|
82
82
|
);
|
|
83
|
-
else if (typeof
|
|
84
|
-
|
|
85
|
-
"const " + f + " = " + E(
|
|
83
|
+
else if (typeof g > "u")
|
|
84
|
+
r.push(
|
|
85
|
+
"const " + f + " = " + E(y.dataType) + ";"
|
|
86
86
|
);
|
|
87
87
|
else {
|
|
88
|
-
let
|
|
89
|
-
|
|
88
|
+
let j = L(g, $, o.text);
|
|
89
|
+
r.push("const " + f + " = " + j + ";");
|
|
90
90
|
}
|
|
91
91
|
m.push(f);
|
|
92
92
|
}
|
|
93
|
-
}),
|
|
94
|
-
`const ${
|
|
95
|
-
) :
|
|
93
|
+
}), o.type === "function" ? r.push(
|
|
94
|
+
`const ${c} = refDom.value?.${o.name}(${m.join(", ")})`
|
|
95
|
+
) : r.push(`const ${c} = refDom.value?.${o.name}`), r.push(`console.log('"${a.type}"', ${c})`);
|
|
96
96
|
})), p.length > 0 && p.unshift("");
|
|
97
97
|
const H = X(s, A);
|
|
98
98
|
return `<!--${t}-->
|
|
@@ -105,95 +105,108 @@ 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 i = S(n, s) || {}, h = t[s];
|
|
117
117
|
if (h) {
|
|
118
|
-
const p = ` <!-- ${
|
|
118
|
+
const p = ` <!-- ${i.description} ${i.name}:(${i.selectable}) -->
|
|
119
119
|
<template #${s}="scope">
|
|
120
|
-
${
|
|
120
|
+
${w(h, " ")}
|
|
121
121
|
</template>`;
|
|
122
|
-
|
|
122
|
+
e.push(p);
|
|
123
123
|
}
|
|
124
|
-
}),
|
|
124
|
+
}), e && e.length > 0 && e.unshift(""), e;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
const s =
|
|
128
|
-
return s ||
|
|
126
|
+
function x(t, n, e) {
|
|
127
|
+
const s = e ? e[n] : "";
|
|
128
|
+
return s && (s.includes("=>") || s.includes("function")) ? s : F(t.toString());
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
133
|
-
let
|
|
134
|
-
${
|
|
130
|
+
function F(t) {
|
|
131
|
+
const n = R(G(t));
|
|
132
|
+
if (n) {
|
|
133
|
+
let e = `{
|
|
134
|
+
${w(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 = T(t.selectable), e = C(n);
|
|
142
142
|
let s = "";
|
|
143
143
|
t.return && (s = "return ");
|
|
144
|
-
let
|
|
145
|
-
${
|
|
144
|
+
let i = `{
|
|
145
|
+
${w(z(s), " ")}
|
|
146
146
|
}`;
|
|
147
|
-
return `function (${
|
|
147
|
+
return `function (${e}) ${i}`;
|
|
148
148
|
}
|
|
149
149
|
function _(t) {
|
|
150
|
-
const
|
|
151
|
-
return /^\(/.test(
|
|
150
|
+
const n = t.trim();
|
|
151
|
+
return /^\(/.test(n) ? F(n) : JSON.stringify(t);
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
const s =
|
|
155
|
-
return s ? typeof s == "string" ?
|
|
153
|
+
function L(t, n, e) {
|
|
154
|
+
const s = e ? e[n] : "";
|
|
155
|
+
return s ? typeof s == "string" ? V(s) : s : typeof t == "string" ? _(t + "") : JSON.stringify(t);
|
|
156
156
|
}
|
|
157
157
|
function P(t) {
|
|
158
|
-
let
|
|
159
|
-
|
|
160
|
-
const s =
|
|
161
|
-
let
|
|
162
|
-
return
|
|
158
|
+
let n = v(t?.type), e = "any";
|
|
159
|
+
n.length == 1 && (e = n[0].split("<")[0]);
|
|
160
|
+
const s = e;
|
|
161
|
+
let i = (t?.selectable || "").trim(), h = [];
|
|
162
|
+
return i && e != "boolean" && (i.includes("|") ? i.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: V(r[0].trim())
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
}) : h =
|
|
170
|
+
}) : h = T(i), e == "function" ? e = "function" : e == "array" ? e = "choice" : h.length > 1 && (e = "select")), {
|
|
171
171
|
arr: h,
|
|
172
172
|
zdtype: s,
|
|
173
|
-
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 V(t, n) {
|
|
184
184
|
try {
|
|
185
|
-
|
|
185
|
+
if (n?.toLowerCase() == "function")
|
|
186
|
+
if (typeof t == "string") {
|
|
187
|
+
if (/^\((.|\n|\r)*\)$/.test(t))
|
|
188
|
+
return t = t.substring(1, t.length - 1), new Function(`{ return ${t} }`)();
|
|
189
|
+
} else
|
|
190
|
+
return t;
|
|
191
|
+
else
|
|
192
|
+
return new Function(`{ return ${t} }`)();
|
|
186
193
|
} catch {
|
|
187
194
|
return "" + t;
|
|
188
195
|
}
|
|
189
196
|
}
|
|
190
|
-
function
|
|
191
|
-
const e = P(t),
|
|
192
|
-
|
|
197
|
+
function gt(t, n = !0) {
|
|
198
|
+
const e = P(t), s = E(e.dataType);
|
|
199
|
+
if (n) {
|
|
200
|
+
const i = (t.default || "").trim();
|
|
201
|
+
return V(i || s, e.dataType[0]);
|
|
202
|
+
} else {
|
|
203
|
+
const i = (t.default || "").trim();
|
|
204
|
+
return V(i, e.dataType[0]);
|
|
205
|
+
}
|
|
193
206
|
}
|
|
194
207
|
export {
|
|
195
|
-
|
|
208
|
+
gt as getDefaultValue,
|
|
196
209
|
ht as getHmtl,
|
|
197
210
|
P as getSpecType,
|
|
198
|
-
|
|
211
|
+
L as setValStringify
|
|
199
212
|
};
|
|
@@ -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,3 +1,3 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("vue"),m=require("../input/index.vue.cjs");;/* empty css */const f=require("../../util.cjs"),d={class:"form-array"},p=n.defineComponent({__name:"index",props:{modelValue:{type:null}},emits:["value","error"],setup(i,{emit:c}){const u=i,o=c,l=n.ref("");n.watch(()=>u.modelValue,()=>{let e=u.modelValue;l.value=a(e)||e},{immediate:!0});function s(e){return new Function("",`{return ${e}}`)}function a(e){let r;if(e)try{let t=e;typeof e=="string"?(t=s(e)(),r=f.prettierArrFormat(e)):r=JSON.stringify(e),t instanceof Array?(o("value",t,r),o("error",!1)):(o("error",!0),console.log("error","类型不匹配"))}catch(t){o("error",!0),console.log("error",t)}else r=`[
|
|
2
2
|
|
|
3
|
-
]`,
|
|
3
|
+
]`,o("value",void 0,r),o("error",!1);return r}return(e,r)=>(n.openBlock(),n.createElementBlock("div",d,[n.createVNode(m,{modelValue:l.value,"onUpdate:modelValue":r[0]||(r[0]=t=>l.value=t),check:a},null,8,["modelValue"])]))}});module.exports=p;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as c, ref as f, watch as s, createElementBlock as p, openBlock as d, createVNode as v } from "vue";
|
|
2
|
+
import _ from "../input/index.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { prettierArrFormat as
|
|
5
|
-
const
|
|
4
|
+
import { prettierArrFormat as V } from "../../util.js";
|
|
5
|
+
const g = { class: "form-array" }, A = /* @__PURE__ */ c({
|
|
6
6
|
__name: "index",
|
|
7
7
|
props: {
|
|
8
8
|
modelValue: {
|
|
@@ -10,9 +10,9 @@ const h = { class: "form-array" }, A = /* @__PURE__ */ s({
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
emits: ["value", "error"],
|
|
13
|
-
setup(
|
|
14
|
-
const n =
|
|
15
|
-
|
|
13
|
+
setup(u, { emit: i }) {
|
|
14
|
+
const n = u, t = i, l = f("");
|
|
15
|
+
s(
|
|
16
16
|
() => n.modelValue,
|
|
17
17
|
() => {
|
|
18
18
|
let e = n.modelValue;
|
|
@@ -22,28 +22,28 @@ const h = { class: "form-array" }, A = /* @__PURE__ */ s({
|
|
|
22
22
|
immediate: !0
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
|
-
function
|
|
25
|
+
function m(e) {
|
|
26
26
|
return new Function("", `{return ${e}}`);
|
|
27
27
|
}
|
|
28
28
|
function a(e) {
|
|
29
29
|
let r;
|
|
30
30
|
if (e)
|
|
31
31
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} catch (
|
|
35
|
-
|
|
32
|
+
let o = e;
|
|
33
|
+
typeof e == "string" ? (o = m(e)(), r = V(e)) : r = JSON.stringify(e), o instanceof Array ? (t("value", o, r), t("error", !1)) : (t("error", !0), console.log("error", "类型不匹配"));
|
|
34
|
+
} catch (o) {
|
|
35
|
+
t("error", !0), console.log("error", o);
|
|
36
36
|
}
|
|
37
37
|
else
|
|
38
38
|
r = `[
|
|
39
39
|
|
|
40
|
-
]`,
|
|
40
|
+
]`, t("value", void 0, r), t("error", !1);
|
|
41
41
|
return r;
|
|
42
42
|
}
|
|
43
|
-
return (e, r) => (
|
|
44
|
-
_
|
|
43
|
+
return (e, r) => (d(), p("div", g, [
|
|
44
|
+
v(_, {
|
|
45
45
|
modelValue: l.value,
|
|
46
|
-
"onUpdate:modelValue": r[0] || (r[0] = (
|
|
46
|
+
"onUpdate:modelValue": r[0] || (r[0] = (o) => l.value = o),
|
|
47
47
|
check: a
|
|
48
48
|
}, null, 8, ["modelValue"])
|
|
49
49
|
]));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const l=require("vue"),m=require("../input/index.vue.cjs");;/* empty css */const f=require("../../util.cjs"),p={class:"form-object"},d=l.defineComponent({__name:"index",props:{modelValue:{type:null}},emits:["value","error"],setup(c,{emit:a}){const u=c,o=a,n=l.ref("");l.watch(()=>u.modelValue,()=>{let e=u.modelValue;n.value=i(e)||e},{immediate:!0});function s(e){return new Function("",`{ return ${e} }`)}function i(e){let r;if(e)try{let t=e;typeof e=="string"?(t=s(e)(),r=f.prettierObjFormat(e)):r=JSON.stringify(e),typeof t=="object"?(o("value",t,r),o("error",!1)):(o("error",!0),console.log("error","类型不匹配"))}catch(t){o("error",!0),console.log("error",t)}else r=`{
|
|
2
2
|
|
|
3
|
-
}`,
|
|
3
|
+
}`,o("value",void 0,r),o("error",!1);return r}return(e,r)=>(l.openBlock(),l.createElementBlock("div",p,[l.createVNode(m,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=t=>n.value=t),check:i},null,8,["modelValue"])]))}});module.exports=d;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as c, ref as f, watch as s, createElementBlock as p, openBlock as d, createVNode as v } from "vue";
|
|
2
|
+
import _ from "../input/index.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { prettierObjFormat as
|
|
5
|
-
const
|
|
4
|
+
import { prettierObjFormat as V } from "../../util.js";
|
|
5
|
+
const g = { class: "form-object" }, x = /* @__PURE__ */ c({
|
|
6
6
|
__name: "index",
|
|
7
7
|
props: {
|
|
8
8
|
modelValue: {
|
|
@@ -10,9 +10,9 @@ const h = { class: "form-object" }, y = /* @__PURE__ */ s({
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
emits: ["value", "error"],
|
|
13
|
-
setup(
|
|
14
|
-
const n =
|
|
15
|
-
|
|
13
|
+
setup(a, { emit: i }) {
|
|
14
|
+
const n = a, t = i, l = f("");
|
|
15
|
+
s(
|
|
16
16
|
() => n.modelValue,
|
|
17
17
|
() => {
|
|
18
18
|
let e = n.modelValue;
|
|
@@ -22,33 +22,33 @@ const h = { class: "form-object" }, y = /* @__PURE__ */ s({
|
|
|
22
22
|
immediate: !0
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
|
-
function
|
|
25
|
+
function m(e) {
|
|
26
26
|
return new Function("", `{ return ${e} }`);
|
|
27
27
|
}
|
|
28
28
|
function u(e) {
|
|
29
29
|
let r;
|
|
30
30
|
if (e)
|
|
31
31
|
try {
|
|
32
|
-
|
|
33
|
-
typeof
|
|
34
|
-
} catch (
|
|
35
|
-
|
|
32
|
+
let o = e;
|
|
33
|
+
typeof e == "string" ? (o = m(e)(), r = V(e)) : r = JSON.stringify(e), typeof o == "object" ? (t("value", o, r), t("error", !1)) : (t("error", !0), console.log("error", "类型不匹配"));
|
|
34
|
+
} catch (o) {
|
|
35
|
+
t("error", !0), console.log("error", o);
|
|
36
36
|
}
|
|
37
37
|
else
|
|
38
38
|
r = `{
|
|
39
39
|
|
|
40
|
-
}`,
|
|
40
|
+
}`, t("value", void 0, r), t("error", !1);
|
|
41
41
|
return r;
|
|
42
42
|
}
|
|
43
|
-
return (e, r) => (
|
|
44
|
-
_
|
|
43
|
+
return (e, r) => (d(), p("div", g, [
|
|
44
|
+
v(_, {
|
|
45
45
|
modelValue: l.value,
|
|
46
|
-
"onUpdate:modelValue": r[0] || (r[0] = (
|
|
46
|
+
"onUpdate:modelValue": r[0] || (r[0] = (o) => l.value = o),
|
|
47
47
|
check: u
|
|
48
48
|
}, null, 8, ["modelValue"])
|
|
49
49
|
]));
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
x as default
|
|
54
54
|
};
|
|
@@ -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;
|