@fangzhongya/vue-archive 0.0.19 → 0.0.20
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 +10 -8
- package/dist/node/index.js +10 -8
- package/dist/packages/components/compo/index.vue.cjs +1 -1
- package/dist/packages/components/compo/index.vue.js +42 -50
- package/dist/packages/components/use/code.cjs +8 -8
- package/dist/packages/components/use/code.js +57 -56
- package/dist/packages/components/use/index.cjs +1 -1
- package/dist/packages/components/use/index.js +25 -25
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -3155,15 +3155,16 @@ function getSpecObjs(specs, name) {
|
|
|
3155
3155
|
}
|
|
3156
3156
|
function getParameStr(css) {
|
|
3157
3157
|
return css.map((o) => {
|
|
3158
|
-
|
|
3158
|
+
const name = o.prop || "...arr";
|
|
3159
|
+
return name + ":" + setDataType(o.dataType);
|
|
3159
3160
|
}).join(",");
|
|
3160
3161
|
}
|
|
3161
3162
|
function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
3162
3163
|
const tarr = [];
|
|
3163
3164
|
const sarr = [];
|
|
3164
3165
|
let is = true;
|
|
3165
|
-
const es = getEmitsValue(param.
|
|
3166
|
-
const res = getExposeValue(param.
|
|
3166
|
+
const es = getEmitsValue(param.emitss || []);
|
|
3167
|
+
const res = getExposeValue(param.exposes || []);
|
|
3167
3168
|
Object.keys(value).forEach((key) => {
|
|
3168
3169
|
let val = value[key];
|
|
3169
3170
|
if (/^on[A-Z]/.test(key) && typeof val == "function") {
|
|
@@ -3189,13 +3190,14 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
|
3189
3190
|
strs = arr.join("");
|
|
3190
3191
|
}
|
|
3191
3192
|
tarr.push(" @" + name + '="' + strs + '"');
|
|
3192
|
-
const s = getSpecObjs(es, name)
|
|
3193
|
+
const s = getSpecObjs(es, name)?.selectable || "";
|
|
3193
3194
|
const css = getParametersObj(s);
|
|
3194
3195
|
const cs = getParameStr(css);
|
|
3195
3196
|
sarr.push("function " + strs + "(" + cs + ") {");
|
|
3196
3197
|
css.forEach((o) => {
|
|
3198
|
+
const name2 = o.prop || "arr";
|
|
3197
3199
|
sarr.push(
|
|
3198
|
-
" console.log('" + o.description +
|
|
3200
|
+
" console.log('" + o.description + name2 + "', " + name2 + ")"
|
|
3199
3201
|
);
|
|
3200
3202
|
});
|
|
3201
3203
|
sarr.push("}");
|
|
@@ -3235,7 +3237,7 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
|
3235
3237
|
sarr.push(`-------${v.name}--------`);
|
|
3236
3238
|
const s = getSpecObjs(res, v.name);
|
|
3237
3239
|
const m = v.name + "Value";
|
|
3238
|
-
const css = getParametersObj(s
|
|
3240
|
+
const css = getParametersObj(s?.selectable || "");
|
|
3239
3241
|
const cs = [];
|
|
3240
3242
|
v.params?.forEach((val, index) => {
|
|
3241
3243
|
const prop = css[index].prop;
|
|
@@ -3873,8 +3875,8 @@ function getDefaultValue(obj) {
|
|
|
3873
3875
|
}
|
|
3874
3876
|
}
|
|
3875
3877
|
function setVue(propsname, param, url) {
|
|
3876
|
-
const ps = getPropsValue2(param.propss);
|
|
3877
|
-
const es = getEmitsValue(param.emitss);
|
|
3878
|
+
const ps = getPropsValue2(param.propss || []);
|
|
3879
|
+
const es = getEmitsValue(param.emitss || []);
|
|
3878
3880
|
const propsObj = {};
|
|
3879
3881
|
ps.forEach((val) => {
|
|
3880
3882
|
let name = val.name;
|
package/dist/node/index.js
CHANGED
|
@@ -3140,15 +3140,16 @@ function getSpecObjs(specs, name) {
|
|
|
3140
3140
|
}
|
|
3141
3141
|
function getParameStr(css) {
|
|
3142
3142
|
return css.map((o) => {
|
|
3143
|
-
|
|
3143
|
+
const name = o.prop || "...arr";
|
|
3144
|
+
return name + ":" + setDataType(o.dataType);
|
|
3144
3145
|
}).join(",");
|
|
3145
3146
|
}
|
|
3146
3147
|
function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
3147
3148
|
const tarr = [];
|
|
3148
3149
|
const sarr = [];
|
|
3149
3150
|
let is = true;
|
|
3150
|
-
const es = getEmitsValue(param.
|
|
3151
|
-
const res = getExposeValue(param.
|
|
3151
|
+
const es = getEmitsValue(param.emitss || []);
|
|
3152
|
+
const res = getExposeValue(param.exposes || []);
|
|
3152
3153
|
Object.keys(value).forEach((key) => {
|
|
3153
3154
|
let val = value[key];
|
|
3154
3155
|
if (/^on[A-Z]/.test(key) && typeof val == "function") {
|
|
@@ -3174,13 +3175,14 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
|
3174
3175
|
strs = arr.join("");
|
|
3175
3176
|
}
|
|
3176
3177
|
tarr.push(" @" + name + '="' + strs + '"');
|
|
3177
|
-
const s = getSpecObjs(es, name)
|
|
3178
|
+
const s = getSpecObjs(es, name)?.selectable || "";
|
|
3178
3179
|
const css = getParametersObj(s);
|
|
3179
3180
|
const cs = getParameStr(css);
|
|
3180
3181
|
sarr.push("function " + strs + "(" + cs + ") {");
|
|
3181
3182
|
css.forEach((o) => {
|
|
3183
|
+
const name2 = o.prop || "arr";
|
|
3182
3184
|
sarr.push(
|
|
3183
|
-
" console.log('" + o.description +
|
|
3185
|
+
" console.log('" + o.description + name2 + "', " + name2 + ")"
|
|
3184
3186
|
);
|
|
3185
3187
|
});
|
|
3186
3188
|
sarr.push("}");
|
|
@@ -3220,7 +3222,7 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
|
3220
3222
|
sarr.push(`-------${v.name}--------`);
|
|
3221
3223
|
const s = getSpecObjs(res, v.name);
|
|
3222
3224
|
const m = v.name + "Value";
|
|
3223
|
-
const css = getParametersObj(s
|
|
3225
|
+
const css = getParametersObj(s?.selectable || "");
|
|
3224
3226
|
const cs = [];
|
|
3225
3227
|
v.params?.forEach((val, index) => {
|
|
3226
3228
|
const prop = css[index].prop;
|
|
@@ -3858,8 +3860,8 @@ function getDefaultValue(obj) {
|
|
|
3858
3860
|
}
|
|
3859
3861
|
}
|
|
3860
3862
|
function setVue(propsname, param, url) {
|
|
3861
|
-
const ps = getPropsValue2(param.propss);
|
|
3862
|
-
const es = getEmitsValue(param.emitss);
|
|
3863
|
+
const ps = getPropsValue2(param.propss || []);
|
|
3864
|
+
const es = getEmitsValue(param.emitss || []);
|
|
3863
3865
|
const propsObj = {};
|
|
3864
3866
|
ps.forEach((val) => {
|
|
3865
3867
|
let name = val.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),
|
|
1
|
+
"use strict";const e=require("vue"),_=require("../use/index.cjs"),d=require("./info.vue.cjs"),k=require("./props.vue.cjs"),f=require("../../config.cjs"),g=require("../md/index.vue.cjs");require("./index.cjs");const v=require("../../utils/glob.cjs"),B={class:"compo"},y={key:0,class:"compo-md"},q={key:0,class:"compo-md-list"},C={key:1,class:"compo-use"},h=e.defineComponent({__name:"index",props:{value:Object},setup(c){const t=c,m=f.getConfig("useparam"),l=e.ref(""),u=e.reactive({md:!0}),o=e.ref([]),r=e.ref();function p(n){r.value=n}e.watch(()=>t.value,()=>{a()});function a(){t.value?.key&&(v.getLocalTextComponents(t.value?.key).then(n=>{l.value=n}),o.value=v.getKeyMds(t.value?.key)||[])}return a(),(n,s)=>(e.openBlock(),e.createElementBlock("div",B,[e.createVNode(d,{value:c.value},null,8,["value"]),e.createVNode(k,{onChange:p,value:l.value},null,8,["value"]),o.value&&o.value.length?(e.openBlock(),e.createElementBlock("div",y,[e.createElementVNode("div",{onClick:s[0]||(s[0]=i=>u.md=!u.md),class:"compo-md-name"},"说明文档"),u.md?(e.openBlock(),e.createElementBlock("div",q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,i=>(e.openBlock(),e.createBlock(g,{value:i},null,8,["value"]))),256))])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.unref(m)?(e.openBlock(),e.createElementBlock("div",C,[e.createVNode(e.unref(_),{value:t.value,param:r.value},null,8,["value","param"])])):e.createCommentVNode("",!0)]))}});module.exports=h;
|
|
@@ -1,75 +1,67 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { getConfig as
|
|
6
|
-
import
|
|
1
|
+
import { defineComponent as g, ref as m, reactive as h, watch as y, createElementBlock as o, openBlock as e, createVNode as r, createCommentVNode as s, createElementVNode as C, Fragment as x, renderList as $, createBlock as B, unref as f } from "vue";
|
|
2
|
+
import N from "../use/index.js";
|
|
3
|
+
import V from "./info.vue.js";
|
|
4
|
+
import E from "./props.vue.js";
|
|
5
|
+
import { getConfig as L } from "../../config.js";
|
|
6
|
+
import b from "../md/index.vue.js";
|
|
7
7
|
import "./index.js";
|
|
8
|
-
import { getLocalTextComponents as
|
|
9
|
-
const
|
|
8
|
+
import { getLocalTextComponents as j, getKeyMds as w } from "../../utils/glob.js";
|
|
9
|
+
const D = { class: "compo" }, F = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "compo-md"
|
|
12
|
-
},
|
|
12
|
+
}, K = {
|
|
13
13
|
key: 0,
|
|
14
14
|
class: "compo-md-list"
|
|
15
|
-
},
|
|
15
|
+
}, M = {
|
|
16
16
|
key: 1,
|
|
17
17
|
class: "compo-use"
|
|
18
|
-
},
|
|
18
|
+
}, I = /* @__PURE__ */ g({
|
|
19
19
|
__name: "index",
|
|
20
20
|
props: {
|
|
21
21
|
value: Object
|
|
22
22
|
},
|
|
23
|
-
setup(
|
|
24
|
-
const
|
|
23
|
+
setup(u) {
|
|
24
|
+
const t = u, _ = L("useparam"), c = m(""), l = h({
|
|
25
25
|
md: !0
|
|
26
|
-
}), a =
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
p.value = n, _.value = u, d.value = y, f.value = C;
|
|
26
|
+
}), a = m([]), i = m();
|
|
27
|
+
function k(n) {
|
|
28
|
+
i.value = n;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
() =>
|
|
30
|
+
y(
|
|
31
|
+
() => t.value,
|
|
33
32
|
() => {
|
|
34
|
-
|
|
33
|
+
v();
|
|
35
34
|
}
|
|
36
35
|
);
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
), a.value = O(o.value?.key) || []);
|
|
36
|
+
function v() {
|
|
37
|
+
t.value?.key && (j(t.value?.key).then((n) => {
|
|
38
|
+
c.value = n;
|
|
39
|
+
}), a.value = w(t.value?.key) || []);
|
|
43
40
|
}
|
|
44
|
-
return
|
|
45
|
-
r(
|
|
46
|
-
r(
|
|
47
|
-
onChange:
|
|
48
|
-
value:
|
|
41
|
+
return v(), (n, d) => (e(), o("div", D, [
|
|
42
|
+
r(V, { value: u.value }, null, 8, ["value"]),
|
|
43
|
+
r(E, {
|
|
44
|
+
onChange: k,
|
|
45
|
+
value: c.value
|
|
49
46
|
}, null, 8, ["value"]),
|
|
50
|
-
a.value && a.value.length ? (
|
|
51
|
-
|
|
52
|
-
onClick:
|
|
47
|
+
a.value && a.value.length ? (e(), o("div", F, [
|
|
48
|
+
C("div", {
|
|
49
|
+
onClick: d[0] || (d[0] = (p) => l.md = !l.md),
|
|
53
50
|
class: "compo-md-name"
|
|
54
|
-
}, "
|
|
55
|
-
|
|
56
|
-
(
|
|
57
|
-
])) :
|
|
58
|
-
])) :
|
|
59
|
-
|
|
60
|
-
r(
|
|
61
|
-
value:
|
|
62
|
-
param:
|
|
63
|
-
props: p.value,
|
|
64
|
-
slot: _.value,
|
|
65
|
-
emits: d.value,
|
|
66
|
-
expose: f.value
|
|
67
|
-
}
|
|
51
|
+
}, "说明文档"),
|
|
52
|
+
l.md ? (e(), o("div", K, [
|
|
53
|
+
(e(!0), o(x, null, $(a.value, (p) => (e(), B(b, { value: p }, null, 8, ["value"]))), 256))
|
|
54
|
+
])) : s("", !0)
|
|
55
|
+
])) : s("", !0),
|
|
56
|
+
f(_) ? (e(), o("div", M, [
|
|
57
|
+
r(f(N), {
|
|
58
|
+
value: t.value,
|
|
59
|
+
param: i.value
|
|
68
60
|
}, null, 8, ["value", "param"])
|
|
69
|
-
])) :
|
|
61
|
+
])) : s("", !0)
|
|
70
62
|
]));
|
|
71
63
|
}
|
|
72
64
|
});
|
|
73
65
|
export {
|
|
74
|
-
|
|
66
|
+
I as default
|
|
75
67
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const P=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const x=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const S=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const P=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const x=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const S=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const h=require("./util.cjs"),E=require("../../utils/props.cjs"),z=require("@fangzhongya/utils/basic/string/toFunction"),U=["class"];function O(n,e){return n.filter(t=>t.name==e)[0]}function B(n){return n.map(e=>(e.prop||"...arr")+":"+h.setDataType(e.dataType)).join(",")}function C(n,e,t,i,a,y){const c=[],r=[];let $=!0;const w=E.getEmitsValue(e.emitss||[]),D=E.getExposeValue(e.exposes||[]);Object.keys(t).forEach(s=>{let p=t[s];if(/^on[A-Z]/.test(s)&&typeof p=="function"){let o=s.substring(2);const f=s.split(":");let l;if(f.length>1?(l=f[0]+f.slice(1).map(u=>S.firstUpper(u)).join(""),o=x.firstLower(o)):(l=f[0],o=P.humpToLine(o)),f.includes("-")){let u=l.split("-");u=u.map((m,V)=>V!=0?S.firstUpper(m):m),l=u.join("")}c.push(" @"+o+'="'+l+'"');const g=O(w,o)?.selectable||"",b=h.getParametersObj(g),d=B(b);r.push("function "+l+"("+d+") {"),b.forEach(u=>{const m=u.prop||"arr";r.push(" console.log('"+u.description+m+"', "+m+")")}),r.push("}")}else{let o=s;if(U.includes(s)&&(o=s+"1"),c.push(" :"+s+'="'+o+'"'),typeof p=="function")r.push("const "+s+" = "+F(p,s,a));else if($&&($=!1,r.unshift("import { ref } from 'vue';")),typeof p>"u")r.push("const "+o+" = ref();");else{let f=q(p,s,a);r.push("const "+o+" = ref("+f+");")}}});const j=Object.values(y||{});j.length>0&&($&&($=!1,r.unshift("import { ref } from 'vue';")),c.unshift(' ref="refDom"'),r.push("const refDom = ref()"),j.forEach(s=>{r.push(`-------${s.name}--------`);const p=O(D,s.name),o=s.name+"Value",f=h.getParametersObj(p?.selectable||""),l=[];s.params?.forEach((g,b)=>{const d=f[b].prop,u=d+s.name;if(typeof g=="function")r.push("const "+u+" = "+F(g,d,s.text));else if(typeof g>"u")r.push("const "+u+" = undefined;");else{let m=q(g,d,s.text);r.push("const "+u+" = "+m+";")}l.push(u)}),s.type==="function"?r.push(`const ${o} = refDom.value?.${s.name}(${l.join(", ")})`):r.push(`const ${o} = refDom.value?.${s.name}`),r.push(`console.log('"${p.description}"', ${o})`)})),c.length>0&&c.unshift("");const L=H(i);return`<!--${n}-->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
|
-
<${
|
|
4
|
+
<${n}${c.join(`
|
|
5
5
|
`)}>${L.join(`
|
|
6
6
|
`)}
|
|
7
|
-
</${
|
|
7
|
+
</${n}>
|
|
8
8
|
</div>
|
|
9
9
|
</template>
|
|
10
10
|
<script lang="ts" setup>
|
|
11
11
|
${r.join(`
|
|
12
12
|
`)}
|
|
13
13
|
<\/script>
|
|
14
|
-
`}function H(
|
|
15
|
-
${
|
|
16
|
-
</template>`;e.push(a)}}),e&&e.length>0&&e.unshift(""),e}function F(
|
|
17
|
-
${
|
|
18
|
-
}`;return`function ${e.param} ${
|
|
14
|
+
`}function H(n={}){const e=[];return Object.keys(n).forEach(t=>{const i=n[t];if(i){const a=` <template #${t}="scope">
|
|
15
|
+
${h.vueFormat(i," ")}
|
|
16
|
+
</template>`;e.push(a)}}),e&&e.length>0&&e.unshift(""),e}function F(n,e,t){const i=t?t[e]:"";return i||T(n.toString())}function T(n){const e=z.getFunctionFormat(h.prettierFormat(n));if(e){let t=`{
|
|
17
|
+
${h.vueFormat(h.getFunBody(e.body)," ")}
|
|
18
|
+
}`;return`function ${e.param} ${t}`}else return"undefined"}function J(n){const e=n.trim();return/^\(/.test(e)?T(e):JSON.stringify(n)}function q(n,e,t){const i=t?t[e]:"";return i||(typeof n=="string"?J(n+""):JSON.stringify(n))}function N(n){let e=A(n.type),t="any";e.length==1&&(t=e[0].split("<")[0]);const i=t;let a=(n.selectable||"").trim(),y=[];return a&&t!="boolean"&&(a.split(",").forEach(c=>{if(c){let r=c.split(":");y.push({label:c,prop:r[0].trim()})}}),t=="function"?t="function":t=="array"?t="choice":t="select"),{arr:y,zdtype:i,type:t,dataType:e}}function A(n){let e=[];return(n||"").trim().toLowerCase().split(",").forEach(i=>{i=i.trim(),i&&e.push(i)}),[...new Set(e)].sort()}exports.getHmtl=C;exports.getSpecType=N;exports.setValStringify=q;
|
|
@@ -13,31 +13,32 @@ import { getParametersObj as E, setDataType as C, vueFormat as D, prettierFormat
|
|
|
13
13
|
import { getEmitsValue as P, getExposeValue as A } from "../../utils/props.js";
|
|
14
14
|
import { getFunctionFormat as H } from "@fangzhongya/utils/basic/string/toFunction";
|
|
15
15
|
const U = ["class"];
|
|
16
|
-
function S(
|
|
17
|
-
return
|
|
16
|
+
function S(n, t) {
|
|
17
|
+
return n.filter((e) => e.name == t)[0];
|
|
18
18
|
}
|
|
19
|
-
function Z(
|
|
20
|
-
return
|
|
19
|
+
function Z(n) {
|
|
20
|
+
return n.map((t) => (t.prop || "...arr") + ":" + C(t.dataType)).join(",");
|
|
21
21
|
}
|
|
22
|
-
function ot(
|
|
22
|
+
function ot(n, t, e, o, a, d) {
|
|
23
23
|
const c = [], r = [];
|
|
24
|
-
let
|
|
25
|
-
const x = P(t.
|
|
26
|
-
Object.keys(
|
|
27
|
-
let l =
|
|
24
|
+
let $ = !0;
|
|
25
|
+
const x = P(t.emitss || []), V = A(t.exposes || []);
|
|
26
|
+
Object.keys(e).forEach((s) => {
|
|
27
|
+
let l = e[s];
|
|
28
28
|
if (/^on[A-Z]/.test(s) && typeof l == "function") {
|
|
29
29
|
let i = s.substring(2);
|
|
30
30
|
const u = s.split(":");
|
|
31
31
|
let p;
|
|
32
32
|
if (u.length > 1 ? (p = u[0] + u.slice(1).map((f) => j(f)).join(""), i = B(i)) : (p = u[0], i = T(i)), u.includes("-")) {
|
|
33
33
|
let f = p.split("-");
|
|
34
|
-
f = f.map((
|
|
34
|
+
f = f.map((m, L) => L != 0 ? j(m) : m), p = f.join("");
|
|
35
35
|
}
|
|
36
36
|
c.push(" @" + i + '="' + p + '"');
|
|
37
|
-
const
|
|
38
|
-
r.push("function " + p + "(" +
|
|
37
|
+
const h = S(x, i)?.selectable || "", y = E(h), g = Z(y);
|
|
38
|
+
r.push("function " + p + "(" + g + ") {"), y.forEach((f) => {
|
|
39
|
+
const m = f.prop || "arr";
|
|
39
40
|
r.push(
|
|
40
|
-
" console.log('" + f.description +
|
|
41
|
+
" console.log('" + f.description + m + "', " + m + ")"
|
|
41
42
|
);
|
|
42
43
|
}), r.push("}");
|
|
43
44
|
} else {
|
|
@@ -46,7 +47,7 @@ function ot(e, t, n, o, a, g) {
|
|
|
46
47
|
r.push(
|
|
47
48
|
"const " + s + " = " + O(l, s, a)
|
|
48
49
|
);
|
|
49
|
-
else if (
|
|
50
|
+
else if ($ && ($ = !1, r.unshift("import { ref } from 'vue';")), typeof l > "u")
|
|
50
51
|
r.push("const " + i + " = ref();");
|
|
51
52
|
else {
|
|
52
53
|
let u = F(l, s, a);
|
|
@@ -54,21 +55,21 @@ function ot(e, t, n, o, a, g) {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
});
|
|
57
|
-
const b = Object.values(
|
|
58
|
-
b.length > 0 && (
|
|
58
|
+
const b = Object.values(d || {});
|
|
59
|
+
b.length > 0 && ($ && ($ = !1, r.unshift("import { ref } from 'vue';")), c.unshift(' ref="refDom"'), r.push("const refDom = ref()"), b.forEach((s) => {
|
|
59
60
|
r.push(`-------${s.name}--------`);
|
|
60
|
-
const l = S(V, s.name), i = s.name + "Value", u = E(l
|
|
61
|
-
s.params?.forEach((
|
|
62
|
-
const
|
|
63
|
-
if (typeof
|
|
61
|
+
const l = S(V, s.name), i = s.name + "Value", u = E(l?.selectable || ""), p = [];
|
|
62
|
+
s.params?.forEach((h, y) => {
|
|
63
|
+
const g = u[y].prop, f = g + s.name;
|
|
64
|
+
if (typeof h == "function")
|
|
64
65
|
r.push(
|
|
65
|
-
"const " + f + " = " + O(
|
|
66
|
+
"const " + f + " = " + O(h, g, s.text)
|
|
66
67
|
);
|
|
67
|
-
else if (typeof
|
|
68
|
+
else if (typeof h > "u")
|
|
68
69
|
r.push("const " + f + " = undefined;");
|
|
69
70
|
else {
|
|
70
|
-
let
|
|
71
|
-
r.push("const " + f + " = " +
|
|
71
|
+
let m = F(h, g, s.text);
|
|
72
|
+
r.push("const " + f + " = " + m + ";");
|
|
72
73
|
}
|
|
73
74
|
p.push(f);
|
|
74
75
|
}), s.type === "function" ? r.push(
|
|
@@ -76,13 +77,13 @@ function ot(e, t, n, o, a, g) {
|
|
|
76
77
|
) : r.push(`const ${i} = refDom.value?.${s.name}`), r.push(`console.log('"${l.description}"', ${i})`);
|
|
77
78
|
})), c.length > 0 && c.unshift("");
|
|
78
79
|
const z = q(o);
|
|
79
|
-
return `<!--${
|
|
80
|
+
return `<!--${n}-->
|
|
80
81
|
<template>
|
|
81
82
|
<div>
|
|
82
|
-
<${
|
|
83
|
+
<${n}${c.join(`
|
|
83
84
|
`)}>${z.join(`
|
|
84
85
|
`)}
|
|
85
|
-
</${
|
|
86
|
+
</${n}>
|
|
86
87
|
</div>
|
|
87
88
|
</template>
|
|
88
89
|
<script lang="ts" setup>
|
|
@@ -91,63 +92,63 @@ ${r.join(`
|
|
|
91
92
|
<\/script>
|
|
92
93
|
`;
|
|
93
94
|
}
|
|
94
|
-
function q(
|
|
95
|
+
function q(n = {}) {
|
|
95
96
|
const t = [];
|
|
96
|
-
return Object.keys(
|
|
97
|
-
const o = e
|
|
97
|
+
return Object.keys(n).forEach((e) => {
|
|
98
|
+
const o = n[e];
|
|
98
99
|
if (o) {
|
|
99
|
-
const a = ` <template #${
|
|
100
|
+
const a = ` <template #${e}="scope">
|
|
100
101
|
${D(o, " ")}
|
|
101
102
|
</template>`;
|
|
102
103
|
t.push(a);
|
|
103
104
|
}
|
|
104
105
|
}), t && t.length > 0 && t.unshift(""), t;
|
|
105
106
|
}
|
|
106
|
-
function O(
|
|
107
|
-
const o =
|
|
108
|
-
return o || w(
|
|
107
|
+
function O(n, t, e) {
|
|
108
|
+
const o = e ? e[t] : "";
|
|
109
|
+
return o || w(n.toString());
|
|
109
110
|
}
|
|
110
|
-
function w(
|
|
111
|
-
const t = H(J(
|
|
111
|
+
function w(n) {
|
|
112
|
+
const t = H(J(n));
|
|
112
113
|
if (t) {
|
|
113
|
-
let
|
|
114
|
+
let e = `{
|
|
114
115
|
${D(N(t.body), " ")}
|
|
115
116
|
}`;
|
|
116
|
-
return `function ${t.param} ${
|
|
117
|
+
return `function ${t.param} ${e}`;
|
|
117
118
|
} else
|
|
118
119
|
return "undefined";
|
|
119
120
|
}
|
|
120
|
-
function G(
|
|
121
|
-
const t =
|
|
122
|
-
return /^\(/.test(t) ? w(t) : JSON.stringify(
|
|
121
|
+
function G(n) {
|
|
122
|
+
const t = n.trim();
|
|
123
|
+
return /^\(/.test(t) ? w(t) : JSON.stringify(n);
|
|
123
124
|
}
|
|
124
|
-
function F(
|
|
125
|
-
const o =
|
|
126
|
-
return o || (typeof
|
|
125
|
+
function F(n, t, e) {
|
|
126
|
+
const o = e ? e[t] : "";
|
|
127
|
+
return o || (typeof n == "string" ? G(n + "") : JSON.stringify(n));
|
|
127
128
|
}
|
|
128
|
-
function it(
|
|
129
|
-
let t = I(
|
|
130
|
-
t.length == 1 && (
|
|
131
|
-
const o =
|
|
132
|
-
let a = (
|
|
133
|
-
return a &&
|
|
129
|
+
function it(n) {
|
|
130
|
+
let t = I(n.type), e = "any";
|
|
131
|
+
t.length == 1 && (e = t[0].split("<")[0]);
|
|
132
|
+
const o = e;
|
|
133
|
+
let a = (n.selectable || "").trim(), d = [];
|
|
134
|
+
return a && e != "boolean" && (a.split(",").forEach((c) => {
|
|
134
135
|
if (c) {
|
|
135
136
|
let r = c.split(":");
|
|
136
|
-
|
|
137
|
+
d.push({
|
|
137
138
|
label: c,
|
|
138
139
|
prop: r[0].trim()
|
|
139
140
|
});
|
|
140
141
|
}
|
|
141
|
-
}),
|
|
142
|
-
arr:
|
|
142
|
+
}), e == "function" ? e = "function" : e == "array" ? e = "choice" : e = "select"), {
|
|
143
|
+
arr: d,
|
|
143
144
|
zdtype: o,
|
|
144
|
-
type:
|
|
145
|
+
type: e,
|
|
145
146
|
dataType: t
|
|
146
147
|
};
|
|
147
148
|
}
|
|
148
|
-
function I(
|
|
149
|
+
function I(n) {
|
|
149
150
|
let t = [];
|
|
150
|
-
return (
|
|
151
|
+
return (n || "").trim().toLowerCase().split(",").forEach((o) => {
|
|
151
152
|
o = o.trim(), o && t.push(o);
|
|
152
153
|
}), [...new Set(t)].sort();
|
|
153
154
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";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"),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 E=s.defineComponent({props:{value:{type:Object},param:{type:Object}},render(j,O,v,U,p){const u=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]=p.propsValue[e],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((_,D)=>x.firstUpper(_)),e=n.join("")}else e=x.firstUpper(e);const o="on"+e;a[o]=(...n)=>{const _={arr:n,_date_:new Date().getTime()};u.emitValue[t.name]=_}});let d;return f.forEach(t=>{const e=t.name||"default";q[e]=o=>{if(u.slotValue[e]){const n=u.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)=>{p.propsValue=t,p.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:p.propsText,exposeText:p.exposeText,slotValue:u.slotValue})),s.h("div",{class:"use-emit"},s.h(y,{name:r.name,list:m,value:u.emitValue})),s.h("div",{class:"use-expose"},s.h(C,{name:r.name,list:V,getRef:()=>d,onChange:t=>{p.exposeText=t}})),s.h("div",{class:"use-slot"},s.h(b,{name:r.name,list:f,onChange:(t,e)=>{u.slotValue[t]=e}}))])},data(){return{propsValue:{},propsText:{},exposeText:{}}}});module.exports=E;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as _, reactive as T, defineAsyncComponent as b, resolveComponent as j, h as
|
|
1
|
+
import { defineComponent as _, reactive as T, defineAsyncComponent as b, resolveComponent as j, h as s } from "vue";
|
|
2
2
|
import C from "./set-props.vue.js";
|
|
3
3
|
import y from "./set-emit.vue.js";
|
|
4
4
|
/* empty css */
|
|
@@ -18,7 +18,7 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
|
18
18
|
import { firstUpper as g } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
19
19
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
20
20
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
21
|
-
const
|
|
21
|
+
const oe = _({
|
|
22
22
|
/**
|
|
23
23
|
* @props {Stinrg} value 插入数据
|
|
24
24
|
*/
|
|
@@ -34,10 +34,10 @@ const se = _({
|
|
|
34
34
|
const r = T({
|
|
35
35
|
emitValue: {},
|
|
36
36
|
slotValue: {}
|
|
37
|
-
}),
|
|
37
|
+
}), o = f.value;
|
|
38
38
|
let l = "div";
|
|
39
|
-
|
|
40
|
-
const a = f.param, d = D(a.
|
|
39
|
+
o.component ? l = b(o.component) : o.name && (l = j(o.name));
|
|
40
|
+
const a = f.param || {}, d = D(a.propss || []), c = U(a.emitss || []), h = k(a.exposes || []), x = w(a.slots || []), i = {}, V = {};
|
|
41
41
|
d.forEach((t) => {
|
|
42
42
|
let e = t.name;
|
|
43
43
|
if (!e.includes(".")) {
|
|
@@ -70,7 +70,7 @@ const se = _({
|
|
|
70
70
|
V[e] = (p) => {
|
|
71
71
|
if (r.slotValue[e]) {
|
|
72
72
|
const m = r.slotValue[e];
|
|
73
|
-
return
|
|
73
|
+
return s(
|
|
74
74
|
_({
|
|
75
75
|
props: {
|
|
76
76
|
scope: {
|
|
@@ -85,31 +85,31 @@ const se = _({
|
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
-
}),
|
|
88
|
+
}), s(
|
|
89
89
|
"div",
|
|
90
90
|
{
|
|
91
91
|
class: "use"
|
|
92
92
|
},
|
|
93
93
|
[
|
|
94
|
-
|
|
94
|
+
s(
|
|
95
95
|
"div",
|
|
96
96
|
{
|
|
97
97
|
class: "use-props"
|
|
98
98
|
},
|
|
99
|
-
|
|
100
|
-
name:
|
|
99
|
+
s(C, {
|
|
100
|
+
name: o.name,
|
|
101
101
|
list: d,
|
|
102
102
|
onChange: (t, e) => {
|
|
103
103
|
n.propsValue = t, n.propsText = e;
|
|
104
104
|
}
|
|
105
105
|
})
|
|
106
106
|
),
|
|
107
|
-
|
|
107
|
+
s(
|
|
108
108
|
"div",
|
|
109
109
|
{
|
|
110
110
|
class: "use-component"
|
|
111
111
|
},
|
|
112
|
-
|
|
112
|
+
s(
|
|
113
113
|
l,
|
|
114
114
|
{
|
|
115
115
|
...i,
|
|
@@ -120,13 +120,13 @@ const se = _({
|
|
|
120
120
|
V
|
|
121
121
|
)
|
|
122
122
|
),
|
|
123
|
-
|
|
123
|
+
s(
|
|
124
124
|
"div",
|
|
125
125
|
{
|
|
126
126
|
class: "use-code"
|
|
127
127
|
},
|
|
128
|
-
|
|
129
|
-
name:
|
|
128
|
+
s(E, {
|
|
129
|
+
name: o.name,
|
|
130
130
|
param: a,
|
|
131
131
|
value: i,
|
|
132
132
|
propsText: n.propsText,
|
|
@@ -134,24 +134,24 @@ const se = _({
|
|
|
134
134
|
slotValue: r.slotValue
|
|
135
135
|
})
|
|
136
136
|
),
|
|
137
|
-
|
|
137
|
+
s(
|
|
138
138
|
"div",
|
|
139
139
|
{
|
|
140
140
|
class: "use-emit"
|
|
141
141
|
},
|
|
142
|
-
|
|
143
|
-
name:
|
|
142
|
+
s(y, {
|
|
143
|
+
name: o.name,
|
|
144
144
|
list: c,
|
|
145
145
|
value: r.emitValue
|
|
146
146
|
})
|
|
147
147
|
),
|
|
148
|
-
|
|
148
|
+
s(
|
|
149
149
|
"div",
|
|
150
150
|
{
|
|
151
151
|
class: "use-expose"
|
|
152
152
|
},
|
|
153
|
-
|
|
154
|
-
name:
|
|
153
|
+
s(O, {
|
|
154
|
+
name: o.name,
|
|
155
155
|
list: h,
|
|
156
156
|
getRef: () => v,
|
|
157
157
|
onChange: (t) => {
|
|
@@ -159,13 +159,13 @@ const se = _({
|
|
|
159
159
|
}
|
|
160
160
|
})
|
|
161
161
|
),
|
|
162
|
-
|
|
162
|
+
s(
|
|
163
163
|
"div",
|
|
164
164
|
{
|
|
165
165
|
class: "use-slot"
|
|
166
166
|
},
|
|
167
|
-
|
|
168
|
-
name:
|
|
167
|
+
s($, {
|
|
168
|
+
name: o.name,
|
|
169
169
|
list: x,
|
|
170
170
|
onChange: (t, e) => {
|
|
171
171
|
r.slotValue[t] = e;
|
|
@@ -191,5 +191,5 @@ const se = _({
|
|
|
191
191
|
// },
|
|
192
192
|
});
|
|
193
193
|
export {
|
|
194
|
-
|
|
194
|
+
oe as default
|
|
195
195
|
};
|