@fangzhongya/vue-archive 0.0.43 → 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.
@@ -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
- const vo = getSpecType(obj);
3567
- const v = getTypeValue(vo.dataType);
3568
- const d = (obj.default || "").trim();
3569
- return getObjValue(d || v);
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
- const dv = getDefaultValue(val);
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,
@@ -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
- const vo = getSpecType(obj);
3552
- const v = getTypeValue(vo.dataType);
3553
- const d = (obj.default || "").trim();
3554
- return getObjValue(d || v);
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
- const dv = getDefaultValue(val);
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 O=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const c=require("./util.cjs"),q=require("../../utils/props.cjs"),N=require("@fangzhongya/utils/basic/string/toFunction"),v=["class"];function V(e,t){return e.filter(n=>n.name==t)[0]}function P(e){return e.map(t=>(t.prop||"...arr")+":"+c.setDataType(t.dataType)).join(",")}function A(e,t,n,s,l,h){const p=[],r=[];let b=!0;const x=q.getPropsValue(t.propss||[]),z=q.getEmitsValue(t.emitss||[]),B=q.getExposeValue(t.exposes||[]),U=q.getSlotValue(t.slots||[]);Object.keys(n).forEach(o=>{let m=n[o];if(/^on[A-Z]/.test(o)&&typeof m=="function"){let i=o.substring(2);const u=o.split(":");let g;if(u.length>1?(g=u[0]+u.slice(1).map(f=>O.firstUpper(f)).join(""),i=J.firstLower(i)):(g=u[0],i=H.humpToLine(i)),u.includes("-")){let f=g.split("-");f=f.map(($,T)=>T!=0?O.firstUpper($):$),g=f.join("")}p.push(" @"+i+'="'+g+'"');const a=V(z,i)||{},d=a.selectable||"",S=c.parseParamString(d),y=P(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 i=o;v.includes(o)&&(i=o+"1"),p.push(" :"+o+'="'+i+'"');const u=V(x,o)||{},g=j(u);if(r.push(`// ${u.description} ${u.name}: {${u.type}} (${u.selectable})`),typeof m=="function")r.push("const "+o+" = "+D(m,o,l));else if(b&&(b=!1,r.unshift("import { ref } from 'vue';")),typeof m>"u")if(g.type=="function"){const a=Z(u);r.push("const "+i+" = "+a+";")}else{const a=c.getTypeValue(g.dataType);r.push("const "+i+" = ref("+(a==="undefined"?"":a)+");")}else{let a=F(m,o,l);r.push("const "+i+" = ref("+a+");")}}});const E=Object.values(h||{});E.length>0&&(b&&(b=!1,r.unshift("import { ref } from 'vue';")),p.unshift(' ref="refDom"'),r.push("const refDom = ref()"),E.forEach(o=>{const m=V(B,o.name)||{};r.push(`// ${m.description} ${m.name}:(${m.selectable}) ${m.type}`);const i=o.name+"Value",u=c.parseParamString(m?.selectable||""),g=[],a=o.params||[];u.forEach((d,S)=>{const y=d.name;if(y){const f=y+o.name,$=a[S];if(r.push(`// ${d.label}`),typeof $=="function")r.push("const "+f+" = "+D($,y,o.text));else if(typeof $>"u")r.push("const "+f+" = "+c.getTypeValue(d.dataType)+";");else{let T=F($,y,o.text);r.push("const "+f+" = "+T+";")}g.push(f)}}),o.type==="function"?r.push(`const ${i} = refDom.value?.${o.name}(${g.join(", ")})`):r.push(`const ${i} = refDom.value?.${o.name}`),r.push(`console.log('"${m.type}"', ${i})`)})),p.length>0&&p.unshift("");const 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"),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={},t){const n=[];return Object.keys(e).forEach(s=>{const l=V(t,s)||{},h=e[s];if(h){const p=` <!-- ${l.description} ${l.name}:(${l.selectable}) -->
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
- ${c.vueFormat(h," ")}
17
- </template>`;n.push(p)}}),n&&n.length>0&&n.unshift(""),n}function D(e,t,n){const s=n?n[t]:"";return s||w(e.toString())}function w(e){const t=N.getFunctionFormat(c.prettierFormat(e));if(t){let n=`{
18
- ${c.vueFormat(c.getFunBody(t.body)," ")}
19
- }`;return`function (${t.param}) ${n}`}else return"undefined"}function Z(e){const t=c.parseParamString(e.selectable),n=P(t);let s="";e.return&&(s="return ");let l=`{
20
- ${c.vueFormat(c.getFunBody(s)," ")}
21
- }`;return`function (${n}) ${l}`}function G(e){const t=e.trim();return/^\(/.test(t)?w(t):JSON.stringify(e)}function F(e,t,n){const s=n?n[t]:"";return s?typeof s=="string"?L(s):s:typeof e=="string"?G(e+""):JSON.stringify(e)}function j(e){let t=I(e?.type),n="any";t.length==1&&(n=t[0].split("<")[0]);const s=n;let l=(e?.selectable||"").trim(),h=[];return l&&n!="boolean"&&(l.includes("|")?l.split("|").forEach(p=>{if(p){let r=p.split(":");h.push({label:p,prop:r[0].trim()})}}):h=c.parseParamString(l),n=="function"?n="function":n=="array"?n="choice":h.length>1&&(n="select")),{arr:h,zdtype:s,type:n,dataType:t}}function I(e){let t=[];return(e||"").trim().toLowerCase().split(",").forEach(s=>{s=s.trim(),s&&t.push(s)}),[...new Set(t)].sort()}function L(e){try{return new Function(`{ return ${e} }`)()}catch{return""+e}}function K(e){const t=j(e),n=c.getTypeValue(t.dataType),s=(e.default||"").trim();return L(s||n)}exports.getDefaultValue=K;exports.getHmtl=A;exports.getSpecType=j;exports.setValStringify=F;
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;
@@ -14,5 +14,5 @@ export declare function getSpecType(val: Spec): {
14
14
  type: string;
15
15
  dataType: string[];
16
16
  };
17
- export declare function getDefaultValue(obj: Spec): any;
17
+ export declare function getDefaultValue(obj: Spec, is?: boolean): any;
18
18
  export {};
@@ -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 O } from "@fangzhongya/utils/basic/string/firstUpper";
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 j, setDataType as q, vueFormat as F, prettierFormat as G, getFunBody as x } from "./util.js";
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, e) {
17
- return t.filter((n) => n.name == e)[0];
16
+ function S(t, n) {
17
+ return t.filter((e) => e.name == n)[0];
18
18
  }
19
- function z(t) {
20
- return t.map((e) => (e.prop || "...arr") + ":" + q(e.dataType)).join(",");
19
+ function L(t) {
20
+ return t.map((n) => (n.prop || "...arr") + ":" + q(n.dataType)).join(",");
21
21
  }
22
- function ht(t, e, n, s, l, h) {
23
- const p = [], o = [];
22
+ function ht(t, n, e, s, c, h) {
23
+ const p = [], r = [];
24
24
  let y = !0;
25
- const C = I(e.propss || []), J = K(e.emitss || []), N = M(e.exposes || []), A = Q(e.slots || []);
26
- Object.keys(n).forEach((r) => {
27
- let a = n[r];
28
- if (/^on[A-Z]/.test(r) && typeof a == "function") {
29
- let i = r.substring(2);
30
- const c = r.split(":");
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 (c.length > 1 ? (m = c[0] + c.slice(1).map((f) => O(f)).join(""), i = Z(i)) : (m = c[0], i = U(i)), c.includes("-")) {
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(($, V) => V != 0 ? O($) : $), m = f.join("");
34
+ f = f.map(($, E) => E != 0 ? D($) : $), m = f.join("");
35
35
  }
36
36
  p.push(" @" + i + '="' + m + '"');
37
- const u = S(J, i) || {}, d = u.selectable || "", b = j(d), g = z(b);
38
- o.push(`// ${u.description} ${u.name}: (${u.selectable})`), o.push("function " + m + "(" + g + ") {"), b.forEach((f) => {
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
- o.push(" console.log('" + f.label + "', " + $ + ")");
41
- }), o.push("}");
40
+ r.push(" console.log('" + f.label + "', " + $ + ")");
41
+ }), r.push("}");
42
42
  } else {
43
- let i = r;
44
- W.includes(r) && (i = r + "1"), p.push(" :" + r + '="' + i + '"');
45
- const c = S(C, r) || {}, m = P(c);
46
- if (o.push(
47
- `// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`
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
- o.push(
50
- "const " + r + " = " + D(a, r, l)
49
+ r.push(
50
+ "const " + o + " = " + w(a, o, c)
51
51
  );
52
- else if (y && (y = !1, o.unshift("import { ref } from 'vue';")), typeof a > "u")
52
+ else if (y && (y = !1, r.unshift("import { ref } from 'vue';")), typeof a > "u")
53
53
  if (m.type == "function") {
54
- const u = Y(c);
55
- o.push("const " + i + " = " + u + ";");
54
+ const l = Y(u);
55
+ r.push("const " + i + " = " + l + ";");
56
56
  } else {
57
- const u = E(m.dataType);
58
- o.push(
59
- "const " + i + " = ref(" + (u === "undefined" ? "" : u) + ");"
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 u = w(a, r, l);
64
- o.push("const " + i + " = ref(" + u + ");");
63
+ let l = x(a, o, c);
64
+ r.push("const " + i + " = ref(" + l + ");");
65
65
  }
66
66
  }
67
67
  });
68
- const T = Object.values(h || {});
69
- T.length > 0 && (y && (y = !1, o.unshift("import { ref } from 'vue';")), p.unshift(' ref="refDom"'), o.push("const refDom = ref()"), T.forEach((r) => {
70
- const a = S(N, r.name) || {};
71
- o.push(
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 = r.name + "Value", c = j(a?.selectable || ""), m = [], u = r.params || [];
75
- c.forEach((d, b) => {
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 + r.name, $ = u[b];
79
- if (o.push(`// ${d.label}`), typeof $ == "function")
80
- o.push(
81
- "const " + f + " = " + D($, g, r.text)
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
- o.push(
85
- "const " + f + " = " + E(d.dataType) + ";"
84
+ r.push(
85
+ "const " + f + " = " + F(d.dataType) + ";"
86
86
  );
87
87
  else {
88
- let V = w($, g, r.text);
89
- o.push("const " + f + " = " + V + ";");
88
+ let E = x($, g, o.text);
89
+ r.push("const " + f + " = " + E + ";");
90
90
  }
91
91
  m.push(f);
92
92
  }
93
- }), r.type === "function" ? o.push(
94
- `const ${i} = refDom.value?.${r.name}(${m.join(", ")})`
95
- ) : o.push(`const ${i} = refDom.value?.${r.name}`), o.push(`console.log('"${a.type}"', ${i})`);
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
- ${o.join(`
108
+ ${r.join(`
109
109
  `)}
110
110
  <\/script>
111
111
  `;
112
112
  }
113
- function X(t = {}, e) {
114
- const n = [];
113
+ function X(t = {}, n) {
114
+ const e = [];
115
115
  return Object.keys(t).forEach((s) => {
116
- const l = S(e, s) || {}, h = t[s];
116
+ const c = S(n, s) || {}, h = t[s];
117
117
  if (h) {
118
- const p = ` <!-- ${l.description} ${l.name}:(${l.selectable}) -->
118
+ const p = ` <!-- ${c.description} ${c.name}:(${c.selectable}) -->
119
119
  <template #${s}="scope">
120
- ${F(h, " ")}
120
+ ${T(h, " ")}
121
121
  </template>`;
122
- n.push(p);
122
+ e.push(p);
123
123
  }
124
- }), n && n.length > 0 && n.unshift(""), n;
124
+ }), e && e.length > 0 && e.unshift(""), e;
125
125
  }
126
- function D(t, e, n) {
127
- const s = n ? n[e] : "";
128
- return s || L(t.toString());
126
+ function w(t, n, e) {
127
+ const s = e ? e[n] : "";
128
+ return s || P(t.toString());
129
129
  }
130
- function L(t) {
131
- const e = R(G(t));
132
- if (e) {
133
- let n = `{
134
- ${F(x(e.body), " ")}
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 (${e.param}) ${n}`;
136
+ return `function (${n.param}) ${e}`;
137
137
  } else
138
138
  return "undefined";
139
139
  }
140
140
  function Y(t) {
141
- const e = j(t.selectable), n = z(e);
141
+ const n = V(t.selectable), e = L(n);
142
142
  let s = "";
143
143
  t.return && (s = "return ");
144
- let l = `{
145
- ${F(x(s), " ")}
144
+ let c = `{
145
+ ${T(z(s), " ")}
146
146
  }`;
147
- return `function (${n}) ${l}`;
147
+ return `function (${e}) ${c}`;
148
148
  }
149
149
  function _(t) {
150
- const e = t.trim();
151
- return /^\(/.test(e) ? L(e) : JSON.stringify(t);
150
+ const n = t.trim();
151
+ return /^\(/.test(n) ? P(n) : JSON.stringify(t);
152
152
  }
153
- function w(t, e, n) {
154
- const s = n ? n[e] : "";
155
- return s ? typeof s == "string" ? B(s) : s : typeof t == "string" ? _(t + "") : JSON.stringify(t);
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 P(t) {
158
- let e = v(t?.type), n = "any";
159
- e.length == 1 && (n = e[0].split("<")[0]);
160
- const s = n;
161
- let l = (t?.selectable || "").trim(), h = [];
162
- return l && n != "boolean" && (l.includes("|") ? l.split("|").forEach((p) => {
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 o = p.split(":");
164
+ let r = p.split(":");
165
165
  h.push({
166
166
  label: p,
167
- prop: o[0].trim()
167
+ prop: j(r[0].trim())
168
168
  });
169
169
  }
170
- }) : h = j(l), n == "function" ? n = "function" : n == "array" ? n = "choice" : h.length > 1 && (n = "select")), {
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: n,
174
- dataType: e
173
+ type: e,
174
+ dataType: n
175
175
  };
176
176
  }
177
177
  function v(t) {
178
- let e = [];
178
+ let n = [];
179
179
  return (t || "").trim().toLowerCase().split(",").forEach((s) => {
180
- s = s.trim(), s && e.push(s);
181
- }), [...new Set(e)].sort();
180
+ s = s.trim(), s && n.push(s);
181
+ }), [...new Set(n)].sort();
182
182
  }
183
- function B(t) {
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
- const e = P(t), n = E(e.dataType), s = (t.default || "").trim();
192
- return B(s || n);
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
- P as getSpecType,
198
- w as setValStringify
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||{},h=l.getPropsValue(i.propss||[]),m=l.getEmitsValue(i.emitss||[]),V=l.getExposeValue(i.exposes||[]),f=l.getSlotValue(i.slots||[]),a={},q={};h.forEach(t=>{let e=t.name;if(!e.includes(".")){let o=e.split("/");e=(o[0]||"").trim(),e&&(a[e]=u.propsValue[e]??E.getDefaultValue(t),o&&o.length>1&&m.push({name:"update:"+e,description:t.description,selectable:"value:["+t.type+"]"}))}}),m.forEach(t=>{let e=t.name;if(e.includes("-")){let n=e.split("-");n=n.map((_,P)=>x.firstUpper(_)),e=n.join("")}else e=x.firstUpper(e);const o="on"+e;a[o]=(...n)=>{const _={arr:n,_date_:new Date().getTime()};p.emitValue[t.name]=_}});let d;return f.forEach(t=>{const e=t.name||"default";q[e]=o=>{if(p.slotValue[e]){const n=p.slotValue[e];return s.h(s.defineComponent({props:{scope:{type:Object}},template:n}),{scope:o})}}}),s.h("div",{class:"use"},[s.h("div",{class:"use-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:h,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:f,onChange:(t,e)=>{p.slotValue[t]=e}}))])},data(){return{propsValue:{},propsText:{},exposeText:{}}}});module.exports=j;
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"),V=require("./retrie/index.vue.cjs");;/* empty css */const T=require("./code.cjs"),k={key:0,class:"set-props"},q=s.defineComponent({__name:"set-props",props:{name:String,list:Array},emits:["change"],setup(o,{emit:i}){const l=o,p=i,u=s.ref({}),m=s.ref(0),c=s.ref({}),n=s.ref([]);function f(){c.value={};const r=[];l.list?.forEach(t=>{let e=t.name;if(e.includes(".")?e="":e=(e.split("/")[0]||"").trim(),e){c.value[e]=(t.default||"").trim();const{arr:y,type:v,dataType:b}=T.getSpecType(t);u.value[e]=y;let g={label:d(e,t),prop:e,type:v,dataType:b,select:e};r.push(g)}}),n.value=r}function d(r,t){let e=r+": { "+(t.type||"any")+" } "+t.description;return t.default&&(e+=" 默认值="+t.default),t.selectable&&(e+=" 可选值="+t.selectable),e}function _(r,t){let e=Object.assign({},r);p("change",e,t)}let a;function h(){clearTimeout(a),a=setTimeout(()=>{f()},400)}return s.watch(()=>l.name,()=>{n.value=[],s.nextTick(()=>{h()})},{immediate:!0}),(r,t)=>n.value&&n.value.length>0?(s.openBlock(),s.createElementBlock("div",k,[s.createVNode(V,{refresh:m.value,modelValue:c.value,selects:u.value,list:n.value,name:l.name,onQuery:_},null,8,["refresh","modelValue","selects","list","name"])])):s.createCommentVNode("",!0)}});module.exports=q;
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 n, watch as T, nextTick as k, createElementBlock as x, createCommentVNode as j, openBlock as B, createVNode as C } from "vue";
2
- import E from "./retrie/index.vue.js";
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 { getSpecType as N } from "./code.js";
4
+ import { getDefaultValue as E, getSpecType as N } from "./code.js";
5
5
  const S = {
6
6
  key: 0,
7
7
  class: "set-props"
8
- }, R = /* @__PURE__ */ v({
8
+ }, Q = /* @__PURE__ */ v({
9
9
  __name: "set-props",
10
10
  props: {
11
11
  name: String,
@@ -13,16 +13,16 @@ const S = {
13
13
  },
14
14
  emits: ["change"],
15
15
  setup(i, { emit: u }) {
16
- const r = i, m = u, o = n({}), p = n(0), a = n({}), l = n([]);
16
+ const n = i, m = u, r = a({}), p = a(0), o = a({}), l = a([]);
17
17
  function f() {
18
- a.value = {};
18
+ o.value = {};
19
19
  const s = [];
20
- r.list?.forEach((t) => {
20
+ n.list?.forEach((t) => {
21
21
  let e = t.name;
22
- if (e.includes(".") ? e = "" : e = (e.split("/")[0] || "").trim(), e) {
23
- a.value[e] = (t.default || "").trim();
22
+ if (!e.includes(".") && (e = (e.split("/")[0] || "").trim(), e)) {
23
+ o.value[e] = E(t, !1);
24
24
  const { arr: y, type: b, dataType: g } = N(t);
25
- o.value[e] = y;
25
+ r.value[e] = y;
26
26
  let V = {
27
27
  label: d(e, t),
28
28
  prop: e,
@@ -49,27 +49,25 @@ const S = {
49
49
  }, 400);
50
50
  }
51
51
  return T(
52
- () => r.name,
52
+ () => n.name,
53
53
  () => {
54
- l.value = [], k(() => {
55
- _();
56
- });
54
+ l.value = [], _();
57
55
  },
58
56
  {
59
57
  immediate: !0
60
58
  }
61
- ), (s, t) => l.value && l.value.length > 0 ? (B(), x("div", S, [
62
- C(E, {
59
+ ), (s, t) => l.value && l.value.length > 0 ? (x(), k("div", S, [
60
+ B(C, {
63
61
  refresh: p.value,
64
- modelValue: a.value,
65
- selects: o.value,
62
+ modelValue: o.value,
63
+ selects: r.value,
66
64
  list: l.value,
67
- name: r.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
- R as default
72
+ Q as default
75
73
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.0.43",
4
+ "version": "0.0.45",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",