@fangzhongya/vue-archive 0.0.49 → 0.0.51

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.
@@ -24,12 +24,12 @@ __export(index_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(index_exports);
26
26
 
27
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
27
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
28
28
  function isArray(obj) {
29
29
  return Object.prototype.toString.call(obj) == "[object Array]";
30
30
  }
31
31
 
32
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
32
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
33
33
  function getStartSames(str, val) {
34
34
  let s = "";
35
35
  const vs = [...val];
@@ -45,7 +45,7 @@ function getStartSames(str, val) {
45
45
  return [s, str.substring(index), val.substring(index)];
46
46
  }
47
47
 
48
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-AWC672JW.js
48
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-AWC672JW.js
49
49
  function getImportUrl(url, imp) {
50
50
  const arr = getStartSames(url, imp);
51
51
  const ts = arr[0];
@@ -72,12 +72,12 @@ function getImportUrl(url, imp) {
72
72
  return ds.join("") + arr[2].replace(/\\/g, "/");
73
73
  }
74
74
 
75
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
75
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
76
76
  function firstUpper(str) {
77
77
  return str.slice(0, 1).toUpperCase() + str.slice(1);
78
78
  }
79
79
 
80
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
80
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
81
81
  function lineToLargeHump(name) {
82
82
  let arr = name.split("-");
83
83
  arr = arr.map((vs) => {
@@ -786,7 +786,7 @@ function runDev(config2, configCallback) {
786
786
  return new FangMd(config2, configCallback);
787
787
  }
788
788
 
789
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
789
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
790
790
  var zObj = {
791
791
  "<": "&lt;",
792
792
  ">": "&gt;",
@@ -807,7 +807,7 @@ function htmlEscape(str) {
807
807
  // packages/node/index.ts
808
808
  var import_node_path = require("path");
809
809
 
810
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
810
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
811
811
  function mergeObject(a, b, j = 0, i) {
812
812
  if (a instanceof Array) {
813
813
  if (j > 0 && i) {
@@ -850,7 +850,7 @@ function mergeObject(a, b, j = 0, i) {
850
850
  return a;
851
851
  }
852
852
 
853
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
853
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
854
854
  function humpToLine(name) {
855
855
  const reg = /(([A-Z])([^A-Z]*))/g;
856
856
  let result;
@@ -872,7 +872,7 @@ function humpToLine(name) {
872
872
  }
873
873
  }
874
874
 
875
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-LPMR5W6M.js
875
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-LPMR5W6M.js
876
876
  function appearNum(str, t) {
877
877
  let reg = t;
878
878
  if (typeof t == "string") {
@@ -883,12 +883,12 @@ function appearNum(str, t) {
883
883
  return c;
884
884
  }
885
885
 
886
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
886
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
887
887
  function firstLower(str) {
888
888
  return str.slice(0, 1).toLowerCase() + str.slice(1);
889
889
  }
890
890
 
891
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
891
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
892
892
  function asyncMergeArray(arr, callback) {
893
893
  return new Promise((resolve2, reject) => {
894
894
  let index = 0;
@@ -912,7 +912,7 @@ function asyncMergeArray(arr, callback) {
912
912
  });
913
913
  }
914
914
 
915
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-UOADEBDH.js
915
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-UOADEBDH.js
916
916
  function getSuffix2(url) {
917
917
  const reg = /\.([a-z|A-Z]+)$/;
918
918
  const regs = reg.exec(url);
@@ -933,7 +933,7 @@ function getConfig(key) {
933
933
  return config[key];
934
934
  }
935
935
 
936
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-7PJ2D3KR.js
936
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-7PJ2D3KR.js
937
937
  function getVueText(content) {
938
938
  const result = {
939
939
  template: "",
@@ -1522,7 +1522,7 @@ function parse(source, options = {}) {
1522
1522
  }
1523
1523
  var stringify = getStringifier();
1524
1524
 
1525
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
1525
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
1526
1526
  function deComment(code) {
1527
1527
  let output = "";
1528
1528
  let state = "code";
@@ -1614,7 +1614,7 @@ function deComment(code) {
1614
1614
  return output;
1615
1615
  }
1616
1616
 
1617
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-DILPRD5C.js
1617
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-DILPRD5C.js
1618
1618
  function getImports(code, includeType = false) {
1619
1619
  code = deComment(code);
1620
1620
  const imports = /* @__PURE__ */ new Set();
@@ -3029,7 +3029,7 @@ var top_default2 = (0, import_vue2.defineComponent)({
3029
3029
  }
3030
3030
  });
3031
3031
 
3032
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-7O4MJOHM.js
3032
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-7O4MJOHM.js
3033
3033
  var FUNCTION_REGEX = /^\s*(?:(async)\s+)?(?:function\s*(\*?)\s*(\w*)\s*\(([\s\S]*?)\)|(\*?\s*)\b(\w+)\s*\(([\s\S]*?)\)|\(([\s\S]*?)\)|([^=>,\(\)]+?))\s*(?:=>)?\s*(?:\{([\s\S]*?)\}|([\s\S]*))$/;
3034
3034
  function getFunctionFormat(v) {
3035
3035
  if (!v) return;
@@ -3253,9 +3253,10 @@ var parseTypeDefinition = (typeDef) => {
3253
3253
  dataType: types
3254
3254
  };
3255
3255
  } else {
3256
+ const types = splitIgnoringNesting(typeDef, ",");
3256
3257
  return {
3257
- type: typeDef,
3258
- dataType: [typeDef]
3258
+ type: types[0] || "any",
3259
+ dataType: types
3259
3260
  };
3260
3261
  }
3261
3262
  };
@@ -3542,22 +3543,24 @@ function setValStringify(v, key, propsText) {
3542
3543
  }
3543
3544
  }
3544
3545
  }
3545
- function getSpecType(val) {
3546
- let tarr = getType(val?.type);
3547
- let type = "any";
3546
+ function getSpecType(val, v) {
3547
+ let ds = parseTypeDefinition(val?.type);
3548
+ let tarr = ds.dataType;
3549
+ let type = v || ds.type;
3548
3550
  if (tarr.length == 1) {
3549
3551
  type = tarr[0].split("<")[0];
3552
+ } else if (tarr.length > 1) {
3553
+ type = "any";
3550
3554
  }
3551
- const zdtype = type;
3552
3555
  let selectable = (val?.selectable || "").trim();
3553
3556
  let arr = [];
3554
3557
  if (selectable && type != "boolean") {
3555
3558
  if (selectable.includes("|")) {
3556
- selectable.split("|").forEach((v) => {
3557
- if (v) {
3558
- let z = v.split(":");
3559
+ selectable.split("|").forEach((v2) => {
3560
+ if (v2) {
3561
+ let z = v2.split(":");
3559
3562
  arr.push({
3560
- label: v,
3563
+ label: v2,
3561
3564
  prop: getObjValue(z[0].trim())
3562
3565
  });
3563
3566
  }
@@ -3577,22 +3580,10 @@ function getSpecType(val) {
3577
3580
  }
3578
3581
  return {
3579
3582
  arr,
3580
- zdtype,
3581
- type,
3583
+ type: type.toLowerCase(),
3582
3584
  dataType: tarr
3583
3585
  };
3584
3586
  }
3585
- function getType(value) {
3586
- let arr = [];
3587
- let str = (value || "").trim().toLowerCase();
3588
- str.split(",").forEach((v) => {
3589
- v = v.trim();
3590
- if (v) {
3591
- arr.push(v);
3592
- }
3593
- });
3594
- return [...new Set(arr)].sort();
3595
- }
3596
3587
  function getObjValue(d, type) {
3597
3588
  try {
3598
3589
  if (type?.toLowerCase() == "function") {
@@ -1,9 +1,9 @@
1
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
1
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
2
2
  function isArray(obj) {
3
3
  return Object.prototype.toString.call(obj) == "[object Array]";
4
4
  }
5
5
 
6
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
6
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
7
7
  function getStartSames(str, val) {
8
8
  let s = "";
9
9
  const vs = [...val];
@@ -19,7 +19,7 @@ function getStartSames(str, val) {
19
19
  return [s, str.substring(index), val.substring(index)];
20
20
  }
21
21
 
22
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-AWC672JW.js
22
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-AWC672JW.js
23
23
  function getImportUrl(url, imp) {
24
24
  const arr = getStartSames(url, imp);
25
25
  const ts = arr[0];
@@ -46,12 +46,12 @@ function getImportUrl(url, imp) {
46
46
  return ds.join("") + arr[2].replace(/\\/g, "/");
47
47
  }
48
48
 
49
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
49
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
50
50
  function firstUpper(str) {
51
51
  return str.slice(0, 1).toUpperCase() + str.slice(1);
52
52
  }
53
53
 
54
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
54
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
55
55
  function lineToLargeHump(name) {
56
56
  let arr = name.split("-");
57
57
  arr = arr.map((vs) => {
@@ -771,7 +771,7 @@ function runDev(config2, configCallback) {
771
771
  return new FangMd(config2, configCallback);
772
772
  }
773
773
 
774
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
774
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
775
775
  var zObj = {
776
776
  "<": "&lt;",
777
777
  ">": "&gt;",
@@ -792,7 +792,7 @@ function htmlEscape(str) {
792
792
  // packages/node/index.ts
793
793
  import { join as join4 } from "path";
794
794
 
795
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
795
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
796
796
  function mergeObject(a, b, j = 0, i) {
797
797
  if (a instanceof Array) {
798
798
  if (j > 0 && i) {
@@ -835,7 +835,7 @@ function mergeObject(a, b, j = 0, i) {
835
835
  return a;
836
836
  }
837
837
 
838
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
838
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
839
839
  function humpToLine(name) {
840
840
  const reg = /(([A-Z])([^A-Z]*))/g;
841
841
  let result;
@@ -857,7 +857,7 @@ function humpToLine(name) {
857
857
  }
858
858
  }
859
859
 
860
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-LPMR5W6M.js
860
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-LPMR5W6M.js
861
861
  function appearNum(str, t) {
862
862
  let reg = t;
863
863
  if (typeof t == "string") {
@@ -868,12 +868,12 @@ function appearNum(str, t) {
868
868
  return c;
869
869
  }
870
870
 
871
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
871
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
872
872
  function firstLower(str) {
873
873
  return str.slice(0, 1).toLowerCase() + str.slice(1);
874
874
  }
875
875
 
876
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
876
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
877
877
  function asyncMergeArray(arr, callback) {
878
878
  return new Promise((resolve2, reject) => {
879
879
  let index = 0;
@@ -897,7 +897,7 @@ function asyncMergeArray(arr, callback) {
897
897
  });
898
898
  }
899
899
 
900
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-UOADEBDH.js
900
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-UOADEBDH.js
901
901
  function getSuffix2(url) {
902
902
  const reg = /\.([a-z|A-Z]+)$/;
903
903
  const regs = reg.exec(url);
@@ -918,7 +918,7 @@ function getConfig(key) {
918
918
  return config[key];
919
919
  }
920
920
 
921
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-7PJ2D3KR.js
921
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-7PJ2D3KR.js
922
922
  function getVueText(content) {
923
923
  const result = {
924
924
  template: "",
@@ -1507,7 +1507,7 @@ function parse(source, options = {}) {
1507
1507
  }
1508
1508
  var stringify = getStringifier();
1509
1509
 
1510
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
1510
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
1511
1511
  function deComment(code) {
1512
1512
  let output = "";
1513
1513
  let state = "code";
@@ -1599,7 +1599,7 @@ function deComment(code) {
1599
1599
  return output;
1600
1600
  }
1601
1601
 
1602
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-DILPRD5C.js
1602
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-DILPRD5C.js
1603
1603
  function getImports(code, includeType = false) {
1604
1604
  code = deComment(code);
1605
1605
  const imports = /* @__PURE__ */ new Set();
@@ -3014,7 +3014,7 @@ var top_default2 = defineComponent2({
3014
3014
  }
3015
3015
  });
3016
3016
 
3017
- // node_modules/.pnpm/@fangzhongya+utils@0.0.27/node_modules/@fangzhongya/utils/dist/chunk-7O4MJOHM.js
3017
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-7O4MJOHM.js
3018
3018
  var FUNCTION_REGEX = /^\s*(?:(async)\s+)?(?:function\s*(\*?)\s*(\w*)\s*\(([\s\S]*?)\)|(\*?\s*)\b(\w+)\s*\(([\s\S]*?)\)|\(([\s\S]*?)\)|([^=>,\(\)]+?))\s*(?:=>)?\s*(?:\{([\s\S]*?)\}|([\s\S]*))$/;
3019
3019
  function getFunctionFormat(v) {
3020
3020
  if (!v) return;
@@ -3238,9 +3238,10 @@ var parseTypeDefinition = (typeDef) => {
3238
3238
  dataType: types
3239
3239
  };
3240
3240
  } else {
3241
+ const types = splitIgnoringNesting(typeDef, ",");
3241
3242
  return {
3242
- type: typeDef,
3243
- dataType: [typeDef]
3243
+ type: types[0] || "any",
3244
+ dataType: types
3244
3245
  };
3245
3246
  }
3246
3247
  };
@@ -3527,22 +3528,24 @@ function setValStringify(v, key, propsText) {
3527
3528
  }
3528
3529
  }
3529
3530
  }
3530
- function getSpecType(val) {
3531
- let tarr = getType(val?.type);
3532
- let type = "any";
3531
+ function getSpecType(val, v) {
3532
+ let ds = parseTypeDefinition(val?.type);
3533
+ let tarr = ds.dataType;
3534
+ let type = v || ds.type;
3533
3535
  if (tarr.length == 1) {
3534
3536
  type = tarr[0].split("<")[0];
3537
+ } else if (tarr.length > 1) {
3538
+ type = "any";
3535
3539
  }
3536
- const zdtype = type;
3537
3540
  let selectable = (val?.selectable || "").trim();
3538
3541
  let arr = [];
3539
3542
  if (selectable && type != "boolean") {
3540
3543
  if (selectable.includes("|")) {
3541
- selectable.split("|").forEach((v) => {
3542
- if (v) {
3543
- let z = v.split(":");
3544
+ selectable.split("|").forEach((v2) => {
3545
+ if (v2) {
3546
+ let z = v2.split(":");
3544
3547
  arr.push({
3545
- label: v,
3548
+ label: v2,
3546
3549
  prop: getObjValue(z[0].trim())
3547
3550
  });
3548
3551
  }
@@ -3562,22 +3565,10 @@ function getSpecType(val) {
3562
3565
  }
3563
3566
  return {
3564
3567
  arr,
3565
- zdtype,
3566
- type,
3568
+ type: type.toLowerCase(),
3567
3569
  dataType: tarr
3568
3570
  };
3569
3571
  }
3570
- function getType(value) {
3571
- let arr = [];
3572
- let str = (value || "").trim().toLowerCase();
3573
- str.split(",").forEach((v) => {
3574
- v = v.trim();
3575
- if (v) {
3576
- arr.push(v);
3577
- }
3578
- });
3579
- return [...new Set(arr)].sort();
3580
- }
3581
3572
  function getObjValue(d, type) {
3582
3573
  try {
3583
3574
  if (type?.toLowerCase() == "function") {
@@ -1,7 +1,7 @@
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}-->
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const z=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const H=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const w=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const c=require("./util.cjs"),T=require("../../utils/props.cjs"),J=require("@fangzhongya/utils/basic/string/toFunction"),N=["class"];function q(e,t){return e.filter(n=>n.name==t)[0]}function L(e){return e.map(t=>(t.prop||"...arr")+":"+c.setDataType(t.dataType)).join(",")}function A(e,t,n,s,i,h){const a=[],r=[];let $=!0;const v=T.getPropsValue(t.propss||[]),x=T.getEmitsValue(t.emitss||[]),B=T.getExposeValue(t.exposes||[]),C=T.getSlotValue(t.slots||[]);Object.keys(n).forEach(o=>{let g=n[o];if(/^on[A-Z]/.test(o)&&typeof g=="function"){let u=o.substring(2);const l=o.split(":");let m;if(l.length>1?(m=l[0]+l.slice(1).map(p=>w.firstUpper(p)).join(""),u=H.firstLower(u)):(m=l[0],u=z.humpToLine(u)),l.includes("-")){let p=m.split("-");p=p.map((y,F)=>F!=0?w.firstUpper(y):y),m=p.join("")}a.push(" @"+u+'="'+m+'"');const f=q(x,u)||{},b=f.selectable||"",S=c.parseParamString(b),d=L(S);r.push(`// ${f.description} ${f.name}: (${f.selectable})`),r.push("function "+m+"("+d+") {"),S.forEach(p=>{const y=p.name||"arr";r.push(" console.log('"+p.label+"', "+y+")")}),r.push("}")}else{let u=o;N.includes(o)&&(u=o+"1"),a.push(" :"+o+'="'+u+'"');const l=q(v,o)||{},m=E(l);if(r.push(`// ${l.description} ${l.name}: {${l.type}} (${l.selectable})`),typeof g=="function")r.push("const "+o+" = "+P(g,o,i));else if($&&($=!1,r.unshift("import { ref } from 'vue';")),typeof g>"u")if(m.type=="function"){const f=Z(l);r.push("const "+u+" = "+f+";")}else{const f=c.getTypeValue(m.dataType);r.push("const "+u+" = ref("+(f==="undefined"?"":f)+");")}else{let f=D(g,o,i);r.push("const "+u+" = ref("+f+");")}}});const O=Object.values(h||{});O.length>0&&($&&($=!1,r.unshift("import { ref } from 'vue';")),a.unshift(' ref="refDom"'),r.push("const refDom = ref()"),O.forEach(o=>{const g=q(B,o.name)||{};r.push(`// ${g.description} ${g.name}:(${g.selectable}) ${g.type}`);const u=o.name+"Value",l=c.parseParamString(g?.selectable||""),m=[],f=o.params||[];l.forEach((b,S)=>{const d=b.name;if(d){const p=d+o.name,y=f[S];if(r.push(`// ${b.label}`),typeof y=="function")r.push("const "+p+" = "+P(y,d,o.text));else if(typeof y>"u")r.push("const "+p+" = "+c.getTypeValue(b.dataType)+";");else{let F=D(y,d,o.text);r.push("const "+p+" = "+F+";")}m.push(p)}}),o.type==="function"?r.push(`const ${u} = refDom.value?.${o.name}(${m.join(", ")})`):r.push(`const ${u} = refDom.value?.${o.name}`),r.push(`console.log('"${g.type}"', ${u})`)})),a.length>0&&a.unshift("");const U=M(s,C);return`<!--${e}-->
2
2
  <template>
3
3
  <div>
4
- <${e}${p.join(`
4
+ <${e}${a.join(`
5
5
  `)}>${U.join(`
6
6
  `)}
7
7
  </${e}>
@@ -11,11 +11,11 @@
11
11
  ${r.join(`
12
12
  `)}
13
13
  <\/script>
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}) -->
14
+ `}function M(e={},t){const n=[];return Object.keys(e).forEach(s=>{const i=q(t,s)||{},h=e[s];if(h){const a=` <!-- ${i.description} ${i.name}:(${i.selectable}) -->
15
15
  <template #${s}="scope">
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&&(s.includes("=>")||s.includes("function"))?s:j(e.toString())}function j(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 v(e){const n=l.parseParamString(e.selectable),t=L(n);let s="";e.return&&(s="return ");let o=`{
20
- ${l.vueFormat(l.getFunBody(s)," ")}
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;
16
+ ${c.vueFormat(h," ")}
17
+ </template>`;n.push(a)}}),n&&n.length>0&&n.unshift(""),n}function P(e,t,n){const s=n?n[t]:"";return s&&(s.includes("=>")||s.includes("function"))?s:j(e.toString())}function j(e){const t=J.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=L(t);let s="";e.return&&(s="return ");let i=`{
20
+ ${c.vueFormat(c.getFunBody(s)," ")}
21
+ }`;return`function (${n}) ${i}`}function G(e){const t=e.trim();return/^\(/.test(t)?j(t):JSON.stringify(e)}function D(e,t,n){const s=n?n[t]:"";return s?typeof s=="string"?V(s):s:typeof e=="string"?G(e+""):JSON.stringify(e)}function E(e,t){let n=c.parseTypeDefinition(e?.type),s=n.dataType,i=t||n.type;s.length==1?i=s[0].split("<")[0]:s.length>1&&(i="any");let h=(e?.selectable||"").trim(),a=[];return h&&i!="boolean"&&(h.includes("|")?h.split("|").forEach(r=>{if(r){let $=r.split(":");a.push({label:r,prop:V($[0].trim())})}}):a=c.parseParamString(h),i=="function"?i="function":i=="array"?i="choice":a.length>1&&(i="select")),{arr:a,type:i.toLowerCase(),dataType:s}}function V(e,t){try{if(t?.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 I(e,t=!0){const n=E(e),s=c.getTypeValue(n.dataType);if(t){const i=(e.default||"").trim();return V(i||s,n.dataType[0])}else{const i=(e.default||"").trim();return V(i,n.dataType[0])}}exports.getDefaultValue=I;exports.getHmtl=A;exports.getSpecType=E;exports.setValStringify=D;
@@ -8,9 +8,8 @@ type SelectsObj = {
8
8
  label: string;
9
9
  prop: unknown;
10
10
  };
11
- export declare function getSpecType(val: Spec): {
11
+ export declare function getSpecType(val: Spec, v?: string): {
12
12
  arr: SelectsObj[];
13
- zdtype: string;
14
13
  type: string;
15
14
  dataType: string[];
16
15
  };
@@ -6,99 +6,99 @@ 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 D } from "@fangzhongya/utils/basic/string/firstUpper";
9
+ import { firstUpper as w } 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 T, setDataType as q, vueFormat as w, prettierFormat as G, getFunBody as z } from "./util.js";
12
+ import { getTypeValue as F, parseParamString as T, parseTypeDefinition as q, setDataType as v, vueFormat as D, getFunBody as C, prettierFormat as G } 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, n) {
17
- return t.filter((e) => e.name == n)[0];
16
+ function S(t, e) {
17
+ return t.filter((n) => n.name == e)[0];
18
18
  }
19
- function C(t) {
20
- return t.map((n) => (n.prop || "...arr") + ":" + q(n.dataType)).join(",");
19
+ function P(t) {
20
+ return t.map((e) => (e.prop || "...arr") + ":" + v(e.dataType)).join(",");
21
21
  }
22
- function ht(t, n, e, s, i, h) {
23
- const p = [], r = [];
24
- let d = !0;
25
- const B = 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 c = o.substring(2);
30
- const u = o.split(":");
22
+ function ht(t, e, n, s, o, h) {
23
+ const l = [], r = [];
24
+ let $ = !0;
25
+ const B = I(e.propss || []), J = K(e.emitss || []), N = M(e.exposes || []), A = Q(e.slots || []);
26
+ Object.keys(n).forEach((i) => {
27
+ let a = n[i];
28
+ if (/^on[A-Z]/.test(i) && typeof a == "function") {
29
+ let c = i.substring(2);
30
+ const u = i.split(":");
31
31
  let m;
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
- let f = m.split("-");
34
- f = f.map((g, j) => j != 0 ? D(g) : g), m = f.join("");
32
+ if (u.length > 1 ? (m = u[0] + u.slice(1).map((p) => w(p)).join(""), c = Z(c)) : (m = u[0], c = U(c)), u.includes("-")) {
33
+ let p = m.split("-");
34
+ p = p.map((g, j) => j != 0 ? w(g) : g), m = p.join("");
35
35
  }
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 + ")");
36
+ l.push(" @" + c + '="' + m + '"');
37
+ const f = S(J, c) || {}, d = f.selectable || "", b = T(d), y = P(b);
38
+ r.push(`// ${f.description} ${f.name}: (${f.selectable})`), r.push("function " + m + "(" + y + ") {"), b.forEach((p) => {
39
+ const g = p.name || "arr";
40
+ r.push(" console.log('" + p.label + "', " + g + ")");
41
41
  }), r.push("}");
42
42
  } else {
43
- let c = o;
44
- W.includes(o) && (c = o + "1"), p.push(" :" + o + '="' + c + '"');
45
- const u = S(B, o) || {}, m = P(u);
43
+ let c = i;
44
+ W.includes(i) && (c = i + "1"), l.push(" :" + i + '="' + c + '"');
45
+ const u = S(B, i) || {}, m = z(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 + " = " + x(a, o, i)
50
+ "const " + i + " = " + x(a, i, o)
51
51
  );
52
- else if (d && (d = !1, r.unshift("import { ref } from 'vue';")), typeof a > "u")
52
+ else if ($ && ($ = !1, r.unshift("import { ref } from 'vue';")), typeof a > "u")
53
53
  if (m.type == "function") {
54
- const l = Y(u);
55
- r.push("const " + c + " = " + l + ";");
54
+ const f = Y(u);
55
+ r.push("const " + c + " = " + f + ";");
56
56
  } else {
57
- const l = E(m.dataType);
57
+ const f = F(m.dataType);
58
58
  r.push(
59
- "const " + c + " = ref(" + (l === "undefined" ? "" : l) + ");"
59
+ "const " + c + " = ref(" + (f === "undefined" ? "" : f) + ");"
60
60
  );
61
61
  }
62
62
  else {
63
- let l = L(a, o, i);
64
- r.push("const " + c + " = ref(" + l + ");");
63
+ let f = L(a, i, o);
64
+ r.push("const " + c + " = ref(" + f + ");");
65
65
  }
66
66
  }
67
67
  });
68
68
  const O = Object.values(h || {});
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
- const a = S(N, o.name) || {};
69
+ O.length > 0 && ($ && ($ = !1, r.unshift("import { ref } from 'vue';")), l.unshift(' ref="refDom"'), r.push("const refDom = ref()"), O.forEach((i) => {
70
+ const a = S(N, i.name) || {};
71
71
  r.push(
72
72
  `// ${a.description} ${a.name}:(${a.selectable}) ${a.type}`
73
73
  );
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")
74
+ const c = i.name + "Value", u = T(a?.selectable || ""), m = [], f = i.params || [];
75
+ u.forEach((d, b) => {
76
+ const y = d.name;
77
+ if (y) {
78
+ const p = y + i.name, g = f[b];
79
+ if (r.push(`// ${d.label}`), typeof g == "function")
80
80
  r.push(
81
- "const " + f + " = " + x(g, $, o.text)
81
+ "const " + p + " = " + x(g, y, i.text)
82
82
  );
83
83
  else if (typeof g > "u")
84
84
  r.push(
85
- "const " + f + " = " + E(y.dataType) + ";"
85
+ "const " + p + " = " + F(d.dataType) + ";"
86
86
  );
87
87
  else {
88
- let j = L(g, $, o.text);
89
- r.push("const " + f + " = " + j + ";");
88
+ let j = L(g, y, i.text);
89
+ r.push("const " + p + " = " + j + ";");
90
90
  }
91
- m.push(f);
91
+ m.push(p);
92
92
  }
93
- }), o.type === "function" ? r.push(
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
- })), p.length > 0 && p.unshift("");
93
+ }), i.type === "function" ? r.push(
94
+ `const ${c} = refDom.value?.${i.name}(${m.join(", ")})`
95
+ ) : r.push(`const ${c} = refDom.value?.${i.name}`), r.push(`console.log('"${a.type}"', ${c})`);
96
+ })), l.length > 0 && l.unshift("");
97
97
  const H = X(s, A);
98
98
  return `<!--${t}-->
99
99
  <template>
100
100
  <div>
101
- <${t}${p.join(`
101
+ <${t}${l.join(`
102
102
  `)}>${H.join(`
103
103
  `)}
104
104
  </${t}>
@@ -110,79 +110,71 @@ ${r.join(`
110
110
  <\/script>
111
111
  `;
112
112
  }
113
- function X(t = {}, n) {
114
- const e = [];
113
+ function X(t = {}, e) {
114
+ const n = [];
115
115
  return Object.keys(t).forEach((s) => {
116
- const i = S(n, s) || {}, h = t[s];
116
+ const o = S(e, s) || {}, h = t[s];
117
117
  if (h) {
118
- const p = ` <!-- ${i.description} ${i.name}:(${i.selectable}) -->
118
+ const l = ` <!-- ${o.description} ${o.name}:(${o.selectable}) -->
119
119
  <template #${s}="scope">
120
- ${w(h, " ")}
120
+ ${D(h, " ")}
121
121
  </template>`;
122
- e.push(p);
122
+ n.push(l);
123
123
  }
124
- }), e && e.length > 0 && e.unshift(""), e;
124
+ }), n && n.length > 0 && n.unshift(""), n;
125
125
  }
126
- function x(t, n, e) {
127
- const s = e ? e[n] : "";
128
- return s && (s.includes("=>") || s.includes("function")) ? s : F(t.toString());
126
+ function x(t, e, n) {
127
+ const s = n ? n[e] : "";
128
+ return s && (s.includes("=>") || s.includes("function")) ? s : E(t.toString());
129
129
  }
130
- function F(t) {
131
- const n = R(G(t));
132
- if (n) {
133
- let e = `{
134
- ${w(z(n.body), " ")}
130
+ function E(t) {
131
+ const e = R(G(t));
132
+ if (e) {
133
+ let n = `{
134
+ ${D(C(e.body), " ")}
135
135
  }`;
136
- return `function (${n.param}) ${e}`;
136
+ return `function (${e.param}) ${n}`;
137
137
  } else
138
138
  return "undefined";
139
139
  }
140
140
  function Y(t) {
141
- const n = T(t.selectable), e = C(n);
141
+ const e = T(t.selectable), n = P(e);
142
142
  let s = "";
143
143
  t.return && (s = "return ");
144
- let i = `{
145
- ${w(z(s), " ")}
144
+ let o = `{
145
+ ${D(C(s), " ")}
146
146
  }`;
147
- return `function (${e}) ${i}`;
147
+ return `function (${n}) ${o}`;
148
148
  }
149
149
  function _(t) {
150
- const n = t.trim();
151
- return /^\(/.test(n) ? F(n) : JSON.stringify(t);
150
+ const e = t.trim();
151
+ return /^\(/.test(e) ? E(e) : JSON.stringify(t);
152
152
  }
153
- function L(t, n, e) {
154
- const s = e ? e[n] : "";
153
+ function L(t, e, n) {
154
+ const s = n ? n[e] : "";
155
155
  return s ? typeof s == "string" ? V(s) : s : typeof t == "string" ? _(t + "") : JSON.stringify(t);
156
156
  }
157
- function P(t) {
158
- let n = v(t?.type), e = "any";
159
- n.length == 1 && (e = n[0].split("<")[0]);
160
- const s = e;
161
- let i = (t?.selectable || "").trim(), h = [];
162
- return i && e != "boolean" && (i.includes("|") ? i.split("|").forEach((p) => {
163
- if (p) {
164
- let r = p.split(":");
165
- h.push({
166
- label: p,
167
- prop: V(r[0].trim())
157
+ function z(t, e) {
158
+ let n = q(t?.type), s = n.dataType, o = e || n.type;
159
+ s.length == 1 ? o = s[0].split("<")[0] : s.length > 1 && (o = "any");
160
+ let h = (t?.selectable || "").trim(), l = [];
161
+ return h && o != "boolean" && (h.includes("|") ? h.split("|").forEach((r) => {
162
+ if (r) {
163
+ let $ = r.split(":");
164
+ l.push({
165
+ label: r,
166
+ prop: V($[0].trim())
168
167
  });
169
168
  }
170
- }) : h = T(i), e == "function" ? e = "function" : e == "array" ? e = "choice" : h.length > 1 && (e = "select")), {
171
- arr: h,
172
- zdtype: s,
173
- type: e,
174
- dataType: n
169
+ }) : l = T(h), o == "function" ? o = "function" : o == "array" ? o = "choice" : l.length > 1 && (o = "select")), {
170
+ arr: l,
171
+ type: o.toLowerCase(),
172
+ dataType: s
175
173
  };
176
174
  }
177
- function v(t) {
178
- let n = [];
179
- return (t || "").trim().toLowerCase().split(",").forEach((s) => {
180
- s = s.trim(), s && n.push(s);
181
- }), [...new Set(n)].sort();
182
- }
183
- function V(t, n) {
175
+ function V(t, e) {
184
176
  try {
185
- if (n?.toLowerCase() == "function")
177
+ if (e?.toLowerCase() == "function")
186
178
  if (typeof t == "string") {
187
179
  if (/^\((.|\n|\r)*\)$/.test(t))
188
180
  return t = t.substring(1, t.length - 1), new Function(`{ return ${t} }`)();
@@ -194,19 +186,19 @@ function V(t, n) {
194
186
  return "" + t;
195
187
  }
196
188
  }
197
- function gt(t, n = !0) {
198
- const e = P(t), s = E(e.dataType);
199
- if (n) {
200
- const i = (t.default || "").trim();
201
- return V(i || s, e.dataType[0]);
189
+ function gt(t, e = !0) {
190
+ const n = z(t), s = F(n.dataType);
191
+ if (e) {
192
+ const o = (t.default || "").trim();
193
+ return V(o || s, n.dataType[0]);
202
194
  } else {
203
- const i = (t.default || "").trim();
204
- return V(i, e.dataType[0]);
195
+ const o = (t.default || "").trim();
196
+ return V(o, n.dataType[0]);
205
197
  }
206
198
  }
207
199
  export {
208
200
  gt as getDefaultValue,
209
201
  ht as getHmtl,
210
- P as getSpecType,
202
+ z as getSpecType,
211
203
  L as setValStringify
212
204
  };
@@ -1 +1 @@
1
- "use strict";const n=require("vue"),i=require("../../util.cjs"),V=require("../form/index.vue.cjs"),h=require("../select/index.vue.cjs");;/* empty css */const j={class:"form-any"},x=n.defineComponent({__name:"index",props:{selects:{type:Object,default(){return{}}},config:{type:Object,default(){return{}}},modelValue:{type:null}},emits:["change"],setup(p,{emit:f}){const o=p,a=n.ref([]),r=n.ref({}),d=f,u=n.ref(""),m=[{label:"string",prop:"string"},{label:"boolean",prop:"boolean"},{label:"number",prop:"number"},{label:"array",prop:"array"},{label:"object",prop:"object"},{label:"function",prop:"function"},{label:"其他",prop:""}];n.watch(()=>o.modelValue,()=>{g()},{immediate:!0});function _(e){for(let l=0;l<a.value.length;l++){const t=a.value[l].prop;if(t===e||t.startsWith(e))return t}}function c(e,l){let t=Object.assign({},o.config);if(l){const s=_(l);s&&(e=s)}let y=i.getSonType(e);t.type=y[0],t.dataType=e,r.value=t}function g(){let e=[];const l=o.config.dataType||[];if(l&&l.length>1)e=l.map(t=>({label:t,prop:t}));else{let t=l[0];t&&t!="any"?e=[{label:t,prop:t}]:e=m}a.value=e,c(e[0].prop,i.isDefaultType(o.modelValue)),u.value=o.modelValue}function b(e){c(e),u.value=""}function v(...e){d("change",...e)}return(e,l)=>(n.openBlock(),n.createElementBlock("div",j,[n.createElementVNode("div",null,[n.createVNode(h,{noValue:"",onChange:b,modelValue:r.value.dataType,list:a.value},null,8,["modelValue","list"])]),n.createVNode(V,{config:r.value,selects:o.selects,modelValue:u.value,onChange:v},null,8,["config","selects","modelValue"])]))}});module.exports=x;
1
+ "use strict";const n=require("vue"),p=require("../../util.cjs"),V=require("../form/index.vue.cjs"),h=require("../select/index.vue.cjs");;/* empty css */const j={class:"form-any"},x=n.defineComponent({__name:"index",props:{selects:{type:Object,default(){return{}}},config:{type:Object,default(){return{}}},modelValue:{type:null}},emits:["change"],setup(f,{emit:d}){const o=f,r=n.ref([]),u=n.ref({}),m=d,s=n.ref(""),_=[{label:"string",prop:"string"},{label:"boolean",prop:"boolean"},{label:"number",prop:"number"},{label:"array",prop:"array"},{label:"object",prop:"object"},{label:"function",prop:"function"},{label:"其他",prop:""}];n.watch(()=>o.modelValue,()=>{b()},{immediate:!0});function g(e){for(let l=0;l<r.value.length;l++){const t=r.value[l].prop;if(t===e||t.startsWith(e))return t}}function c(e,l){let t=Object.assign({},o.config);if(l){const i=g(l);i&&(e=i)}let a=p.getSonType(e);t.type=a[0],t.dataType=e,u.value=t}function b(){let e=[];const l=o.config.dataType||[];if(l&&l.length>1)e=l.map(t=>{const a=t.split("<")[0];return{label:t,prop:a.toLowerCase()}});else{let t=l[0];if(t&&t!="any"){const a=t.split("<")[0];e=[{label:t,prop:a.toLowerCase()}]}else e=_}r.value=e,c(e[0].prop,p.isDefaultType(o.modelValue)),s.value=o.modelValue}function v(e){c(e),s.value=""}function y(...e){m("change",...e)}return(e,l)=>(n.openBlock(),n.createElementBlock("div",j,[n.createElementVNode("div",null,[n.createVNode(h,{noValue:"",onChange:v,modelValue:u.value.type,list:r.value},null,8,["modelValue","list"])]),n.createVNode(V,{config:u.value,selects:o.selects,modelValue:s.value,onChange:y},null,8,["config","selects","modelValue"])]))}});module.exports=x;
@@ -1,9 +1,9 @@
1
- import { defineComponent as h, ref as c, watch as v, createElementBlock as j, openBlock as T, createElementVNode as x, createVNode as u } from "vue";
2
- import { isDefaultType as C, getSonType as O } from "../../util.js";
3
- import k from "../form/index.vue.js";
4
- import B from "../select/index.vue.js";
1
+ import { defineComponent as h, ref as s, watch as v, createElementBlock as j, openBlock as C, createElementVNode as T, createVNode as u } from "vue";
2
+ import { isDefaultType as x, getSonType as w } from "../../util.js";
3
+ import L from "../form/index.vue.js";
4
+ import O from "../select/index.vue.js";
5
5
  /* empty css */
6
- const E = { class: "form-any" }, L = /* @__PURE__ */ h({
6
+ const k = { class: "form-any" }, D = /* @__PURE__ */ h({
7
7
  __name: "index",
8
8
  props: {
9
9
  /**
@@ -29,8 +29,8 @@ const E = { class: "form-any" }, L = /* @__PURE__ */ h({
29
29
  }
30
30
  },
31
31
  emits: ["change"],
32
- setup(s, { emit: f }) {
33
- const o = s, n = c([]), a = c({}), m = f, r = c(""), d = [
32
+ setup(f, { emit: m }) {
33
+ const o = f, a = s([]), r = s({}), d = m, c = s(""), b = [
34
34
  {
35
35
  label: "string",
36
36
  prop: "string"
@@ -63,71 +63,73 @@ const E = { class: "form-any" }, L = /* @__PURE__ */ h({
63
63
  v(
64
64
  () => o.modelValue,
65
65
  () => {
66
- g();
66
+ V();
67
67
  },
68
68
  {
69
69
  immediate: !0
70
70
  }
71
71
  );
72
- function b(e) {
73
- for (let l = 0; l < n.value.length; l++) {
74
- const t = n.value[l].prop;
72
+ function g(e) {
73
+ for (let l = 0; l < a.value.length; l++) {
74
+ const t = a.value[l].prop;
75
75
  if (t === e || t.startsWith(e))
76
76
  return t;
77
77
  }
78
78
  }
79
- function i(e, l) {
79
+ function p(e, l) {
80
80
  let t = Object.assign({}, o.config);
81
81
  if (l) {
82
- const p = b(l);
83
- p && (e = p);
82
+ const i = g(l);
83
+ i && (e = i);
84
84
  }
85
- let _ = O(e);
86
- t.type = _[0], t.dataType = e, a.value = t;
85
+ let n = w(e);
86
+ t.type = n[0], t.dataType = e, r.value = t;
87
87
  }
88
- function g() {
88
+ function V() {
89
89
  let e = [];
90
90
  const l = o.config.dataType || [];
91
91
  if (l && l.length > 1)
92
- e = l.map((t) => ({
93
- label: t,
94
- prop: t
95
- }));
92
+ e = l.map((t) => {
93
+ const n = t.split("<")[0];
94
+ return {
95
+ label: t,
96
+ prop: n.toLowerCase()
97
+ };
98
+ });
96
99
  else {
97
100
  let t = l[0];
98
- t && t != "any" ? e = [
99
- {
100
- label: t,
101
- prop: t
102
- }
103
- ] : e = d;
101
+ if (t && t != "any") {
102
+ const n = t.split("<")[0];
103
+ e = [{ label: t, prop: n.toLowerCase() }];
104
+ } else
105
+ e = b;
104
106
  }
105
- n.value = e, i(e[0].prop, C(o.modelValue)), r.value = o.modelValue;
107
+ a.value = e, p(e[0].prop, x(o.modelValue)), c.value = o.modelValue;
106
108
  }
107
- function V(e) {
108
- i(e), r.value = "";
109
+ function y(e) {
110
+ p(e), c.value = "";
109
111
  }
110
- function y(...e) {
111
- m("change", ...e);
112
+ function _(...e) {
113
+ d("change", ...e);
112
114
  }
113
- return (e, l) => (T(), j("div", E, [
114
- x("div", null, [
115
- u(B, {
115
+ return (e, l) => (C(), j("div", k, [
116
+ T("div", null, [
117
+ u(O, {
116
118
  noValue: "",
117
- onChange: V,
118
- modelValue: a.value.dataType,
119
- list: n.value
119
+ onChange: y,
120
+ modelValue: r.value.type,
121
+ list: a.value
120
122
  }, null, 8, ["modelValue", "list"])
121
123
  ]),
122
- u(k, {
123
- config: a.value,
124
+ u(L, {
125
+ config: r.value,
124
126
  selects: o.selects,
125
- modelValue: r.value,
126
- onChange: y
127
+ modelValue: c.value,
128
+ onChange: _
127
129
  }, null, 8, ["config", "selects", "modelValue"])
128
130
  ]));
129
131
  }
130
132
  });
131
133
  export {
132
- L as default
134
+ D as default
133
135
  };
@@ -1 +1 @@
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
+ "use strict";const s=require("vue"),T=require("./retrie/index.vue.cjs");;/* empty css */const i=require("./code.cjs"),k=require("./util.cjs"),x={key:0,class:"set-props"},j=s.defineComponent({__name:"set-props",props:{name:String,list:Array},emits:["change"],setup(p,{emit:f}){const l=p,m=f,c=s.ref({}),d=s.ref(0),u=s.ref({}),n=s.ref([]);function _(){u.value={};const r=[];l.list?.forEach(t=>{let e=t.name;if(!e.includes(".")&&(e=(e.split("/")[0]||"").trim(),e)){const o=i.getDefaultValue(t,!1);u.value[e]=o;const{arr:g,type:b,dataType:V}=i.getSpecType(t,k.isDefaultType(o));c.value[e]=g;let q={label:h(e,t),prop:e,type:b,dataType:V,select:e};r.push(q)}}),n.value=r}function h(r,t){let e=r+": { "+(t.type||"any")+" } "+t.description;return t.default&&(e+=" 默认值="+t.default),t.selectable&&(e+=" 可选值="+t.selectable),e}function y(r,t){let e=Object.assign({},r);m("change",e,t)}let a;function v(){clearTimeout(a),a=setTimeout(()=>{_()},400)}return s.watch(()=>l.name,()=>{n.value=[],v()},{immediate:!0}),(r,t)=>n.value&&n.value.length>0?(s.openBlock(),s.createElementBlock("div",x,[s.createVNode(T,{refresh:d.value,modelValue:u.value,selects:c.value,list:n.value,name:l.name,onQuery:y},null,8,["refresh","modelValue","selects","list","name"])])):s.createCommentVNode("",!0)}});module.exports=j;
@@ -1,73 +1,78 @@
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";
1
+ import { defineComponent as T, ref as a, watch as k, createElementBlock as j, createCommentVNode as x, openBlock as B, createVNode as C } from "vue";
2
+ import D from "./retrie/index.vue.js";
3
3
  /* empty css */
4
4
  import { getDefaultValue as E, getSpecType as N } from "./code.js";
5
- const S = {
5
+ import { isDefaultType as S } from "./util.js";
6
+ const w = {
6
7
  key: 0,
7
8
  class: "set-props"
8
- }, Q = /* @__PURE__ */ v({
9
+ }, q = /* @__PURE__ */ T({
9
10
  __name: "set-props",
10
11
  props: {
11
12
  name: String,
12
13
  list: Array
13
14
  },
14
15
  emits: ["change"],
15
- setup(i, { emit: u }) {
16
- const n = i, m = u, r = a({}), p = a(0), o = a({}), l = a([]);
17
- function f() {
16
+ setup(u, { emit: m }) {
17
+ const n = u, p = m, r = a({}), f = a(0), o = a({}), l = a([]);
18
+ function d() {
18
19
  o.value = {};
19
20
  const s = [];
20
21
  n.list?.forEach((t) => {
21
22
  let e = t.name;
22
23
  if (!e.includes(".") && (e = (e.split("/")[0] || "").trim(), e)) {
23
- o.value[e] = E(t, !1);
24
- const { arr: y, type: b, dataType: g } = N(t);
25
- r.value[e] = y;
26
- let V = {
27
- label: d(e, t),
24
+ const i = E(t, !1);
25
+ o.value[e] = i;
26
+ const { arr: b, type: g, dataType: V } = N(
27
+ t,
28
+ S(i)
29
+ );
30
+ r.value[e] = b;
31
+ let v = {
32
+ label: h(e, t),
28
33
  prop: e,
29
- type: b,
30
- dataType: g,
34
+ type: g,
35
+ dataType: V,
31
36
  select: e
32
37
  };
33
- s.push(V);
38
+ s.push(v);
34
39
  }
35
40
  }), l.value = s;
36
41
  }
37
- function d(s, t) {
42
+ function h(s, t) {
38
43
  let e = s + ": { " + (t.type || "any") + " } " + t.description;
39
44
  return t.default && (e += " 默认值=" + t.default), t.selectable && (e += " 可选值=" + t.selectable), e;
40
45
  }
41
- function h(s, t) {
46
+ function _(s, t) {
42
47
  let e = Object.assign({}, s);
43
- m("change", e, t);
48
+ p("change", e, t);
44
49
  }
45
50
  let c;
46
- function _() {
51
+ function y() {
47
52
  clearTimeout(c), c = setTimeout(() => {
48
- f();
53
+ d();
49
54
  }, 400);
50
55
  }
51
- return T(
56
+ return k(
52
57
  () => n.name,
53
58
  () => {
54
- l.value = [], _();
59
+ l.value = [], y();
55
60
  },
56
61
  {
57
62
  immediate: !0
58
63
  }
59
- ), (s, t) => l.value && l.value.length > 0 ? (x(), k("div", S, [
60
- B(C, {
61
- refresh: p.value,
64
+ ), (s, t) => l.value && l.value.length > 0 ? (B(), j("div", w, [
65
+ C(D, {
66
+ refresh: f.value,
62
67
  modelValue: o.value,
63
68
  selects: r.value,
64
69
  list: l.value,
65
70
  name: n.name,
66
- onQuery: h
71
+ onQuery: _
67
72
  }, null, 8, ["refresh", "modelValue", "selects", "list", "name"])
68
- ])) : j("", !0);
73
+ ])) : x("", !0);
69
74
  }
70
75
  });
71
76
  export {
72
- Q as default
77
+ q as default
73
78
  };
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@fangzhongya/utils/basic/string/toFunction"),w=require("@fangzhongya/utils/basic/string/firstLower");function y(e){return e.replace(/\;(\s|\n\r)*$/,"")}function O(e){return e="let a = "+e,y(e).replace(/^let a = /,"")}function A(e){return y(e)}function x(e,n=""){let t=(e+"").trim().split(/\n/);return t=t.map(r=>n+r),t.join(`
2
- `)}function b(e=""){e=e.trim();let n=`[\\s|\\n|\\r]*\\{((.|
3
- |\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+n+"$").exec(e);return r&&r.length>0?b(r[1]):e}const W=["Boolean","Any","String","Number","Array","Object","Function"];function k(e){return W.includes(e)?w.firstLower(e):e}function v(e){let t=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(t&&t.length>0)return{own:k(t[1]),son:t[2]}}function d(e,n){let t=v(e);t?(n.push(t.own),t.son&&d(t.son,n)):n.push(e)}function h(e){e instanceof Array&&(e=e[0]);const n=[];return e&&d(e,n),n}function T(e){const n=Object.prototype.toString.call(e);let r=/^\[[O|o]bject (.*)\]$/.exec(n),i=typeof e;return r&&r.length>0&&(i=r[1].toLowerCase()),i}function E(e,n){const t=T(e),r=h(n)[0];return r&&r!="any"?t==r:!0}function q(e){if(typeof e=="string"){let n=!1;return(/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e))&&(n=!0),n&&(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 n="";return/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e)?n="string":/^\[(.|\n|\r)*\]$/.test(e)?n="array":/^\{(.|\n|\r)*\}$/.test(e)?n="object":/^[0-9]*$/.test(e)?n="number":e==="true"||e==="false"?n="boolean":e=="undefined"?n="undefined":e=="null"?n="null":e&&(n="string"),n}function F(e){switch((e[0]||"any").toLowerCase()){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":let t=F(e.splice(1));return t=t=="undefined"?"":t,`[${t}]`;case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function L(e){let n="";return e.forEach((t,r)=>{t=t.trim(),t&&(n&&(n+=" | "),t==="Array"?n+="Array<any>":n+=t)}),n||"any"}const g=(e,n)=>{let t=[],r=[],i="";for(let u=0;u<e.length;u++){const s=e[u];s==="["||s==="<"||s==="("?(t.push(s),i+=s):s==="]"&&t.length>0&&t[t.length-1]==="["||s===">"&&t.length>0&&t[t.length-1]==="<"||s===")"&&t.length>0&&t[t.length-1]==="("?(t.pop(),i+=s):s===n&&t.length===0?(r.push(i.trim()),i=""):i+=s}return i.trim()!==""&&r.push(i.trim()),r},C=e=>{if(e)if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=g(n,",");return{type:t[0]||"any",dataType:t}}else if(e.startsWith("<")&&e.endsWith(">")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=g(n,"|");return{type:t[0]||"any",dataType:t}}else return{type:e,dataType:[e]};else return{type:"any",dataType:["any"]}};function M(e){return g(e,",").map(t=>{const r=t.trim(),i=t.match(/^([^:?]+)(\??):/);if(!i)return null;const u=i[1].trim(),s=!i[2],j=i[0].length,c=t.substring(j).trim();let a=[],f="",p="";for(let l=0;l<c.length;l++){const o=c[l];if(o==="["||o==="<"||o==="("?a.push(o):(o==="]"&&a[a.length-1]==="["||o===">"&&a[a.length-1]==="<"||o===")"&&a[a.length-1]==="(")&&a.pop(),a.length===0&&l>0){l==1&&o!=="]"&&o!==">"&&o!==")"?(f="",p=c.substring(0)):(f=c.substring(0,l+1).trim(),p=c.substring(l+1));break}}const{type:N,dataType:m}=C(f),$=h(m);return{name:u,prop:u,type:$[0],dataType:m,must:s,label:r,description:p}}).filter(Boolean)}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>S.getFunctionFormat});exports.getFunBody=b;exports.getObjType=T;exports.getSonType=h;exports.getString=q;exports.getTypeValue=F;exports.isDefaultType=B;exports.isTypeEqual=E;exports.parseParamString=M;exports.prettierArrFormat=A;exports.prettierFormat=y;exports.prettierObjFormat=O;exports.setDataType=L;exports.vueFormat=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("@fangzhongya/utils/basic/string/toFunction"),A=require("@fangzhongya/utils/basic/string/firstLower");function y(e){return e.replace(/\;(\s|\n\r)*$/,"")}function O(e){return e="let a = "+e,y(e).replace(/^let a = /,"")}function v(e){return y(e)}function x(e,n=""){let t=(e+"").trim().split(/\n/);return t=t.map(r=>n+r),t.join(`
2
+ `)}function m(e=""){e=e.trim();let n=`[\\s|\\n|\\r]*\\{((.|
3
+ |\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+n+"$").exec(e);return r&&r.length>0?m(r[1]):e}const W=["Boolean","Any","String","Number","Array","Object","Function"];function k(e){return W.includes(e)?A.firstLower(e):e}function E(e){let t=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(t&&t.length>0)return{own:k(t[1]),son:t[2]}}function d(e,n){let t=E(e);t?(n.push(t.own),t.son&&d(t.son,n)):n.push(e)}function h(e){e instanceof Array&&(e=e[0]);const n=[];return e&&d(e,n),n}function T(e){const n=Object.prototype.toString.call(e);let r=/^\[[O|o]bject (.*)\]$/.exec(n),i=typeof e;return r&&r.length>0&&(i=r[1].toLowerCase()),i}function q(e,n){const t=T(e),r=h(n)[0];return r&&r!="any"?t==r:!0}function B(e){if(typeof e=="string"){let n=!1;return(/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e))&&(n=!0),n&&(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 L(e){const n=typeof e;if(n=="string"){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}else return n==="object"?e instanceof Array?"array":n===null?"null":n:n}function j(e){switch((e[0]||"any").toLowerCase()){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":let t=j(e.splice(1));return t=t=="undefined"?"":t,`[${t}]`;case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function C(e){let n="";return e.forEach((t,r)=>{t=t.trim(),t&&(n&&(n+=" | "),t==="Array"?n+="Array<any>":n+=t)}),n||"any"}const f=(e,n)=>{let t=[],r=[],i="";for(let u=0;u<e.length;u++){const s=e[u];s==="["||s==="<"||s==="("?(t.push(s),i+=s):s==="]"&&t.length>0&&t[t.length-1]==="["||s===">"&&t.length>0&&t[t.length-1]==="<"||s===")"&&t.length>0&&t[t.length-1]==="("?(t.pop(),i+=s):s===n&&t.length===0?(r.push(i.trim()),i=""):i+=s}return i.trim()!==""&&r.push(i.trim()),r},F=e=>{if(e)if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=f(n,",");return{type:t[0]||"any",dataType:t}}else if(e.startsWith("<")&&e.endsWith(">")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=f(n,"|");return{type:t[0]||"any",dataType:t}}else{const n=f(e,",");return{type:n[0]||"any",dataType:n}}else return{type:"any",dataType:["any"]}};function M(e){return f(e,",").map(t=>{const r=t.trim(),i=t.match(/^([^:?]+)(\??):/);if(!i)return null;const u=i[1].trim(),s=!i[2],$=i[0].length,c=t.substring($).trim();let a=[],p="",g="";for(let l=0;l<c.length;l++){const o=c[l];if(o==="["||o==="<"||o==="("?a.push(o):(o==="]"&&a[a.length-1]==="["||o===">"&&a[a.length-1]==="<"||o===")"&&a[a.length-1]==="(")&&a.pop(),a.length===0&&l>0){l==1&&o!=="]"&&o!==">"&&o!==")"?(p="",g=c.substring(0)):(p=c.substring(0,l+1).trim(),g=c.substring(l+1));break}}const{type:N,dataType:b}=F(p),S=h(b);return{name:u,prop:u,type:S[0],dataType:b,must:s,label:r,description:g}}).filter(Boolean)}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>w.getFunctionFormat});exports.getFunBody=m;exports.getObjType=T;exports.getSonType=h;exports.getString=B;exports.getTypeValue=j;exports.isDefaultType=L;exports.isTypeEqual=q;exports.parseParamString=M;exports.parseTypeDefinition=F;exports.prettierArrFormat=v;exports.prettierFormat=y;exports.prettierObjFormat=O;exports.setDataType=C;exports.vueFormat=x;
@@ -34,9 +34,13 @@ export declare function getString(st: unknown): string;
34
34
  /**
35
35
  * 配置字符串的类型
36
36
  */
37
- export declare function isDefaultType(st: string): string;
37
+ export declare function isDefaultType(st: any): string;
38
38
  export declare function getTypeValue(arr: string[]): string;
39
39
  export declare function setDataType(arr: string[]): string;
40
+ export declare const parseTypeDefinition: (typeDef: string) => {
41
+ type: string;
42
+ dataType: string[];
43
+ };
40
44
  export declare function parseParamString(input: string): Array<{
41
45
  name: string;
42
46
  prop: string;
@@ -3,10 +3,10 @@ import { firstLower as $ } from "@fangzhongya/utils/basic/string/firstLower";
3
3
  function h(e) {
4
4
  return e.replace(/\;(\s|\n\r)*$/, "");
5
5
  }
6
- function E(e) {
6
+ function v(e) {
7
7
  return e = "let a = " + e, h(e).replace(/^let a = /, "");
8
8
  }
9
- function v(e) {
9
+ function E(e) {
10
10
  return h(e);
11
11
  }
12
12
  function B(e, n = "") {
@@ -49,13 +49,13 @@ function b(e) {
49
49
  const n = [];
50
50
  return e && m(e, n), n;
51
51
  }
52
- function F(e) {
52
+ function A(e) {
53
53
  const n = Object.prototype.toString.call(e);
54
54
  let r = /^\[[O|o]bject (.*)\]$/.exec(n), i = typeof e;
55
55
  return r && r.length > 0 && (i = r[1].toLowerCase()), i;
56
56
  }
57
57
  function L(e, n) {
58
- const t = F(e), r = b(n)[0];
58
+ const t = A(e), r = b(n)[0];
59
59
  return r && r != "any" ? t == r : !0;
60
60
  }
61
61
  function C(e) {
@@ -65,11 +65,15 @@ function C(e) {
65
65
  } else return typeof e == "object" && e ? e.toString() : typeof e > "u" || typeof e == "object" && !e ? "" : e + "";
66
66
  }
67
67
  function N(e) {
68
- e = (e + "").replace(/^(\s|\n|r)*/, "").replace(/(\s|\n|r)*$/, "");
69
- let n = "";
70
- return /^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e) ? n = "string" : /^\[(.|\n|\r)*\]$/.test(e) ? n = "array" : /^\{(.|\n|\r)*\}$/.test(e) ? n = "object" : /^[0-9]*$/.test(e) ? n = "number" : e === "true" || e === "false" ? n = "boolean" : e == "undefined" ? n = "undefined" : e == "null" ? n = "null" : e && (n = "string"), n;
68
+ const n = typeof e;
69
+ if (n == "string") {
70
+ e = (e + "").replace(/^(\s|\n|r)*/, "").replace(/(\s|\n|r)*$/, "");
71
+ let t = "";
72
+ 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;
73
+ } else
74
+ return n === "object" ? e instanceof Array ? "array" : n === null ? "null" : n : n;
71
75
  }
72
- function A(e) {
76
+ function F(e) {
73
77
  switch ((e[0] || "any").toLowerCase()) {
74
78
  case "string":
75
79
  return '""';
@@ -78,7 +82,7 @@ function A(e) {
78
82
  case "number":
79
83
  return "0";
80
84
  case "array":
81
- let t = A(e.splice(1));
85
+ let t = F(e.splice(1));
82
86
  return t = t == "undefined" ? "" : t, `[${t}]`;
83
87
  case "object":
84
88
  return "{}";
@@ -96,7 +100,7 @@ function R(e) {
96
100
  t = t.trim(), t && (n && (n += " | "), t === "Array" ? n += "Array<any>" : n += t);
97
101
  }), n || "any";
98
102
  }
99
- const g = (e, n) => {
103
+ const f = (e, n) => {
100
104
  let t = [], r = [], i = "";
101
105
  for (let u = 0; u < e.length; u++) {
102
106
  const s = e[u];
@@ -108,7 +112,7 @@ const g = (e, n) => {
108
112
  if (e.startsWith("[") && e.endsWith("]") || e.startsWith("(") && e.endsWith(")")) {
109
113
  const n = e.slice(1, -1).trim();
110
114
  if (!n) return { type: "any", dataType: ["any"] };
111
- const t = g(n, ",");
115
+ const t = f(n, ",");
112
116
  return {
113
117
  type: t[0] || "any",
114
118
  dataType: t
@@ -116,32 +120,34 @@ const g = (e, n) => {
116
120
  } else if (e.startsWith("<") && e.endsWith(">")) {
117
121
  const n = e.slice(1, -1).trim();
118
122
  if (!n) return { type: "any", dataType: ["any"] };
119
- const t = g(n, "|");
123
+ const t = f(n, "|");
120
124
  return {
121
125
  type: t[0] || "any",
122
126
  dataType: t
123
127
  };
124
- } else
128
+ } else {
129
+ const n = f(e, ",");
125
130
  return {
126
- type: e,
127
- dataType: [e]
131
+ type: n[0] || "any",
132
+ dataType: n
128
133
  };
134
+ }
129
135
  else return { type: "any", dataType: ["any"] };
130
136
  };
131
137
  function q(e) {
132
- return g(e, ",").map((t) => {
138
+ return f(e, ",").map((t) => {
133
139
  const r = t.trim(), i = t.match(/^([^:?]+)(\??):/);
134
140
  if (!i) return null;
135
141
  const u = i[1].trim(), s = !i[2], d = i[0].length, c = t.substring(d).trim();
136
- let l = [], f = "", p = "";
142
+ let o = [], p = "", g = "";
137
143
  for (let a = 0; a < c.length; a++) {
138
- const o = c[a];
139
- if (o === "[" || o === "<" || o === "(" ? l.push(o) : (o === "]" && l[l.length - 1] === "[" || o === ">" && l[l.length - 1] === "<" || o === ")" && l[l.length - 1] === "(") && l.pop(), l.length === 0 && a > 0) {
140
- a == 1 && o !== "]" && o !== ">" && o !== ")" ? (f = "", p = c.substring(0)) : (f = c.substring(0, a + 1).trim(), p = c.substring(a + 1));
144
+ const l = c[a];
145
+ if (l === "[" || l === "<" || l === "(" ? o.push(l) : (l === "]" && o[o.length - 1] === "[" || l === ">" && o[o.length - 1] === "<" || l === ")" && o[o.length - 1] === "(") && o.pop(), o.length === 0 && a > 0) {
146
+ a == 1 && l !== "]" && l !== ">" && l !== ")" ? (p = "", g = c.substring(0)) : (p = c.substring(0, a + 1).trim(), g = c.substring(a + 1));
141
147
  break;
142
148
  }
143
149
  }
144
- const { type: k, dataType: y } = W(f), T = b(y);
150
+ const { type: k, dataType: y } = W(p), T = b(y);
145
151
  return {
146
152
  name: u,
147
153
  prop: u,
@@ -149,23 +155,24 @@ function q(e) {
149
155
  dataType: y,
150
156
  must: s,
151
157
  label: r,
152
- description: p
158
+ description: g
153
159
  };
154
160
  }).filter(Boolean);
155
161
  }
156
162
  export {
157
163
  j as getFunBody,
158
164
  M as getFunctionFormat,
159
- F as getObjType,
165
+ A as getObjType,
160
166
  b as getSonType,
161
167
  C as getString,
162
- A as getTypeValue,
168
+ F as getTypeValue,
163
169
  N as isDefaultType,
164
170
  L as isTypeEqual,
165
171
  q as parseParamString,
166
- v as prettierArrFormat,
172
+ W as parseTypeDefinition,
173
+ E as prettierArrFormat,
167
174
  h as prettierFormat,
168
- E as prettierObjFormat,
175
+ v as prettierObjFormat,
169
176
  R as setDataType,
170
177
  B as vueFormat
171
178
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.0.49",
4
+ "version": "0.0.51",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "@fangzhongya/create": "0.2.34",
22
- "@fangzhongya/utils": "0.0.27",
22
+ "@fangzhongya/utils": "0.0.28",
23
23
  "@fangzhongya/vue-components": "0.1.9",
24
24
  "@highlightjs/vue-plugin": "^2.1.0",
25
25
  "@types/node": "^24.2.1",