@fangzhongya/vue-archive 0.0.45 → 0.0.47

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.
Files changed (29) hide show
  1. package/dist/node/index.cjs +184 -112
  2. package/dist/node/index.js +184 -112
  3. package/dist/packages/components/compo/index.cjs +1 -1
  4. package/dist/packages/components/compo/index.js +98 -85
  5. package/dist/packages/components/compo/index.vue.cjs +1 -1
  6. package/dist/packages/components/compo/index.vue.js +18 -16
  7. package/dist/packages/components/compo/info-top.vue.cjs +1 -0
  8. package/dist/packages/components/compo/info-top.vue.js +32 -0
  9. package/dist/packages/components/compo/info-top.vue2.cjs +1 -0
  10. package/dist/packages/components/compo/info-top.vue2.js +4 -0
  11. package/dist/packages/components/compo/props.vue.cjs +1 -1
  12. package/dist/packages/components/compo/props.vue.js +44 -40
  13. package/dist/packages/components/compo/top.cjs +1 -1
  14. package/dist/packages/components/compo/top.js +69 -48
  15. package/dist/packages/components/main/index.vue.cjs +1 -1
  16. package/dist/packages/components/main/index.vue.js +30 -25
  17. package/dist/packages/components/test/index.cjs +1 -1
  18. package/dist/packages/components/test/index.js +24 -22
  19. package/dist/packages/components/test/top.cjs +1 -1
  20. package/dist/packages/components/test/top.js +69 -84
  21. package/dist/packages/components/use/code.cjs +6 -6
  22. package/dist/packages/components/use/code.js +74 -66
  23. package/dist/packages/components/use/retrie/array/index.vue.cjs +2 -2
  24. package/dist/packages/components/use/retrie/array/index.vue.js +16 -16
  25. package/dist/packages/components/use/retrie/object/index.vue.cjs +2 -2
  26. package/dist/packages/components/use/retrie/object/index.vue.js +17 -17
  27. package/dist/packages/page/develop/index.vue2.cjs +1 -1
  28. package/dist/packages/page/develop/index.vue2.js +2 -1
  29. 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 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}-->
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
- `)}>${C.join(`
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 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}) -->
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
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=`{
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
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=`{
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
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;
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;
@@ -9,90 +9,90 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
9
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 F, parseParamString as V, setDataType as q, vueFormat as T, prettierFormat as G, getFunBody as z } from "./util.js";
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
16
  function S(t, n) {
17
17
  return t.filter((e) => e.name == n)[0];
18
18
  }
19
- function L(t) {
19
+ function C(t) {
20
20
  return t.map((n) => (n.prop || "...arr") + ":" + q(n.dataType)).join(",");
21
21
  }
22
- function ht(t, n, e, s, c, h) {
22
+ function ht(t, n, e, s, i, h) {
23
23
  const p = [], r = [];
24
- let y = !0;
25
- const C = I(n.propss || []), J = K(n.emitss || []), N = M(n.exposes || []), A = Q(n.slots || []);
24
+ let d = !0;
25
+ const B = I(n.propss || []), J = K(n.emitss || []), N = M(n.exposes || []), A = Q(n.slots || []);
26
26
  Object.keys(e).forEach((o) => {
27
27
  let a = e[o];
28
28
  if (/^on[A-Z]/.test(o) && typeof a == "function") {
29
- let i = o.substring(2);
29
+ let c = o.substring(2);
30
30
  const u = o.split(":");
31
31
  let m;
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("-")) {
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(($, E) => E != 0 ? D($) : $), m = f.join("");
34
+ f = f.map((g, j) => j != 0 ? D(g) : g), m = f.join("");
35
35
  }
36
- p.push(" @" + i + '="' + m + '"');
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
- const $ = f.name || "arr";
40
- r.push(" console.log('" + f.label + "', " + $ + ")");
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
41
  }), r.push("}");
42
42
  } else {
43
- let i = o;
44
- W.includes(o) && (i = o + "1"), p.push(" :" + o + '="' + i + '"');
45
- const u = S(C, o) || {}, m = B(u);
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
46
  if (r.push(
47
47
  `// ${u.description} ${u.name}: {${u.type}} (${u.selectable})`
48
48
  ), typeof a == "function")
49
49
  r.push(
50
- "const " + o + " = " + w(a, o, c)
50
+ "const " + o + " = " + x(a, o, i)
51
51
  );
52
- else if (y && (y = !1, r.unshift("import { ref } from 'vue';")), typeof a > "u")
52
+ else if (d && (d = !1, r.unshift("import { ref } from 'vue';")), typeof a > "u")
53
53
  if (m.type == "function") {
54
54
  const l = Y(u);
55
- r.push("const " + i + " = " + l + ";");
55
+ r.push("const " + c + " = " + l + ";");
56
56
  } else {
57
- const l = F(m.dataType);
57
+ const l = E(m.dataType);
58
58
  r.push(
59
- "const " + i + " = ref(" + (l === "undefined" ? "" : l) + ");"
59
+ "const " + c + " = ref(" + (l === "undefined" ? "" : l) + ");"
60
60
  );
61
61
  }
62
62
  else {
63
- let l = x(a, o, c);
64
- r.push("const " + i + " = ref(" + l + ");");
63
+ let l = L(a, o, i);
64
+ r.push("const " + c + " = ref(" + l + ");");
65
65
  }
66
66
  }
67
67
  });
