@fangzhongya/vue-archive 0.0.3-6 → 0.0.3-7

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.
@@ -66670,7 +66670,11 @@ function getDefaultValue(obj) {
66670
66670
  const vo = getSpecType(obj).zdtype;
66671
66671
  const d = (obj.default || "").trim();
66672
66672
  if (vo == "function") {
66673
- return new Function("", d);
66673
+ let fb = getFunctionFormat(d);
66674
+ if (fb) {
66675
+ return new Function(fb.param, fb.body);
66676
+ }
66677
+ return d;
66674
66678
  } else {
66675
66679
  return new Function(
66676
66680
  "",
@@ -66670,7 +66670,11 @@ function getDefaultValue(obj) {
66670
66670
  const vo = getSpecType(obj).zdtype;
66671
66671
  const d = (obj.default || "").trim();
66672
66672
  if (vo == "function") {
66673
- return new Function("", d);
66673
+ let fb = getFunctionFormat(d);
66674
+ if (fb) {
66675
+ return new Function(fb.param, fb.body);
66676
+ }
66677
+ return d;
66674
66678
  } else {
66675
66679
  return new Function(
66676
66680
  "",
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.cjs"),d=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.cjs"),S=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.cjs"),h=require("./util.cjs");function F(n,t,e,r){const o=[],i=[];let f=!0;Object.keys(t).forEach(s=>{let l=t[s];if(/^on[A-Z]/.test(s)&&typeof l=="function"){let u=s.substring(2);const p=s.split(":");let c;if(p.length>1?(c=p[0]+p.slice(1).map(a=>d.firstUpper(a)).join(""),u=S.firstLower(u)):(c=p[0],u=b.humpToLine(u)),p.includes("-")){let a=c.split("-");a=a.map((m,$)=>$!=0?d.firstUpper(m):m),c=a.join("")}o.push(" @"+u+'="'+c+'"'),i.push("function "+c+"(...arr) {"),i.push(" console.log('"+c+"', arr)"),i.push("}")}else if(o.push(" :"+s+'="'+s+'"'),typeof l=="function")i.push("const "+s+" = "+O(l,s,r));else if(f&&(f=!1,i.unshift("import { ref } from 'vue';")),typeof l>"u")i.push("const "+s+" = ref();");else{let u=E(l,s,r);i.push("const "+s+" = ref("+u+");")}}),o.length>0&&o.unshift("");const g=j(e);return`<!--${n}-->
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.cjs"),d=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.cjs"),F=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.cjs"),h=require("./util.cjs");function j(n,t,e,r){const o=[],i=[];let l=!0;Object.keys(t).forEach(s=>{let c=t[s];if(/^on[A-Z]/.test(s)&&typeof c=="function"){let u=s.substring(2);const a=s.split(":");let f;if(a.length>1?(f=a[0]+a.slice(1).map(p=>d.firstUpper(p)).join(""),u=F.firstLower(u)):(f=a[0],u=b.humpToLine(u)),a.includes("-")){let p=f.split("-");p=p.map((m,S)=>S!=0?d.firstUpper(m):m),f=p.join("")}o.push(" @"+u+'="'+f+'"'),i.push("function "+f+"(...arr) {"),i.push(" console.log('"+f+"', arr)"),i.push("}")}else if(o.push(" :"+s+'="'+s+'"'),typeof c=="function")i.push("const "+s+" = "+J(c,s,r));else if(l&&(l=!1,i.unshift("import { ref } from 'vue';")),typeof c>"u")i.push("const "+s+" = ref();");else{let u=$(c,s,r);i.push("const "+s+" = ref("+u+");")}}),o.length>0&&o.unshift("");const g=O(e);return`<!--${n}-->
2
2
  <template>
3
3
  <div>
4
4
  <${n}${o.join(`
@@ -11,10 +11,10 @@
11
11
  ${i.join(`
12
12
  `)}
13
13
  <\/script>
14
- `}function j(n={}){const t=[];return Object.keys(n).forEach(e=>{const r=n[e];if(r){const o=` <template #${e}="scope">
14
+ `}function O(n={}){const t=[];return Object.keys(n).forEach(e=>{const r=n[e];if(r){const o=` <template #${e}="scope">
15
15
  ${h.vueFormat(r," ")}
16
- </template>`;t.push(o)}}),t&&t.length>0&&t.unshift(""),t}function O(n,t,e){const r=e?e[t]:"";return r?"function"+r:y(n.toString())}function y(n){const t=h.getFunctionFormat(h.prettierFormat(n));if(t){let e=`{
16
+ </template>`;t.push(o)}}),t&&t.length>0&&t.unshift(""),t}function J(n,t,e){const r=e?e[t]:"";return r?"function"+r:y(n.toString())}function y(n){const t=h.getFunctionFormat(h.prettierFormat(n));if(t){let e=`{
17
17
  ${h.vueFormat(h.getFunBody(t.body)," ")}
18
- }`;return`function${t.param}${e}`}else return"undefined"}function J(n){const t=n.trim();return/^\(/.test(t)?y(t):JSON.stringify(new Function("",`{
18
+ }`;return`function${t.param}${e}`}else return"undefined"}function E(n){const t=n.trim();return/^\(/.test(t)?y(t):JSON.stringify(new Function("",`{
19
19
  return ${n}
20
- }`))}function E(n,t,e){const r=e?e[t]:"";return r||(typeof n=="string"?J(n+""):JSON.stringify(n))}function T(n){let t=q(n.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const r=e;let o=(n.selectable||"").trim(),i=[];return o&&e!="boolean"&&(o.split(",").forEach(f=>{if(f){let g=f.split(":");i.push({label:f,prop:g[0].trim()})}}),e=="function"?e="function":e=="array"?e="choice":e="select"),{arr:i,zdtype:r,type:e,dataType:t}}function q(n){let t=[];return(n||"").trim().toLowerCase().split(",").forEach(r=>{r=r.trim(),r&&t.push(r)}),[...new Set(t)].sort()}exports.getHmtl=F;exports.getSpecType=T;
20
+ }`))}function $(n,t,e){const r=e?e[t]:"";return r||(typeof n=="string"?E(n+""):JSON.stringify(n))}function T(n){let t=q(n.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const r=e;let o=(n.selectable||"").trim(),i=[];return o&&e!="boolean"&&(o.split(",").forEach(l=>{if(l){let g=l.split(":");i.push({label:l,prop:g[0].trim()})}}),e=="function"?e="function":e=="array"?e="choice":e="select"),{arr:i,zdtype:r,type:e,dataType:t}}function q(n){let t=[];return(n||"").trim().toLowerCase().split(",").forEach(r=>{r=r.trim(),r&&t.push(r)}),[...new Set(t)].sort()}exports.getHmtl=j;exports.getSpecType=T;exports.setValStringify=$;
@@ -1,6 +1,7 @@
1
1
  import type { ObjStr, ObjUnk } from '../../config';
2
2
  import type { Spec } from '../../utils/index';
3
3
  export declare function getHmtl(propsname: string, value: ObjUnk, slotValue?: ObjStr, propsText?: ObjStr): string;
4
+ export declare function setValStringify(v: unknown, key: string, propsText?: ObjStr): string;
4
5
  type SelectsObj = {
5
6
  label: string;
6
7
  prop: unknown;
@@ -130,5 +130,6 @@ function B(n) {
130
130
  }
131
131
  export {
132
132
  T as getHmtl,
133
- U as getSpecType
133
+ U as getSpecType,
134
+ z as setValStringify
134
135
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.0.3-6",
4
+ "version": "0.0.3-7",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",