@fangzhongya/vue-archive 0.0.31 → 0.0.32

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.
@@ -3163,28 +3163,45 @@ function getType(str) {
3163
3163
  function setDataType(arr) {
3164
3164
  return arr.join("|") || "any";
3165
3165
  }
3166
- function getParametersObj(cs) {
3167
- let arrs = cs.split(",");
3168
- return arrs.map((key) => {
3169
- key = key.trim();
3170
- let must = true;
3171
- let vs = key.split(":");
3172
- let name = vs[0].trim();
3173
- if (name.endsWith("?")) {
3174
- must = false;
3175
- name = name.substring(0, name.length - 1);
3166
+ function parseParamString(input) {
3167
+ return input.split(",").map((part) => {
3168
+ const trimmedPart = part.trim();
3169
+ const label = trimmedPart;
3170
+ const nameMatch = trimmedPart.match(/^([^:?]+)(\??):/);
3171
+ if (!nameMatch) return null;
3172
+ const name = nameMatch[1].trim();
3173
+ const must = !nameMatch[2];
3174
+ const typeDefStart = nameMatch[0].length;
3175
+ const typeDef = trimmedPart.substring(typeDefStart).trim();
3176
+ let bracketStack = [];
3177
+ let endIndex = -1;
3178
+ let t = "";
3179
+ let description = "";
3180
+ for (let i = 0; i < typeDef.length; i++) {
3181
+ const char = typeDef[i];
3182
+ if (char === "[" || char === "<" || char === "(") {
3183
+ bracketStack.push(char);
3184
+ } else if (char === "]" && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack[bracketStack.length - 1] === "<" || char === ")" && bracketStack[bracketStack.length - 1] === "(") {
3185
+ bracketStack.pop();
3186
+ }
3187
+ if (bracketStack.length === 0 && i > 0) {
3188
+ endIndex = i == 1 ? 0 : i;
3189
+ t = typeDef.substring(0, endIndex + 1).trim();
3190
+ description = typeDef.substring(endIndex + 1);
3191
+ break;
3192
+ }
3176
3193
  }
3177
- let t = vs[1] || "";
3178
3194
  let tarr = getSonType(getType(t));
3179
3195
  return {
3180
- label: key,
3196
+ name,
3181
3197
  prop: name,
3182
- must,
3183
3198
  type: tarr[0],
3184
3199
  dataType: tarr,
3185
- description: t.substring(t.lastIndexOf("]") + 1).trim()
3200
+ must,
3201
+ label,
3202
+ description
3186
3203
  };
3187
- });
3204
+ }).filter(Boolean);
3188
3205
  }
3189
3206
 
3190
3207
  // packages/components/use/code.ts
@@ -3233,12 +3250,13 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3233
3250
  tarr.push(" @" + name + '="' + strs + '"');
3234
3251
  const sp = getSpecObjs(es, name) || {};
3235
3252
  const s = sp.selectable || "";
3236
- const css = getParametersObj(s);
3253
+ const css = parseParamString(s);
3254
+ console.log(css);
3237
3255
  const cs = getParameStr(css);
3238
3256
  sarr.push(`// ${sp.description} ${sp.name}: (${sp.selectable})`);
3239
3257
  sarr.push("function " + strs + "(" + cs + ") {");
3240
3258
  css.forEach((o) => {
3241
- const name2 = o.prop || "arr";
3259
+ const name2 = o.name || "arr";
3242
3260
  sarr.push(" console.log('" + o.label + "', " + name2 + ")");
3243
3261
  });
3244
3262
  sarr.push("}");
@@ -3292,11 +3310,11 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3292
3310
  `// ${s.description} ${s.name}\uFF1A(${s.selectable}) ${s.type}`
3293
3311
  );
3294
3312
  const m = v.name + "Value";
3295
- const css = getParametersObj(s?.selectable || "");
3313
+ const css = parseParamString(s?.selectable || "");
3296
3314
  const cs = [];
3297
3315
  const ps2 = v.params || [];
3298
3316
  css.forEach((c, index) => {
3299
- const prop = c.prop;
3317
+ const prop = c.name;
3300
3318
  if (prop) {
3301
3319
  const key = prop + v.name;
3302
3320
  const val = ps2[index];
@@ -3148,28 +3148,45 @@ function getType(str) {
3148
3148
  function setDataType(arr) {
3149
3149
  return arr.join("|") || "any";
3150
3150
  }
3151
- function getParametersObj(cs) {
3152
- let arrs = cs.split(",");
3153
- return arrs.map((key) => {
3154
- key = key.trim();
3155
- let must = true;
3156
- let vs = key.split(":");
3157
- let name = vs[0].trim();
3158
- if (name.endsWith("?")) {
3159
- must = false;
3160
- name = name.substring(0, name.length - 1);
3151
+ function parseParamString(input) {
3152
+ return input.split(",").map((part) => {
3153
+ const trimmedPart = part.trim();
3154
+ const label = trimmedPart;
3155
+ const nameMatch = trimmedPart.match(/^([^:?]+)(\??):/);
3156
+ if (!nameMatch) return null;
3157
+ const name = nameMatch[1].trim();
3158
+ const must = !nameMatch[2];
3159
+ const typeDefStart = nameMatch[0].length;
3160
+ const typeDef = trimmedPart.substring(typeDefStart).trim();
3161
+ let bracketStack = [];
3162
+ let endIndex = -1;
3163
+ let t = "";
3164
+ let description = "";
3165
+ for (let i = 0; i < typeDef.length; i++) {
3166
+ const char = typeDef[i];
3167
+ if (char === "[" || char === "<" || char === "(") {
3168
+ bracketStack.push(char);
3169
+ } else if (char === "]" && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack[bracketStack.length - 1] === "<" || char === ")" && bracketStack[bracketStack.length - 1] === "(") {
3170
+ bracketStack.pop();
3171
+ }
3172
+ if (bracketStack.length === 0 && i > 0) {
3173
+ endIndex = i == 1 ? 0 : i;
3174
+ t = typeDef.substring(0, endIndex + 1).trim();
3175
+ description = typeDef.substring(endIndex + 1);
3176
+ break;
3177
+ }
3161
3178
  }
3162
- let t = vs[1] || "";
3163
3179
  let tarr = getSonType(getType(t));
3164
3180
  return {
3165
- label: key,
3181
+ name,
3166
3182
  prop: name,
3167
- must,
3168
3183
  type: tarr[0],
3169
3184
  dataType: tarr,
3170
- description: t.substring(t.lastIndexOf("]") + 1).trim()
3185
+ must,
3186
+ label,
3187
+ description
3171
3188
  };
3172
- });
3189
+ }).filter(Boolean);
3173
3190
  }
3174
3191
 
3175
3192
  // packages/components/use/code.ts
@@ -3218,12 +3235,13 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3218
3235
  tarr.push(" @" + name + '="' + strs + '"');
3219
3236
  const sp = getSpecObjs(es, name) || {};
3220
3237
  const s = sp.selectable || "";
3221
- const css = getParametersObj(s);
3238
+ const css = parseParamString(s);
3239
+ console.log(css);
3222
3240
  const cs = getParameStr(css);
3223
3241
  sarr.push(`// ${sp.description} ${sp.name}: (${sp.selectable})`);
3224
3242
  sarr.push("function " + strs + "(" + cs + ") {");
3225
3243
  css.forEach((o) => {
3226
- const name2 = o.prop || "arr";
3244
+ const name2 = o.name || "arr";
3227
3245
  sarr.push(" console.log('" + o.label + "', " + name2 + ")");
3228
3246
  });
3229
3247
  sarr.push("}");
@@ -3277,11 +3295,11 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3277
3295
  `// ${s.description} ${s.name}\uFF1A(${s.selectable}) ${s.type}`
3278
3296
  );
3279
3297
  const m = v.name + "Value";
3280
- const css = getParametersObj(s?.selectable || "");
3298
+ const css = parseParamString(s?.selectable || "");
3281
3299
  const cs = [];
3282
3300
  const ps2 = v.params || [];
3283
3301
  css.forEach((c, index) => {
3284
- const prop = c.prop;
3302
+ const prop = c.name;
3285
3303
  if (prop) {
3286
3304
  const key = prop + v.name;
3287
3305
  const val = ps2[index];
@@ -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 B=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const C=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const V=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const g=require("./util.cjs"),S=require("../../utils/props.cjs"),H=require("@fangzhongya/utils/basic/string/toFunction"),J=["class"];function j(s,t){return s.filter(e=>e.name==t)[0]}function N(s){return s.map(t=>(t.prop||"...arr")+":"+g.setDataType(t.dataType)).join(",")}function A(s,t,e,o,m,$){const f=[],n=[];let b=!0;const L=S.getPropsValue(t.propss||[]),P=S.getEmitsValue(t.emitss||[]),x=S.getExposeValue(t.exposes||[]),z=S.getSlotValue(t.slots||[]);Object.keys(e).forEach(r=>{let p=e[r];if(/^on[A-Z]/.test(r)&&typeof p=="function"){let i=r.substring(2);const c=r.split(":");let a;if(c.length>1?(a=c[0]+c.slice(1).map(l=>V.firstUpper(l)).join(""),i=C.firstLower(i)):(a=c[0],i=B.humpToLine(i)),c.includes("-")){let l=a.split("-");l=l.map((h,T)=>T!=0?V.firstUpper(h):h),a=l.join("")}f.push(" @"+i+'="'+a+'"');const u=j(P,i)||{},y=u.selectable||"",q=g.getParametersObj(y),d=N(q);n.push(`// ${u.description} ${u.name}: (${u.selectable})`),n.push("function "+a+"("+d+") {"),q.forEach(l=>{const h=l.prop||"arr";n.push(" console.log('"+l.label+"', "+h+")")}),n.push("}")}else{let i=r;J.includes(r)&&(i=r+"1"),f.push(" :"+r+'="'+i+'"');const c=j(L,r)||{},a=D(c);if(n.push(`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`),typeof p=="function")n.push("const "+r+" = "+F(p,r,m));else if(b&&(b=!1,n.unshift("import { ref } from 'vue';")),typeof p>"u"){const u=g.getTypeValue(a.dataType);u=="()=>{}"?n.push("const "+i+" = "+u+";"):n.push("const "+i+" = ref("+(u==="undefined"?"":u)+");")}else{let u=E(p,r,m);n.push("const "+i+" = ref("+u+");")}}});const O=Object.values($||{});O.length>0&&(b&&(b=!1,n.unshift("import { ref } from 'vue';")),f.unshift(' ref="refDom"'),n.push("const refDom = ref()"),O.forEach(r=>{const p=j(x,r.name)||{};n.push(`// ${p.description} ${p.name}:(${p.selectable}) ${p.type}`);const i=r.name+"Value",c=g.getParametersObj(p?.selectable||""),a=[],u=r.params||[];c.forEach((y,q)=>{const d=y.prop;if(d){const l=d+r.name,h=u[q];if(n.push(`// ${y.label}`),typeof h=="function")n.push("const "+l+" = "+F(h,d,r.text));else if(typeof h>"u")n.push("const "+l+" = "+g.getTypeValue(y.dataType)+";");else{let T=E(h,d,r.text);n.push("const "+l+" = "+T+";")}a.push(l)}}),r.type==="function"?n.push(`const ${i} = refDom.value?.${r.name}(${a.join(", ")})`):n.push(`const ${i} = refDom.value?.${r.name}`),n.push(`console.log('"${p.type}"', ${i})`)})),f.length>0&&f.unshift("");const U=M(o,z);return`<!--${s}-->
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const B=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const C=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const F=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const g=require("./util.cjs"),q=require("../../utils/props.cjs"),H=require("@fangzhongya/utils/basic/string/toFunction"),J=["class"];function j(s,t){return s.filter(e=>e.name==t)[0]}function N(s){return s.map(t=>(t.prop||"...arr")+":"+g.setDataType(t.dataType)).join(",")}function A(s,t,e,o,m,$){const f=[],n=[];let S=!0;const L=q.getPropsValue(t.propss||[]),P=q.getEmitsValue(t.emitss||[]),x=q.getExposeValue(t.exposes||[]),z=q.getSlotValue(t.slots||[]);Object.keys(e).forEach(r=>{let a=e[r];if(/^on[A-Z]/.test(r)&&typeof a=="function"){let i=r.substring(2);const c=r.split(":");let p;if(c.length>1?(p=c[0]+c.slice(1).map(l=>F.firstUpper(l)).join(""),i=C.firstLower(i)):(p=c[0],i=B.humpToLine(i)),c.includes("-")){let l=p.split("-");l=l.map((h,T)=>T!=0?F.firstUpper(h):h),p=l.join("")}f.push(" @"+i+'="'+p+'"');const u=j(P,i)||{},y=u.selectable||"",b=g.parseParamString(y);console.log(b);const d=N(b);n.push(`// ${u.description} ${u.name}: (${u.selectable})`),n.push("function "+p+"("+d+") {"),b.forEach(l=>{const h=l.name||"arr";n.push(" console.log('"+l.label+"', "+h+")")}),n.push("}")}else{let i=r;J.includes(r)&&(i=r+"1"),f.push(" :"+r+'="'+i+'"');const c=j(L,r)||{},p=D(c);if(n.push(`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`),typeof a=="function")n.push("const "+r+" = "+O(a,r,m));else if(S&&(S=!1,n.unshift("import { ref } from 'vue';")),typeof a>"u"){const u=g.getTypeValue(p.dataType);u=="()=>{}"?n.push("const "+i+" = "+u+";"):n.push("const "+i+" = ref("+(u==="undefined"?"":u)+");")}else{let u=E(a,r,m);n.push("const "+i+" = ref("+u+");")}}});const V=Object.values($||{});V.length>0&&(S&&(S=!1,n.unshift("import { ref } from 'vue';")),f.unshift(' ref="refDom"'),n.push("const refDom = ref()"),V.forEach(r=>{const a=j(x,r.name)||{};n.push(`// ${a.description} ${a.name}:(${a.selectable}) ${a.type}`);const i=r.name+"Value",c=g.parseParamString(a?.selectable||""),p=[],u=r.params||[];c.forEach((y,b)=>{const d=y.name;if(d){const l=d+r.name,h=u[b];if(n.push(`// ${y.label}`),typeof h=="function")n.push("const "+l+" = "+O(h,d,r.text));else if(typeof h>"u")n.push("const "+l+" = "+g.getTypeValue(y.dataType)+";");else{let T=E(h,d,r.text);n.push("const "+l+" = "+T+";")}p.push(l)}}),r.type==="function"?n.push(`const ${i} = refDom.value?.${r.name}(${p.join(", ")})`):n.push(`const ${i} = refDom.value?.${r.name}`),n.push(`console.log('"${a.type}"', ${i})`)})),f.length>0&&f.unshift("");const U=M(o,z);return`<!--${s}-->
2
2
  <template>
3
3
  <div>
4
4
  <${s}${f.join(`
@@ -14,6 +14,6 @@ ${n.join(`
14
14
  `}function M(s={},t){const e=[];return Object.keys(s).forEach(o=>{const m=j(t,o)||{},$=s[o];if($){const f=` <!-- ${m.description} ${m.name}:(${m.selectable}) -->
15
15
  <template #${o}="scope">
16
16
  ${g.vueFormat($," ")}
17
- </template>`;e.push(f)}}),e&&e.length>0&&e.unshift(""),e}function F(s,t,e){const o=e?e[t]:"";return o||w(s.toString())}function w(s){const t=H.getFunctionFormat(g.prettierFormat(s));if(t){let e=`{
17
+ </template>`;e.push(f)}}),e&&e.length>0&&e.unshift(""),e}function O(s,t,e){const o=e?e[t]:"";return o||w(s.toString())}function w(s){const t=H.getFunctionFormat(g.prettierFormat(s));if(t){let e=`{
18
18
  ${g.vueFormat(g.getFunBody(t.body)," ")}
19
19
  }`;return`function (${t.param}) ${e}`}else return"undefined"}function Z(s){const t=s.trim();return/^\(/.test(t)?w(t):JSON.stringify(s)}function E(s,t,e){const o=e?e[t]:"";return o||(typeof s=="string"?Z(s+""):JSON.stringify(s))}function D(s){let t=G(s?.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const o=e;let m=(s?.selectable||"").trim(),$=[];return m&&e!="boolean"&&(m.split(",").forEach(f=>{if(f){let n=f.split(":");$.push({label:f,prop:n[0].trim()})}}),e=="function"?e="function":e=="array"?e="choice":e="select"),{arr:$,zdtype:o,type:e,dataType:t}}function G(s){let t=[];return(s||"").trim().toLowerCase().split(",").forEach(o=>{o=o.trim(),o&&t.push(o)}),[...new Set(t)].sort()}exports.getHmtl=A;exports.getSpecType=D;exports.setValStringify=E;
@@ -6,22 +6,22 @@ import "@fangzhongya/utils/basic/string/appearNum";
6
6
  import { firstLower as N } 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 V } from "@fangzhongya/utils/basic/string/firstUpper";
10
10
  import "@fangzhongya/utils/urls/getSuffix";
11
11
  import "@fangzhongya/utils/basic/array/replaceAfter";
12
- import { getParametersObj as V, getTypeValue as F, setDataType as A, vueFormat as w, prettierFormat as H, getFunBody as U } from "./util.js";
12
+ import { parseParamString as F, getTypeValue as O, setDataType as A, vueFormat as w, prettierFormat as H, getFunBody as U } from "./util.js";
13
13
  import { getPropsValue as Z, getEmitsValue as q, getExposeValue as G, getSlotValue as I } from "../../utils/props.js";
14
14
  import { getFunctionFormat as K } from "@fangzhongya/utils/basic/string/toFunction";
15
15
  const M = ["class"];
16
- function j(s, e) {
16
+ function S(s, e) {
17
17
  return s.filter((t) => t.name == e)[0];
18
18
  }
19
19
  function Q(s) {
20
20
  return s.map((e) => (e.prop || "...arr") + ":" + A(e.dataType)).join(",");
21
21
  }
22
22
  function at(s, e, t, r, m, $) {
23
- const f = [], n = [];
24
- let y = !0;
23
+ const p = [], n = [];
24
+ let b = !0;
25
25
  const z = Z(e.propss || []), L = q(e.emitss || []), P = G(e.exposes || []), B = I(e.slots || []);
26
26
  Object.keys(t).forEach((o) => {
27
27
  let u = t[o];
@@ -29,28 +29,30 @@ function at(s, e, t, r, m, $) {
29
29
  let i = o.substring(2);
30
30
  const c = o.split(":");
31
31
  let a;
32
- if (c.length > 1 ? (a = c[0] + c.slice(1).map((p) => O(p)).join(""), i = N(i)) : (a = c[0], i = J(i)), c.includes("-")) {
33
- let p = a.split("-");
34
- p = p.map((h, S) => S != 0 ? O(h) : h), a = p.join("");
32
+ if (c.length > 1 ? (a = c[0] + c.slice(1).map((f) => V(f)).join(""), i = N(i)) : (a = c[0], i = J(i)), c.includes("-")) {
33
+ let f = a.split("-");
34
+ f = f.map((h, j) => j != 0 ? V(h) : h), a = f.join("");
35
35
  }
36
- f.push(" @" + i + '="' + a + '"');
37
- const l = j(L, i) || {}, d = l.selectable || "", b = V(d), g = Q(b);
38
- n.push(`// ${l.description} ${l.name}: (${l.selectable})`), n.push("function " + a + "(" + g + ") {"), b.forEach((p) => {
39
- const h = p.prop || "arr";
40
- n.push(" console.log('" + p.label + "', " + h + ")");
36
+ p.push(" @" + i + '="' + a + '"');
37
+ const l = S(L, i) || {}, d = l.selectable || "", y = F(d);
38
+ console.log(y);
39
+ const g = Q(y);
40
+ n.push(`// ${l.description} ${l.name}: (${l.selectable})`), n.push("function " + a + "(" + g + ") {"), y.forEach((f) => {
41
+ const h = f.name || "arr";
42
+ n.push(" console.log('" + f.label + "', " + h + ")");
41
43
  }), n.push("}");
42
44
  } else {
43
45
  let i = o;
44
- M.includes(o) && (i = o + "1"), f.push(" :" + o + '="' + i + '"');
45
- const c = j(z, o) || {}, a = X(c);
46
+ M.includes(o) && (i = o + "1"), p.push(" :" + o + '="' + i + '"');
47
+ const c = S(z, o) || {}, a = X(c);
46
48
  if (n.push(
47
49
  `// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`
48
50
  ), typeof u == "function")
49
51
  n.push(
50
52
  "const " + o + " = " + T(u, o, m)
51
53
  );
52
- else if (y && (y = !1, n.unshift("import { ref } from 'vue';")), typeof u > "u") {
53
- const l = F(a.dataType);
54
+ else if (b && (b = !1, n.unshift("import { ref } from 'vue';")), typeof u > "u") {
55
+ const l = O(a.dataType);
54
56
  l == "()=>{}" ? n.push("const " + i + " = " + l + ";") : n.push(
55
57
  "const " + i + " = ref(" + (l === "undefined" ? "" : l) + ");"
56
58
  );
@@ -61,39 +63,39 @@ function at(s, e, t, r, m, $) {
61
63
  }
62
64
  });
63
65
  const E = Object.values($ || {});
64
- E.length > 0 && (y && (y = !1, n.unshift("import { ref } from 'vue';")), f.unshift(' ref="refDom"'), n.push("const refDom = ref()"), E.forEach((o) => {
65
- const u = j(P, o.name) || {};
66
+ E.length > 0 && (b && (b = !1, n.unshift("import { ref } from 'vue';")), p.unshift(' ref="refDom"'), n.push("const refDom = ref()"), E.forEach((o) => {
67
+ const u = S(P, o.name) || {};
66
68
  n.push(
67
69
  `// ${u.description} ${u.name}:(${u.selectable}) ${u.type}`
68
70
  );
69
- const i = o.name + "Value", c = V(u?.selectable || ""), a = [], l = o.params || [];
70
- c.forEach((d, b) => {
71
- const g = d.prop;
71
+ const i = o.name + "Value", c = F(u?.selectable || ""), a = [], l = o.params || [];
72
+ c.forEach((d, y) => {
73
+ const g = d.name;
72
74
  if (g) {
73
- const p = g + o.name, h = l[b];
75
+ const f = g + o.name, h = l[y];
74
76
  if (n.push(`// ${d.label}`), typeof h == "function")
75
77
  n.push(
76
- "const " + p + " = " + T(h, g, o.text)
78
+ "const " + f + " = " + T(h, g, o.text)
77
79
  );
78
80
  else if (typeof h > "u")
79
81
  n.push(
80
- "const " + p + " = " + F(d.dataType) + ";"
82
+ "const " + f + " = " + O(d.dataType) + ";"
81
83
  );
82
84
  else {
83
- let S = D(h, g, o.text);
84
- n.push("const " + p + " = " + S + ";");
85
+ let j = D(h, g, o.text);
86
+ n.push("const " + f + " = " + j + ";");
85
87
  }
86
- a.push(p);
88
+ a.push(f);
87
89
  }
88
90
  }), o.type === "function" ? n.push(
89
91
  `const ${i} = refDom.value?.${o.name}(${a.join(", ")})`
90
92
  ) : n.push(`const ${i} = refDom.value?.${o.name}`), n.push(`console.log('"${u.type}"', ${i})`);
91
- })), f.length > 0 && f.unshift("");
93
+ })), p.length > 0 && p.unshift("");
92
94
  const C = R(r, B);
93
95
  return `<!--${s}-->
94
96
  <template>
95
97
  <div>
96
- <${s}${f.join(`
98
+ <${s}${p.join(`
97
99
  `)}>${C.join(`
98
100
  `)}
99
101
  </${s}>
@@ -108,13 +110,13 @@ ${n.join(`
108
110
  function R(s = {}, e) {
109
111
  const t = [];
110
112
  return Object.keys(s).forEach((r) => {
111
- const m = j(e, r) || {}, $ = s[r];
113
+ const m = S(e, r) || {}, $ = s[r];
112
114
  if ($) {
113
- const f = ` <!-- ${m.description} ${m.name}:(${m.selectable}) -->
115
+ const p = ` <!-- ${m.description} ${m.name}:(${m.selectable}) -->
114
116
  <template #${r}="scope">
115
117
  ${w($, " ")}
116
118
  </template>`;
117
- t.push(f);
119
+ t.push(p);
118
120
  }
119
121
  }), t && t.length > 0 && t.unshift(""), t;
120
122
  }
@@ -145,11 +147,11 @@ function X(s) {
145
147
  e.length == 1 && (t = e[0].split("<")[0]);
146
148
  const r = t;
147
149
  let m = (s?.selectable || "").trim(), $ = [];
148
- return m && t != "boolean" && (m.split(",").forEach((f) => {
149
- if (f) {
150
- let n = f.split(":");
150
+ return m && t != "boolean" && (m.split(",").forEach((p) => {
151
+ if (p) {
152
+ let n = p.split(":");
151
153
  $.push({
152
- label: f,
154
+ label: p,
153
155
  prop: n[0].trim()
154
156
  });
155
157
  }
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),d=require("../../util.cjs"),g=require("../index.vue.cjs");;/* empty css */const y={class:"expose"},h={class:"expose-label"},x={class:"expose-return"},b=e.defineComponent({__name:"index",props:{getRef:{type:Function},name:String,value:{type:Object}},emits:["change"],setup(p,{emit:v}){const a=p,m=v,c=e.ref(""),o=e.ref(""),i=e.ref([]),f=e.computed(()=>{i.value=[];const t=a.value;if(t&&t.name){let l=(t.selectable+"").trim();if(c.value=t.name+": "+t.description+" 入参=("+l+") 返回值: "+t.type,l){let n=d.getParametersObj(l);return n.forEach(r=>{i.value.push(r.prop)}),n}}return[]});function _(t,l){let n=a.getRef?a.getRef():void 0,r=a.value?.name;if(r){let u=i.value.map(s=>t[s]);if(n&&n[r]){if(typeof n[r]=="function"){let s=n[r](...u);o.value=JSON.stringify(s)}else{let s=n[r];s instanceof HTMLDivElement?o.value=s.outerHTML:o.value=JSON.stringify(s)}m("change",r,u,typeof n[r],l)}}else console.log("请选择方法")}return(t,l)=>(e.openBlock(),e.createElementBlock("div",y,[e.createElementVNode("div",h,e.toDisplayString(c.value||"请选择方法"),1),e.createVNode(g,{list:f.value,name:a.name,queryName:"调用",onQuery:_},null,8,["list","name"]),e.createElementVNode("div",x,e.toDisplayString(a.value?.type)+"返回值:"+e.toDisplayString(o.value),1)]))}});module.exports=b;
1
+ "use strict";const e=require("vue"),d=require("../../util.cjs"),g=require("../index.vue.cjs");;/* empty css */const y={class:"expose"},h={class:"expose-label"},x={class:"expose-return"},S=e.defineComponent({__name:"index",props:{getRef:{type:Function},name:String,value:{type:Object}},emits:["change"],setup(p,{emit:m}){const s=p,v=m,c=e.ref(""),i=e.ref(""),o=e.ref([]),f=e.computed(()=>{o.value=[];const n=s.value;if(n&&n.name){let l=(n.selectable+"").trim();if(c.value=n.name+": "+n.description+" 入参=("+l+") 返回值: "+n.type,l){let r=d.parseParamString(l);return r.forEach(t=>{t.prop=t.name,o.value.push(t.name)}),r}}return[]});function _(n,l){let r=s.getRef?s.getRef():void 0,t=s.value?.name;if(t){let u=o.value.map(a=>n[a]);if(r&&r[t]){if(typeof r[t]=="function"){let a=r[t](...u);i.value=JSON.stringify(a)}else{let a=r[t];a instanceof HTMLDivElement?i.value=a.outerHTML:i.value=JSON.stringify(a)}v("change",t,u,typeof r[t],l)}}else console.log("请选择方法")}return(n,l)=>(e.openBlock(),e.createElementBlock("div",y,[e.createElementVNode("div",h,e.toDisplayString(c.value||"请选择方法"),1),e.createVNode(g,{list:f.value,name:s.name,queryName:"调用",onQuery:_},null,8,["list","name"]),e.createElementVNode("div",x,e.toDisplayString(s.value?.type)+"返回值:"+e.toDisplayString(i.value),1)]))}});module.exports=S;
@@ -1,8 +1,8 @@
1
- import { defineComponent as y, ref as i, computed as h, createElementBlock as b, openBlock as x, createElementVNode as p, createVNode as N, toDisplayString as c } from "vue";
2
- import { getParametersObj as E } from "../../util.js";
3
- import O from "../index.vue.js";
1
+ import { defineComponent as y, ref as i, computed as h, createElementBlock as x, openBlock as b, createElementVNode as p, createVNode as N, toDisplayString as c } from "vue";
2
+ import { parseParamString as S } from "../../util.js";
3
+ import E from "../index.vue.js";
4
4
  /* empty css */
5
- const S = { class: "expose" }, j = { class: "expose-label" }, R = { class: "expose-return" }, J = /* @__PURE__ */ y({
5
+ const O = { class: "expose" }, R = { class: "expose-label" }, j = { class: "expose-return" }, J = /* @__PURE__ */ y({
6
6
  __name: "index",
7
7
  props: {
8
8
  getRef: {
@@ -15,46 +15,46 @@ const S = { class: "expose" }, j = { class: "expose-label" }, R = { class: "expo
15
15
  },
16
16
  emits: ["change"],
17
17
  setup(f, { emit: v }) {
18
- const a = f, d = v, u = i(""), r = i(""), s = i([]), _ = h(() => {
18
+ const o = f, d = v, m = i(""), r = i(""), s = i([]), _ = h(() => {
19
19
  s.value = [];
20
- const e = a.value;
21
- if (e && e.name) {
22
- let l = (e.selectable + "").trim();
23
- if (u.value = e.name + ": " + e.description + " 入参=(" + l + ") 返回值: " + e.type, l) {
24
- let t = E(l);
25
- return t.forEach((n) => {
26
- s.value.push(n.prop);
27
- }), t;
20
+ const t = o.value;
21
+ if (t && t.name) {
22
+ let l = (t.selectable + "").trim();
23
+ if (m.value = t.name + ": " + t.description + " 入参=(" + l + ") 返回值: " + t.type, l) {
24
+ let n = S(l);
25
+ return n.forEach((e) => {
26
+ e.prop = e.name, s.value.push(e.name);
27
+ }), n;
28
28
  }
29
29
  }
30
30
  return [];
31
31
  });
32
- function g(e, l) {
33
- let t = a.getRef ? a.getRef() : void 0, n = a.value?.name;
34
- if (n) {
35
- let m = s.value.map((o) => e[o]);
36
- if (t && t[n]) {
37
- if (typeof t[n] == "function") {
38
- let o = t[n](...m);
39
- r.value = JSON.stringify(o);
32
+ function g(t, l) {
33
+ let n = o.getRef ? o.getRef() : void 0, e = o.value?.name;
34
+ if (e) {
35
+ let u = s.value.map((a) => t[a]);
36
+ if (n && n[e]) {
37
+ if (typeof n[e] == "function") {
38
+ let a = n[e](...u);
39
+ r.value = JSON.stringify(a);
40
40
  } else {
41
- let o = t[n];
42
- o instanceof HTMLDivElement ? r.value = o.outerHTML : r.value = JSON.stringify(o);
41
+ let a = n[e];
42
+ a instanceof HTMLDivElement ? r.value = a.outerHTML : r.value = JSON.stringify(a);
43
43
  }
44
- d("change", n, m, typeof t[n], l);
44
+ d("change", e, u, typeof n[e], l);
45
45
  }
46
46
  } else
47
47
  console.log("请选择方法");
48
48
  }
49
- return (e, l) => (x(), b("div", S, [
50
- p("div", j, c(u.value || "请选择方法"), 1),
51
- N(O, {
49
+ return (t, l) => (b(), x("div", O, [
50
+ p("div", R, c(m.value || "请选择方法"), 1),
51
+ N(E, {
52
52
  list: _.value,
53
- name: a.name,
53
+ name: o.name,
54
54
  queryName: "调用",
55
55
  onQuery: g
56
56
  }, null, 8, ["list", "name"]),
57
- p("div", R, c(a.value?.type) + "返回值:" + c(r.value), 1)
57
+ p("div", j, c(o.value?.type) + "返回值:" + c(r.value), 1)
58
58
  ]));
59
59
  }
60
60
  });
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("@fangzhongya/utils/basic/string/toFunction"),m=require("@fangzhongya/utils/basic/string/firstLower");function l(e){return e.replace(/\;(\s|\n\r)*$/,"")}function d(e){return e="let a = "+e,l(e).replace(/^let a = /,"")}function j(e){return l(e)}function T(e,t=""){let r=(e+"").trim().split(/\n/);return r=r.map(n=>t+n),r.join(`
2
- `)}function f(e=""){e=e.trim();let t=`[\\s|\\n|\\r]*\\{((.|
3
- |\r)+?)\\}[\\s|\\n|\\r]*`,n=new RegExp("^"+t+"$").exec(e);return n&&n.length>0?f(n[1]):e}const F=["Boolean","Any","String","Number","Array","Object","Function"];function c(e){return F.includes(e)?m.firstLower(e):e}function $(e){let r=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(r&&r.length>0)return{own:c(r[1]),son:r[2]}}function p(e,t){let r=$(e);r?(t.push(r.own),r.son&&p(r.son,t)):t.push(e)}function s(e){e instanceof Array&&(e=e[0]);const t=[];return e&&p(e,t),t}function g(e){const t=Object.prototype.toString.call(e);let n=/^\[[O|o]bject (.*)\]$/.exec(t),i=typeof e;return n&&n.length>0&&(i=n[1].toLowerCase()),i}function O(e,t){const r=g(e),n=s(t)[0];return n&&n!="any"?r==n:!0}function h(e){if(typeof e=="string"){let t=!1;return(/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e))&&(t=!0),t&&(e=e.substring(1,e.length-1)),e+""}else return typeof e=="object"&&e?e.toString():typeof e>"u"||typeof e=="object"&&!e?"":e+""}function v(e){e=(e+"").replace(/^(\s|\n|r)*/,"").replace(/(\s|\n|r)*$/,"");let t="";return/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e)?t="string":/^\[(.|\n|\r)*\]$/.test(e)?t="array":/^\{(.|\n|\r)*\}$/.test(e)?t="object":/^[0-9]*$/.test(e)?t="number":e==="true"||e==="false"?t="boolean":e=="undefined"?t="undefined":e=="null"?t="null":e&&(t="string"),t}function y(e){switch((e[0]||"any").toLowerCase()){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":let r=y(e.splice(1));return r=r=="undefined"?"":r,`[${r}]`;case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function w(e){let t=[];if(e)if(e=(e+"").trim(),e.startsWith("["))e=e.substring(1,e.lastIndexOf("]")),t=e.split(",");else{let n=/^\<([a-z|\<|\>|\|]+)\>/.exec(e);n&&n.length>0?t=n[1].split("|"):t=["any"]}else t=["any"];return t.map(r=>c(r))}function S(e){return e.join("|")||"any"}function x(e){return e.split(",").map(r=>{r=r.trim();let n=!0,i=r.split(":"),u=i[0].trim();u.endsWith("?")&&(n=!1,u=u.substring(0,u.length-1));let o=i[1]||"",a=s(w(o));return{label:r,prop:u,must:n,type:a[0],dataType:a,description:o.substring(o.lastIndexOf("]")+1).trim()}})}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>b.getFunctionFormat});exports.getFunBody=f;exports.getObjType=g;exports.getParametersObj=x;exports.getSonType=s;exports.getString=h;exports.getTypeValue=y;exports.isDefaultType=v;exports.isTypeEqual=O;exports.prettierArrFormat=j;exports.prettierFormat=l;exports.prettierObjFormat=d;exports.setDataType=S;exports.vueFormat=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@fangzhongya/utils/basic/string/toFunction"),O=require("@fangzhongya/utils/basic/string/firstLower");function c(e){return e.replace(/\;(\s|\n\r)*$/,"")}function v(e){return e="let a = "+e,c(e).replace(/^let a = /,"")}function w(e){return c(e)}function x(e,t=""){let n=(e+"").trim().split(/\n/);return n=n.map(r=>t+r),n.join(`
2
+ `)}function b(e=""){e=e.trim();let t=`[\\s|\\n|\\r]*\\{((.|
3
+ |\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+t+"$").exec(e);return r&&r.length>0?b(r[1]):e}const A=["Boolean","Any","String","Number","Array","Object","Function"];function d(e){return A.includes(e)?O.firstLower(e):e}function D(e){let n=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(n&&n.length>0)return{own:d(n[1]),son:n[2]}}function h(e,t){let n=D(e);n?(t.push(n.own),n.son&&h(n.son,t)):t.push(e)}function f(e){e instanceof Array&&(e=e[0]);const t=[];return e&&h(e,t),t}function T(e){const t=Object.prototype.toString.call(e);let r=/^\[[O|o]bject (.*)\]$/.exec(t),o=typeof e;return r&&r.length>0&&(o=r[1].toLowerCase()),o}function P(e,t){const n=T(e),r=f(t)[0];return r&&r!="any"?n==r:!0}function q(e){if(typeof e=="string"){let t=!1;return(/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e))&&(t=!0),t&&(e=e.substring(1,e.length-1)),e+""}else return typeof e=="object"&&e?e.toString():typeof e>"u"||typeof e=="object"&&!e?"":e+""}function B(e){e=(e+"").replace(/^(\s|\n|r)*/,"").replace(/(\s|\n|r)*$/,"");let t="";return/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e)?t="string":/^\[(.|\n|\r)*\]$/.test(e)?t="array":/^\{(.|\n|\r)*\}$/.test(e)?t="object":/^[0-9]*$/.test(e)?t="number":e==="true"||e==="false"?t="boolean":e=="undefined"?t="undefined":e=="null"?t="null":e&&(t="string"),t}function j(e){switch((e[0]||"any").toLowerCase()){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":let n=j(e.splice(1));return n=n=="undefined"?"":n,`[${n}]`;case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function E(e){let t=[];if(e)if(e=(e+"").trim(),e.startsWith("["))e=e.substring(1,e.lastIndexOf("]")),t=e.split(",");else{let r=/^\<([a-z|\<|\>|\|]+)\>/.exec(e);r&&r.length>0?t=r[1].split("|"):t=["any"]}else t=["any"];return t.map(n=>d(n))}function L(e){return e.join("|")||"any"}function k(e){return e.split(",").map(t=>{const n=t.trim(),r=n,o=n.match(/^([^:?]+)(\??):/);if(!o)return null;const p=o[1].trim(),F=!o[2],$=o[0].length,s=n.substring($).trim();let i=[],a=-1,g="",y="";for(let u=0;u<s.length;u++){const l=s[u];if(l==="["||l==="<"||l==="("?i.push(l):(l==="]"&&i[i.length-1]==="["||l===">"&&i[i.length-1]==="<"||l===")"&&i[i.length-1]==="(")&&i.pop(),i.length===0&&u>0){a=u==1?0:u,g=s.substring(0,a+1).trim(),y=s.substring(a+1);break}}let m=f(E(g));return{name:p,prop:p,type:m[0],dataType:m,must:F,label:r,description:y}}).filter(Boolean)}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>S.getFunctionFormat});exports.getFunBody=b;exports.getObjType=T;exports.getSonType=f;exports.getString=q;exports.getTypeValue=j;exports.isDefaultType=B;exports.isTypeEqual=P;exports.parseParamString=k;exports.prettierArrFormat=w;exports.prettierFormat=c;exports.prettierObjFormat=v;exports.setDataType=L;exports.vueFormat=x;
@@ -45,3 +45,12 @@ export declare function getParametersObj(cs: string): {
45
45
  dataType: string[];
46
46
  description: string;
47
47
  }[];
48
+ export declare function parseParamString(input: string): Array<{
49
+ name: string;
50
+ prop: string;
51
+ type: string;
52
+ dataType: string[];
53
+ must: boolean;
54
+ label: string;
55
+ description: string;
56
+ }>;
@@ -1,26 +1,26 @@
1
- import { getFunctionFormat as L } from "@fangzhongya/utils/basic/string/toFunction";
2
- import { firstLower as p } from "@fangzhongya/utils/basic/string/firstLower";
3
- function s(e) {
1
+ import { getFunctionFormat as R } from "@fangzhongya/utils/basic/string/toFunction";
2
+ import { firstLower as j } from "@fangzhongya/utils/basic/string/firstLower";
3
+ function y(e) {
4
4
  return e.replace(/\;(\s|\n\r)*$/, "");
5
5
  }
6
- function h(e) {
7
- return e = "let a = " + e, s(e).replace(/^let a = /, "");
6
+ function A(e) {
7
+ return e = "let a = " + e, y(e).replace(/^let a = /, "");
8
8
  }
9
- function T(e) {
10
- return s(e);
9
+ function D(e) {
10
+ return y(e);
11
11
  }
12
- function x(e, t = "") {
12
+ function k(e, t = "") {
13
13
  let n = (e + "").trim().split(/\n/);
14
14
  return n = n.map((r) => t + r), n.join(`
15
15
  `);
16
16
  }
17
- function g(e = "") {
17
+ function T(e = "") {
18
18
  e = e.trim();
19
19
  let t = `[\\s|\\n|\\r]*\\{((.|
20
20
  |\r)+?)\\}[\\s|\\n|\\r]*`, r = new RegExp("^" + t + "$").exec(e);
21
- return r && r.length > 0 ? g(r[1]) : e;
21
+ return r && r.length > 0 ? T(r[1]) : e;
22
22
  }
23
- const y = [
23
+ const x = [
24
24
  "Boolean",
25
25
  "Any",
26
26
  "String",
@@ -29,47 +29,47 @@ const y = [
29
29
  "Object",
30
30
  "Function"
31
31
  ];
32
- function f(e) {
33
- return y.includes(e) ? p(e) : e;
34
- }
35
32
  function m(e) {
33
+ return x.includes(e) ? j(e) : e;
34
+ }
35
+ function w(e) {
36
36
  let n = new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);
37
37
  if (n && n.length > 0)
38
38
  return {
39
- own: f(n[1]),
39
+ own: m(n[1]),
40
40
  son: n[2]
41
41
  };
42
42
  }
43
- function a(e, t) {
44
- let n = m(e);
45
- n ? (t.push(n.own), n.son && a(n.son, t)) : t.push(e);
43
+ function b(e, t) {
44
+ let n = w(e);
45
+ n ? (t.push(n.own), n.son && b(n.son, t)) : t.push(e);
46
46
  }
47
- function c(e) {
47
+ function d(e) {
48
48
  e instanceof Array && (e = e[0]);
49
49
  const t = [];
50
- return e && a(e, t), t;
50
+ return e && b(e, t), t;
51
51
  }
52
- function b(e) {
52
+ function F(e) {
53
53
  const t = Object.prototype.toString.call(e);
54
- let r = /^\[[O|o]bject (.*)\]$/.exec(t), i = typeof e;
55
- return r && r.length > 0 && (i = r[1].toLowerCase()), i;
54
+ let r = /^\[[O|o]bject (.*)\]$/.exec(t), o = typeof e;
55
+ return r && r.length > 0 && (o = r[1].toLowerCase()), o;
56
56
  }
57
- function v(e, t) {
58
- const n = b(e), r = c(t)[0];
57
+ function B(e, t) {
58
+ const n = F(e), r = d(t)[0];
59
59
  return r && r != "any" ? n == r : !0;
60
60
  }
61
- function w(e) {
61
+ function E(e) {
62
62
  if (typeof e == "string") {
63
63
  let t = !1;
64
64
  return (/^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e)) && (t = !0), t && (e = e.substring(1, e.length - 1)), e + "";
65
65
  } else return typeof e == "object" && e ? e.toString() : typeof e > "u" || typeof e == "object" && !e ? "" : e + "";
66
66
  }
67
- function F(e) {
67
+ function L(e) {
68
68
  e = (e + "").replace(/^(\s|\n|r)*/, "").replace(/(\s|\n|r)*$/, "");
69
69
  let t = "";
70
70
  return /^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e) ? t = "string" : /^\[(.|\n|\r)*\]$/.test(e) ? t = "array" : /^\{(.|\n|\r)*\}$/.test(e) ? t = "object" : /^[0-9]*$/.test(e) ? t = "number" : e === "true" || e === "false" ? t = "boolean" : e == "undefined" ? t = "undefined" : e == "null" ? t = "null" : e && (t = "string"), t;
71
71
  }
72
- function d(e) {
72
+ function S(e) {
73
73
  switch ((e[0] || "any").toLowerCase()) {
74
74
  case "string":
75
75
  return '""';
@@ -78,7 +78,7 @@ function d(e) {
78
78
  case "number":
79
79
  return "0";
80
80
  case "array":
81
- let n = d(e.splice(1));
81
+ let n = S(e.splice(1));
82
82
  return n = n == "undefined" ? "" : n, `[${n}]`;
83
83
  case "object":
84
84
  return "{}";
@@ -90,7 +90,7 @@ function d(e) {
90
90
  return "undefined";
91
91
  }
92
92
  }
93
- function $(e) {
93
+ function v(e) {
94
94
  let t = [];
95
95
  if (e)
96
96
  if (e = (e + "").trim(), e.startsWith("["))
@@ -101,40 +101,49 @@ function $(e) {
101
101
  }
102
102
  else
103
103
  t = ["any"];
104
- return t.map((n) => f(n));
104
+ return t.map((n) => m(n));
105
105
  }
106
- function O(e) {
106
+ function z(e) {
107
107
  return e.join("|") || "any";
108
108
  }
109
- function A(e) {
110
- return e.split(",").map((n) => {
111
- n = n.trim();
112
- let r = !0, i = n.split(":"), l = i[0].trim();
113
- l.endsWith("?") && (r = !1, l = l.substring(0, l.length - 1));
114
- let u = i[1] || "", o = c($(u));
109
+ function C(e) {
110
+ return e.split(",").map((t) => {
111
+ const n = t.trim(), r = n, o = n.match(/^([^:?]+)(\??):/);
112
+ if (!o) return null;
113
+ const a = o[1].trim(), h = !o[2], $ = o[0].length, s = n.substring($).trim();
114
+ let i = [], f = -1, c = "", p = "";
115
+ for (let u = 0; u < s.length; u++) {
116
+ const l = s[u];
117
+ if (l === "[" || l === "<" || l === "(" ? i.push(l) : (l === "]" && i[i.length - 1] === "[" || l === ">" && i[i.length - 1] === "<" || l === ")" && i[i.length - 1] === "(") && i.pop(), i.length === 0 && u > 0) {
118
+ f = u == 1 ? 0 : u, c = s.substring(0, f + 1).trim(), p = s.substring(f + 1);
119
+ break;
120
+ }
121
+ }
122
+ let g = d(v(c));
115
123
  return {
116
- label: n,
117
- prop: l,
118
- must: r,
119
- type: o[0],
120
- dataType: o,
121
- description: u.substring(u.lastIndexOf("]") + 1).trim()
124
+ name: a,
125
+ prop: a,
126
+ type: g[0],
127
+ dataType: g,
128
+ must: h,
129
+ label: r,
130
+ description: p
122
131
  };
123
- });
132
+ }).filter(Boolean);
124
133
  }
125
134
  export {
126
- g as getFunBody,
127
- L as getFunctionFormat,
128
- b as getObjType,
129
- A as getParametersObj,
130
- c as getSonType,
131
- w as getString,
132
- d as getTypeValue,
133
- F as isDefaultType,
134
- v as isTypeEqual,
135
- T as prettierArrFormat,
136
- s as prettierFormat,
137
- h as prettierObjFormat,
138
- O as setDataType,
139
- x as vueFormat
135
+ T as getFunBody,
136
+ R as getFunctionFormat,
137
+ F as getObjType,
138
+ d as getSonType,
139
+ E as getString,
140
+ S as getTypeValue,
141
+ L as isDefaultType,
142
+ B as isTypeEqual,
143
+ C as parseParamString,
144
+ D as prettierArrFormat,
145
+ y as prettierFormat,
146
+ A as prettierObjFormat,
147
+ z as setDataType,
148
+ k as vueFormat
140
149
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.0.31",
4
+ "version": "0.0.32",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",