68
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) => {
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
70
  const a = S(N, o.name) || {};
71
71
  r.push(
72
72
  `// ${a.description} ${a.name}:(${a.selectable}) ${a.type}`
73
73
  );
74
- const i = o.name + "Value", u = V(a?.selectable || ""), m = [], l = o.params || [];
75
- u.forEach((d, b) => {
76
- const g = d.name;
77
- if (g) {
78
- const f = g + o.name, $ = l[b];
79
- if (r.push(`// ${d.label}`), typeof $ == "function")
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
80
  r.push(
81
- "const " + f + " = " + w($, g, o.text)
81
+ "const " + f + " = " + x(g, $, o.text)
82
82
  );
83
- else if (typeof $ > "u")
83
+ else if (typeof g > "u")
84
84
  r.push(
85
- "const " + f + " = " + F(d.dataType) + ";"
85
+ "const " + f + " = " + E(y.dataType) + ";"
86
86
  );
87
87
  else {
88
- let E = x($, g, o.text);
89
- r.push("const " + f + " = " + E + ";");
88
+ let j = L(g, $, o.text);
89
+ r.push("const " + f + " = " + j + ";");
90
90
  }
91
91
  m.push(f);
92
92
  }
93
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})`);
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}-->
@@ -113,61 +113,61 @@ ${r.join(`
113
113
  function X(t = {}, n) {
114
114
  const e = [];
115
115
  return Object.keys(t).forEach((s) => {
116
- const c = S(n, s) || {}, h = t[s];
116
+ const i = S(n, s) || {}, h = t[s];
117
117
  if (h) {
118
- const p = ` <!-- ${c.description} ${c.name}:(${c.selectable}) -->
118
+ const p = ` <!-- ${i.description} ${i.name}:(${i.selectable}) -->
119
119
  <template #${s}="scope">
120
- ${T(h, " ")}
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 w(t, n, e) {
126
+ function x(t, n, e) {
127
127
  const s = e ? e[n] : "";
128
- return s || P(t.toString());
128
+ return s && (s.includes("=>") || s.includes("function")) ? s : F(t.toString());
129
129
  }
130
- function P(t) {
130
+ function F(t) {
131
131
  const n = R(G(t));
132
132
  if (n) {
133
133
  let e = `{
134
- ${T(z(n.body), " ")}
134
+ ${w(z(n.body), " ")}
135
135
  }`;
136
136
  return `function (${n.param}) ${e}`;
137
137
  } else
138
138
  return "undefined";
139
139
  }
140
140
  function Y(t) {
141
- const n = V(t.selectable), e = L(n);
141
+ const n = T(t.selectable), e = C(n);
142
142
  let s = "";
143
143
  t.return && (s = "return ");
144
- let c = `{
145
- ${T(z(s), " ")}
144
+ let i = `{
145
+ ${w(z(s), " ")}
146
146
  }`;
147
- return `function (${e}) ${c}`;
147
+ return `function (${e}) ${i}`;
148
148
  }
149
149
  function _(t) {
150
150
  const n = t.trim();
151
- return /^\(/.test(n) ? P(n) : JSON.stringify(t);
151
+ return /^\(/.test(n) ? F(n) : JSON.stringify(t);
152
152
  }
153
- function x(t, n, e) {
153
+ function L(t, n, e) {
154
154
  const s = e ? e[n] : "";
155
- return s ? typeof s == "string" ? j(s) : s : typeof t == "string" ? _(t + "") : JSON.stringify(t);
155
+ return s ? typeof s == "string" ? V(s) : s : typeof t == "string" ? _(t + "") : JSON.stringify(t);
156
156
  }
157
- function B(t) {
157
+ function P(t) {
158
158
  let n = v(t?.type), e = "any";
159
159
  n.length == 1 && (e = n[0].split("<")[0]);
160
160
  const s = e;
161
- let c = (t?.selectable || "").trim(), h = [];
162
- return c && e != "boolean" && (c.includes("|") ? c.split("|").forEach((p) => {
161
+ let i = (t?.selectable || "").trim(), h = [];
162
+ return i && e != "boolean" && (i.includes("|") ? i.split("|").forEach((p) => {
163
163
  if (p) {
164
164
  let r = p.split(":");
165
165
  h.push({
166
166
  label: p,
167
- prop: j(r[0].trim())
167
+ prop: V(r[0].trim())
168
168
  });
169
169
  }
170
- }) : h = V(c), e == "function" ? e = "function" : e == "array" ? e = "choice" : h.length > 1 && (e = "select")), {
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
173
  type: e,
@@ -180,25 +180,33 @@ function v(t) {
180
180
  s = s.trim(), s && n.push(s);
181
181
  }), [...new Set(n)].sort();
182
182
  }
183
- function j(t) {
183
+ function V(t, n) {
184
184
  try {
185
- return new Function(`{ return ${t} }`)();
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 $t(t, n = !0) {
197
+ function gt(t, n = !0) {
198
+ const e = P(t), s = E(e.dataType);
191
199
  if (n) {
192
- const e = B(t), s = F(e.dataType), c = (t.default || "").trim();
193
- return j(c || s);
200
+ const i = (t.default || "").trim();
201
+ return V(i || s, e.dataType[0]);
194
202
  } else {
195
- const e = (t.default || "").trim();
196
- return j(e);
203
+ const i = (t.default || "").trim();
204
+ return V(i, e.dataType[0]);
197
205
  }
198
206
  }
199
207
  export {
200
- $t as getDefaultValue,
208
+ gt as getDefaultValue,
201
209
  ht as getHmtl,
202
- B as getSpecType,
203
- x as setValStringify
210
+ P as getSpecType,
211
+ L as setValStringify
204
212
  };
@@ -1,3 +1,3 @@
1
- "use strict";const o=require("vue"),d=require("../input/index.vue.cjs");;/* empty css */const p=require("../../util.cjs"),v={class:"form-array"},f=o.defineComponent({__name:"index",props:{modelValue:{type:null}},emits:["value","error"],setup(s,{emit:i}){const l=s,t=i,u=o.ref("");o.watch(()=>l.modelValue,()=>{let e=l.modelValue;u.value=a(e)||e},{immediate:!0});function m(e){return new Function("",`{return ${e}}`)}function a(e){let r;if(e)try{const c=m(e)();c instanceof Array?(r=p.prettierArrFormat(e),t("value",c,r),t("error",!1)):(t("error",!0),console.log("error","类型不匹配"))}catch(n){t("error",!0),console.log("error",n)}else r=`[
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
- ]`,t("value",void 0,r),t("error",!1);return r}return(e,r)=>(o.openBlock(),o.createElementBlock("div",v,[o.createVNode(d,{modelValue:u.value,"onUpdate:modelValue":r[0]||(r[0]=n=>u.value=n),check:a},null,8,["modelValue"])]))}});module.exports=f;
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 s, ref as f, watch as d, createElementBlock as p, openBlock as v, createVNode as _ } from "vue";
2
- import V from "../input/index.vue.js";
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 g } from "../../util.js";
5
- const h = { class: "form-array" }, A = /* @__PURE__ */ s({
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(m, { emit: c }) {
14
- const n = m, o = c, l = f("");
15
- d(
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 i(e) {
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
- const u = i(e)();
33
- u instanceof Array ? (r = g(e), o("value", u, r), o("error", !1)) : (o("error", !0), console.log("error", "类型不匹配"));
34
- } catch (t) {
35
- o("error", !0), console.log("error", t);
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
- ]`, o("value", void 0, r), o("error", !1);
40
+ ]`, t("value", void 0, r), t("error", !1);
41
41
  return r;
42
42
  }
43
- return (e, r) => (v(), p("div", h, [
44
- _(V, {
43
+ return (e, r) => (d(), p("div", g, [
44
+ v(_, {
45
45
  modelValue: l.value,
46
- "onUpdate:modelValue": r[0] || (r[0] = (t) => l.value = t),
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 o=require("vue"),d=require("../input/index.vue.cjs");;/* empty css */const p=require("../../util.cjs"),v={class:"form-object"},f=o.defineComponent({__name:"index",props:{modelValue:{type:null}},emits:["value","error"],setup(a,{emit:i}){const l=a,t=i,u=o.ref("");o.watch(()=>l.modelValue,()=>{let e=l.modelValue;u.value=c(e)||e},{immediate:!0});function m(e){return new Function("",`{ return ${e} }`)}function c(e){let r;if(e)try{const s=m(e)();typeof s=="object"?(r=p.prettierObjFormat(e),t("value",s,r),t("error",!1)):(t("error",!0),console.log("error","类型不匹配"))}catch(n){t("error",!0),console.log("error",n)}else r=`{
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
- }`,t("value",void 0,r),t("error",!1);return r}return(e,r)=>(o.openBlock(),o.createElementBlock("div",v,[o.createVNode(d,{modelValue:u.value,"onUpdate:modelValue":r[0]||(r[0]=n=>u.value=n),check:c},null,8,["modelValue"])]))}});module.exports=f;
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 s, ref as f, watch as p, createElementBlock as d, openBlock as v, createVNode as _ } from "vue";
2
- import V from "../input/index.vue.js";
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 g } from "../../util.js";
5
- const h = { class: "form-object" }, y = /* @__PURE__ */ s({
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(c, { emit: m }) {
14
- const n = c, o = m, l = f("");
15
- p(
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 i(e) {
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
- const a = i(e)();
33
- typeof a == "object" ? (r = g(e), o("value", a, r), o("error", !1)) : (o("error", !0), console.log("error", "类型不匹配"));
34
- } catch (t) {
35
- o("error", !0), console.log("error", t);
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
- }`, o("value", void 0, r), o("error", !1);
40
+ }`, t("value", void 0, r), t("error", !1);
41
41
  return r;
42
42
  }
43
- return (e, r) => (v(), d("div", h, [
44
- _(V, {
43
+ return (e, r) => (d(), p("div", g, [
44
+ v(_, {
45
45
  modelValue: l.value,
46
- "onUpdate:modelValue": r[0] || (r[0] = (t) => l.value = t),
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
- y as default
53
+ x as default
54
54
  };
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),_=require("../../components/compo/info.vue.cjs"),u=require("../../components/compo/index.vue.cjs"),n=require("../../components/choice/index.vue.cjs"),r={class:"__document-compon"},c=e.defineComponent({__name:"index",setup(l){return(o,s)=>(e.openBlock(),e.createElementBlock("div",r,[e.createVNode(n,null,{default:e.withCtx(t=>[e.createVNode(_,{value:t.value},null,8,["value"]),e.createVNode(u,{value:t.value},null,8,["value"])]),_:1})]))}});module.exports=c;
1
+ "use strict";const e=require("vue"),_=require("../../components/compo/info.vue.cjs"),u=require("../../components/compo/index.vue.cjs"),n=require("../../components/choice/index.vue.cjs"),r={class:"__document-compon"},c=e.defineComponent({__name:"index",setup(o){return(s,l)=>(e.openBlock(),e.createElementBlock("div",r,[e.createVNode(n,null,{default:e.withCtx(t=>[e.createVNode(_,{value:t.value},null,8,["value"]),e.createVNode(u,{istop:"",value:t.value},null,8,["value"])]),_:1})]))}});module.exports=c;
@@ -5,13 +5,14 @@ import r from "../../components/choice/index.vue.js";
5
5
  const c = { class: "__document-compon" }, x = /* @__PURE__ */ t({
6
6
  __name: "index",
7
7
  setup(u) {
8
- return (i, f) => (_(), n("div", c, [
8
+ return (i, s) => (_(), n("div", c, [
9
9
  e(r, null, {
10
10
  default: a((o) => [
11
11
  e(l, {
12
12
  value: o.value
13
13
  }, null, 8, ["value"]),
14
14
  e(m, {
15
+ istop: "",
15
16
  value: o.value
16
17
  }, null, 8, ["value"])
17
18
  ]),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.0.45",
4
+ "version": "0.0.47",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",