@fangzhongya/vue-archive 0.0.54 → 0.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/index.cjs +83 -30
- package/dist/node/index.js +83 -30
- package/dist/packages/components/compo/index.cjs +1 -1
- package/dist/packages/components/compo/index.js +126 -108
- package/dist/packages/components/use/code.cjs +10 -10
- package/dist/packages/components/use/code.js +99 -93
- package/dist/packages/components/use/util.cjs +3 -3
- package/dist/packages/components/use/util.js +38 -34
- package/dist/packages/utils/props.cjs +1 -1
- package/dist/packages/utils/props.js +30 -27
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getTextNotes as
|
|
1
|
+
import { getTextNotes as T } from "../../utils/index.js";
|
|
2
2
|
import "@fangzhongya/utils/basic/object/mergeObject";
|
|
3
3
|
import "@fangzhongya/utils/basic/array/toggleArray";
|
|
4
4
|
import "@fangzhongya/utils/name/humpToLine";
|
|
@@ -11,16 +11,16 @@ import "@fangzhongya/utils/basic/string/firstUpper";
|
|
|
11
11
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
12
12
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
13
13
|
import "@fangzhongya/utils/html/getVueText";
|
|
14
|
-
import { props as
|
|
15
|
-
const
|
|
14
|
+
import { props as u, emits as x, expose as d, slot as E } from "../../utils/props.js";
|
|
15
|
+
const p = {
|
|
16
16
|
titles: [],
|
|
17
17
|
propss: [],
|
|
18
18
|
slots: [],
|
|
19
19
|
emitss: [],
|
|
20
20
|
exposes: []
|
|
21
21
|
};
|
|
22
|
-
function
|
|
23
|
-
let r = e.charAt(0),
|
|
22
|
+
function k(e, l) {
|
|
23
|
+
let r = e.charAt(0), s = [
|
|
24
24
|
['"', '"'],
|
|
25
25
|
["'", "'"],
|
|
26
26
|
["`", "`"],
|
|
@@ -28,49 +28,49 @@ function O(e, s) {
|
|
|
28
28
|
["{", "}"],
|
|
29
29
|
["[", "]"]
|
|
30
30
|
];
|
|
31
|
-
const t =
|
|
31
|
+
const t = s.map((o) => o[0]);
|
|
32
32
|
if (t.indexOf(r) != -1) {
|
|
33
|
-
let
|
|
34
|
-
for (let
|
|
35
|
-
const
|
|
36
|
-
if (t.includes(
|
|
37
|
-
|
|
33
|
+
let o = [r];
|
|
34
|
+
for (let n = 1; n < e.length; n++) {
|
|
35
|
+
const i = e[n];
|
|
36
|
+
if (t.includes(i))
|
|
37
|
+
o.push(i);
|
|
38
38
|
else {
|
|
39
|
-
let
|
|
40
|
-
for (let
|
|
41
|
-
if (
|
|
42
|
-
|
|
39
|
+
let f = !1;
|
|
40
|
+
for (let m of s)
|
|
41
|
+
if (i === m[1] && o[o.length - 1] === m[0]) {
|
|
42
|
+
f = !0;
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
f && o.pop();
|
|
46
46
|
}
|
|
47
|
-
if (
|
|
48
|
-
return
|
|
47
|
+
if (o.length === 0)
|
|
48
|
+
return l && e[n + 1] === " ", e.substring(0, n + 1);
|
|
49
49
|
}
|
|
50
50
|
} else
|
|
51
|
-
return
|
|
51
|
+
return l ? e.substring(0, e.indexOf(" ")) : e;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function q(e) {
|
|
54
54
|
delete e.problems, delete e.source;
|
|
55
|
-
let
|
|
56
|
-
if (
|
|
57
|
-
r = r.trim(), r =
|
|
58
|
-
else if (
|
|
55
|
+
let l = e.tag, r = e.name, s = e.description, t = e.default, a = "", o = "";
|
|
56
|
+
if (l == "default")
|
|
57
|
+
r = r.trim(), r = k(r) || r;
|
|
58
|
+
else if (l == "selectable")
|
|
59
59
|
r = r.trim();
|
|
60
60
|
else {
|
|
61
61
|
if (r.includes("=")) {
|
|
62
|
-
const
|
|
63
|
-
r =
|
|
64
|
-
const
|
|
65
|
-
|
|
62
|
+
const f = r.split("=");
|
|
63
|
+
r = f[0];
|
|
64
|
+
const m = f[1] + " " + s, g = k(m, !0);
|
|
65
|
+
g ? (t = g, s = m.replace(g, "")) : t = e.default || f[1] || "";
|
|
66
66
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
67
|
+
const i = /\s*\((.*)\)\s/gi.exec(s);
|
|
68
|
+
i && i.length > 0 && (a = i[1], s = s.replace(i[0], ""));
|
|
69
69
|
}
|
|
70
|
-
return e.name = r, e.default = t || "", e.description =
|
|
70
|
+
return r.endsWith("*") && (o = "*", r = r.substring(0, r.length - 1)), e.name = r, e.required = o, e.default = t || "", e.description = s, e.selectable = a, e;
|
|
71
71
|
}
|
|
72
72
|
function y(e) {
|
|
73
|
-
let
|
|
73
|
+
let l = [
|
|
74
74
|
"title",
|
|
75
75
|
// 'name',
|
|
76
76
|
"text",
|
|
@@ -78,51 +78,52 @@ function y(e) {
|
|
|
78
78
|
"date"
|
|
79
79
|
// 'description',
|
|
80
80
|
// 'descriptions',
|
|
81
|
-
], r = b(e),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}),
|
|
81
|
+
], r = b(e), s = {};
|
|
82
|
+
l.forEach((t) => {
|
|
83
|
+
s[t] = r.obj[t];
|
|
84
|
+
}), O(s), r.arr.forEach((t) => {
|
|
85
85
|
h(t.key, t.value);
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
|
|
88
|
+
function O(e) {
|
|
89
|
+
p.titles.push(e);
|
|
90
90
|
}
|
|
91
91
|
function j(e) {
|
|
92
|
-
let
|
|
92
|
+
let l = [
|
|
93
93
|
"props",
|
|
94
94
|
"name",
|
|
95
95
|
"type",
|
|
96
96
|
"default",
|
|
97
|
+
"required",
|
|
97
98
|
"selectable",
|
|
98
99
|
"description",
|
|
99
100
|
"descriptions",
|
|
100
101
|
"return"
|
|
101
|
-
], r = b(e),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}), c(
|
|
102
|
+
], r = b(e), s = {};
|
|
103
|
+
l.forEach((t) => {
|
|
104
|
+
s[t] = r.obj[t];
|
|
105
|
+
}), c(s, "props"), r.arr.forEach((t) => {
|
|
105
106
|
h(t.key, t.value);
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
109
|
function w(e) {
|
|
109
|
-
let
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}), c(
|
|
110
|
+
let l = ["slot", "name", "selectable", "description", "descriptions"], r = b(e), s = {};
|
|
111
|
+
l.forEach((t) => {
|
|
112
|
+
s[t] = r.obj[t];
|
|
113
|
+
}), c(s, "slot"), r.arr.forEach((t) => {
|
|
113
114
|
h(t.key, t.value);
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
function F(e) {
|
|
117
|
-
let
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}), c(
|
|
118
|
+
let l = ["emits", "name", "selectable", "description", "descriptions"], r = b(e), s = {};
|
|
119
|
+
l.forEach((t) => {
|
|
120
|
+
s[t] = r.obj[t];
|
|
121
|
+
}), c(s, "emits"), r.arr.forEach((t) => {
|
|
121
122
|
h(t.key, t.value);
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
function N(e) {
|
|
125
|
-
let
|
|
126
|
+
let l = [
|
|
126
127
|
"expose",
|
|
127
128
|
"name",
|
|
128
129
|
"type",
|
|
@@ -130,132 +131,142 @@ function N(e) {
|
|
|
130
131
|
"selectable",
|
|
131
132
|
"description",
|
|
132
133
|
"descriptions"
|
|
133
|
-
], r = b(e),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}), c(
|
|
134
|
+
], r = b(e), s = {};
|
|
135
|
+
l.forEach((t) => {
|
|
136
|
+
s[t] = r.obj[t];
|
|
137
|
+
}), c(s, "expose"), r.arr.forEach((t) => {
|
|
137
138
|
h(t.key, t.value);
|
|
138
139
|
});
|
|
139
140
|
}
|
|
140
|
-
function c(e,
|
|
141
|
-
const r =
|
|
142
|
-
t >= 0 && (
|
|
141
|
+
function c(e, l) {
|
|
142
|
+
const r = p[l + "name"] || [], s = e.name ?? e[l]?.name, t = r.indexOf(s);
|
|
143
|
+
t >= 0 && (p[l + "s"].splice(t, 1), r.splice(t, 1)), p[l + "s"].push(e), r.push(s), p[l + "name"] = r;
|
|
143
144
|
}
|
|
144
145
|
function P() {
|
|
145
|
-
Object.keys(
|
|
146
|
-
|
|
146
|
+
Object.keys(p).forEach((e) => {
|
|
147
|
+
p[e] = [];
|
|
147
148
|
});
|
|
148
149
|
}
|
|
149
|
-
function b(e,
|
|
150
|
+
function b(e, l) {
|
|
150
151
|
const r = {
|
|
151
152
|
descriptions: e?.description || ""
|
|
152
|
-
},
|
|
153
|
+
}, s = [];
|
|
153
154
|
return e?.tags && e.tags?.forEach((t) => {
|
|
154
|
-
let
|
|
155
|
-
if (!r.hasOwnProperty(
|
|
156
|
-
r[
|
|
155
|
+
let a = t.tag, o = q(t);
|
|
156
|
+
if (!r.hasOwnProperty(a))
|
|
157
|
+
r[a] = o;
|
|
157
158
|
else {
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
key:
|
|
161
|
-
value:
|
|
159
|
+
const n = {};
|
|
160
|
+
n[a] = o, s.push({
|
|
161
|
+
key: a,
|
|
162
|
+
value: n
|
|
162
163
|
});
|
|
163
164
|
}
|
|
164
165
|
}), {
|
|
165
|
-
arr:
|
|
166
|
+
arr: s,
|
|
166
167
|
obj: r
|
|
167
168
|
};
|
|
168
169
|
}
|
|
169
|
-
function h(e,
|
|
170
|
+
function h(e, l) {
|
|
170
171
|
switch (e) {
|
|
171
172
|
case "title":
|
|
172
|
-
return
|
|
173
|
+
return O(l), !0;
|
|
173
174
|
case "text":
|
|
174
|
-
return
|
|
175
|
+
return O(l), !0;
|
|
175
176
|
case "props":
|
|
176
|
-
return c(
|
|
177
|
+
return c(l, "props"), !0;
|
|
177
178
|
case "slot":
|
|
178
|
-
return c(
|
|
179
|
+
return c(l, "slot"), !0;
|
|
179
180
|
case "emits":
|
|
180
|
-
return c(
|
|
181
|
+
return c(l, "emits"), !0;
|
|
181
182
|
case "expose":
|
|
182
|
-
return c(
|
|
183
|
+
return c(l, "expose"), !0;
|
|
183
184
|
default:
|
|
184
185
|
return !1;
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
|
-
function S(e,
|
|
188
|
+
function S(e, l) {
|
|
188
189
|
switch (e) {
|
|
189
190
|
case "title":
|
|
190
|
-
return y(
|
|
191
|
+
return y(l), !0;
|
|
191
192
|
case "props":
|
|
192
|
-
return j(
|
|
193
|
+
return j(l), !0;
|
|
193
194
|
case "slot":
|
|
194
|
-
return w(
|
|
195
|
+
return w(l), !0;
|
|
195
196
|
case "emits":
|
|
196
|
-
return F(
|
|
197
|
+
return F(l), !0;
|
|
197
198
|
case "expose":
|
|
198
|
-
return N(
|
|
199
|
+
return N(l), !0;
|
|
199
200
|
default:
|
|
200
201
|
return !1;
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
|
-
function
|
|
204
|
-
return P(), e?.forEach((
|
|
205
|
-
let r =
|
|
206
|
-
if (
|
|
207
|
-
for (let t = 0; t <
|
|
208
|
-
const
|
|
209
|
-
if (S(
|
|
204
|
+
function z(e) {
|
|
205
|
+
return P(), e?.forEach((l) => {
|
|
206
|
+
let r = l?.tags || [], s = r?.length || 0;
|
|
207
|
+
if (s > 0)
|
|
208
|
+
for (let t = 0; t < s; t++) {
|
|
209
|
+
const a = r[t] || {};
|
|
210
|
+
if (S(a.tag, l))
|
|
210
211
|
break;
|
|
211
212
|
}
|
|
212
|
-
}),
|
|
213
|
+
}), p;
|
|
213
214
|
}
|
|
214
215
|
function Q(e) {
|
|
215
|
-
let
|
|
216
|
-
return
|
|
216
|
+
let l = T(e);
|
|
217
|
+
return z(l);
|
|
217
218
|
}
|
|
218
219
|
const R = [
|
|
219
220
|
{
|
|
220
221
|
label: "属性名",
|
|
221
222
|
prop: "name",
|
|
222
|
-
formatter:
|
|
223
|
+
formatter: u.name
|
|
223
224
|
},
|
|
224
225
|
{
|
|
225
226
|
label: "说明",
|
|
226
227
|
prop: "description",
|
|
227
|
-
formatter:
|
|
228
|
+
formatter: u.description
|
|
228
229
|
},
|
|
229
230
|
{
|
|
230
231
|
label: "类型",
|
|
231
232
|
prop: "type",
|
|
232
|
-
formatter:
|
|
233
|
+
formatter: u.type
|
|
233
234
|
},
|
|
234
235
|
{
|
|
235
236
|
label: "可选值",
|
|
236
237
|
prop: "selectable",
|
|
237
|
-
formatter:
|
|
238
|
+
formatter: u.selectable
|
|
238
239
|
},
|
|
239
240
|
{
|
|
240
241
|
label: "默认值",
|
|
241
242
|
prop: "default",
|
|
242
|
-
formatter:
|
|
243
|
+
formatter: u.default
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
label: "必传",
|
|
247
|
+
prop: "required",
|
|
248
|
+
formatter: u.required
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
label: "方法返回值",
|
|
252
|
+
prop: "return",
|
|
253
|
+
formatter: u.return
|
|
243
254
|
}
|
|
244
255
|
], U = [
|
|
245
256
|
{
|
|
246
257
|
label: "事件名",
|
|
247
258
|
prop: "name",
|
|
248
|
-
formatter:
|
|
259
|
+
formatter: x.name
|
|
249
260
|
},
|
|
250
261
|
{
|
|
251
262
|
label: "说明",
|
|
252
263
|
prop: "description",
|
|
253
|
-
formatter:
|
|
264
|
+
formatter: x.description
|
|
254
265
|
},
|
|
255
266
|
{
|
|
256
267
|
label: "回调参数",
|
|
257
268
|
prop: "selectable",
|
|
258
|
-
formatter:
|
|
269
|
+
formatter: x.selectable
|
|
259
270
|
}
|
|
260
271
|
], V = [
|
|
261
272
|
{
|
|
@@ -275,26 +286,33 @@ const R = [
|
|
|
275
286
|
},
|
|
276
287
|
{
|
|
277
288
|
label: "返回值",
|
|
289
|
+
prop: "return",
|
|
290
|
+
formatter(e) {
|
|
291
|
+
return d.return(e) || e.expose.default || "";
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
label: "类型",
|
|
278
296
|
prop: "type",
|
|
279
297
|
formatter(e) {
|
|
280
|
-
return d.
|
|
298
|
+
return d.type(e) || "function";
|
|
281
299
|
}
|
|
282
300
|
}
|
|
283
|
-
],
|
|
301
|
+
], X = [
|
|
284
302
|
{
|
|
285
303
|
label: "插槽名",
|
|
286
304
|
prop: "name",
|
|
287
|
-
formatter:
|
|
305
|
+
formatter: E.name
|
|
288
306
|
},
|
|
289
307
|
{
|
|
290
308
|
label: "说明",
|
|
291
309
|
prop: "description",
|
|
292
|
-
formatter:
|
|
310
|
+
formatter: E.description
|
|
293
311
|
},
|
|
294
312
|
{
|
|
295
313
|
label: "作用域参数",
|
|
296
314
|
prop: "selectable",
|
|
297
|
-
formatter:
|
|
315
|
+
formatter: E.selectable
|
|
298
316
|
}
|
|
299
317
|
];
|
|
300
318
|
export {
|
|
@@ -302,5 +320,5 @@ export {
|
|
|
302
320
|
U as temits,
|
|
303
321
|
V as texpose,
|
|
304
322
|
R as tprops,
|
|
305
|
-
|
|
323
|
+
X as tslot
|
|
306
324
|
};
|
|
@@ -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 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
|
|
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 a=require("./util.cjs"),T=require("../../utils/props.cjs"),J=require("@fangzhongya/utils/basic/string/toFunction"),N=["class"];function q(e,n){return e.filter(s=>s.name==n)[0]}function L(e){return e.map(n=>(n.prop||"...arr")+":"+a.setDataType(n.dataType)).join(",")}function A(e,n,s,t,o,h){const g=[],r=[];let b=!0;const v=T.getPropsValue(n.propss||[]),x=T.getEmitsValue(n.emitss||[]),B=T.getExposeValue(n.exposes||[]),C=T.getSlotValue(n.slots||[]);Object.keys(s).forEach(i=>{let u=s[i];if(/^on[A-Z]/.test(i)&&typeof u=="function"){let c=i.substring(2);const f=i.split(":");let l;if(f.length>1?(l=f[0]+f.slice(1).map(m=>w.firstUpper(m)).join(""),c=H.firstLower(c)):(l=f[0],c=z.humpToLine(c)),f.includes("-")){let m=l.split("-");m=m.map(($,V)=>V!=0?w.firstUpper($):$),l=m.join("")}g.push(" @"+c+'="'+l+'"');const p=q(x,c)||{},d=p.selectable||"",S=a.parseParamString(d),y=L(S);r.push(`// ${p.description} ${p.name}: (${p.selectable})`),r.push("function "+l+"("+y+") {"),S.forEach(m=>{const $=m.name||"arr";r.push(" console.log('"+m.label+"', "+$+")")}),r.push("}")}else{let c=i;N.includes(i)&&(c=i+"1"),g.push(" :"+i+'="'+c+'"');const f=q(v,i)||{},l=E(f);if(r.push(`// ${f.description} ${f.name}: {${f.type}} (${f.selectable})`),typeof u=="function"||l.dataType.length==1&&l.type=="function"&&u)r.push("const "+i+" = "+P(u,i,o));else if(b&&(b=!1,r.unshift("import { ref } from 'vue';")),typeof u>"u")if(l.type=="function"){const p=Z(f);r.push("const "+c+" = "+p+";")}else{const p=a.getTypeValue(l.dataType);r.push("const "+c+" = ref("+(p==="undefined"?"":p)+");")}else{let p=j(u,i,o);r.push("const "+c+" = ref("+p+");")}}});const O=Object.values(h||{});O.length>0&&(b&&(b=!1,r.unshift("import { ref } from 'vue';")),g.unshift(' ref="refDom"'),r.push("const refDom = ref()"),O.forEach(i=>{const u=q(B,i.name)||{};r.push(`// ${u.description} ${u.name}:(${u.selectable}) ${u.type}`);const c=i.name+"Value",f=a.parseParamString(u?.selectable||""),l=[],p=i.params||[];f.forEach((d,S)=>{const y=d.name;if(y){const m=y+i.name,$=p[S];if(r.push(`// ${d.label}`),typeof $=="function")r.push("const "+m+" = "+P($,y,i.text));else if(typeof $>"u")r.push("const "+m+" = "+a.getTypeValue(d.dataType)+";");else{let V=j($,y,i.text);r.push("const "+m+" = "+V+";")}l.push(m)}}),i.type==="function"?(u.return?r.push(`const ${c} = refDom.value?.${i.name}(${l.join(", ")})`):r.push(`refDom.value?.${i.name}(${l.join(", ")})`),u.return&&r.push(`console.log('${u.return}', ${c})`)):(r.push(`const ${c} = refDom.value?.${i.name}`),r.push(`console.log('${u.type||u.name}', ${c})`))})),g.length>0&&g.unshift("");const U=M(t,C);return`<!--${e}-->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
|
-
<${e}${
|
|
4
|
+
<${e}${g.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 M(e={},
|
|
15
|
-
<template #${
|
|
16
|
-
${
|
|
17
|
-
</template>`;s.push(
|
|
18
|
-
${
|
|
19
|
-
}`;return`function (${t.
|
|
20
|
-
${
|
|
21
|
-
}`;return`function (${s}) ${o}`}function G(e){const
|
|
14
|
+
`}function M(e={},n){const s=[];return Object.keys(e).forEach(t=>{const o=q(n,t)||{},h=e[t];if(h){const g=` <!-- ${o.description} ${o.name}:(${o.selectable}) -->
|
|
15
|
+
<template #${t}="scope">
|
|
16
|
+
${a.vueFormat(h," ")}
|
|
17
|
+
</template>`;s.push(g)}}),s&&s.length>0&&s.unshift(""),s}function P(e,n,s){const t=s?s[n]:"";return t&&(t.includes("=>")||t.includes("function"))?t:F(e.toString())}function F(e){const n=J.getFunctionFormat(a.prettierFormat(e));if(n){let s=`{
|
|
18
|
+
${a.vueFormat(a.getFunBody(n.body)," ")}
|
|
19
|
+
}`;return`function (${n.param.split(",").map(t=>t+":any").join(",")}) ${s}`}else return"undefined"}function Z(e){const n=a.parseParamString(e.selectable),s=L(n);let t="";e.return&&(t="return ");let o=`{
|
|
20
|
+
${a.vueFormat(a.getFunBody(t)," ")}
|
|
21
|
+
}`;return`function (${s}) ${o}`}function G(e){const n=e.trim();return/^\(/.test(n)?F(n):JSON.stringify(e)}function j(e,n,s){const t=s?s[n]:"";return t||(typeof e=="string"?G(e+""):JSON.stringify(e))}function E(e){let n=a.parseTypeDefinition(e?.type),s=n.dataType,t=n.type;t=t.split("<")[0],t=t.trim().toLowerCase(),s.length>1&&(t="any");let o=(e?.selectable||"").trim(),h=[];return o&&t!="boolean"&&(o.includes("|")?o.split("|").forEach(g=>{if(g){let r=g.split(":");h.push({label:g,prop:D(r[0].trim())})}}):h=a.parseParamString(o),t=="array"?t="choice":t!="function"&&h.length>1&&(t="select")),{arr:h,type:t,dataType:s}}function D(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 I(e,n=!0){const s=E(e),t=a.getTypeValue(s.dataType);if(n){const o=(e.default||"").trim();return D(o||t,s.dataType[0])}else{const o=(e.default||"").trim();return D(o,s.dataType[0])}}exports.getDefaultValue=I;exports.getHmtl=A;exports.getSpecType=E;exports.setValStringify=j;
|