@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.
package/dist/node/index.cjs
CHANGED
|
@@ -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
|
-
|
|
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
|
"",
|
package/dist/node/index.js
CHANGED
|
@@ -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
|
-
|
|
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"),
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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;
|