@wibetter/json-utils 6.0.1 → 6.0.2
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/README.md +4 -5
- package/dist/index.esm.js +572 -5501
- package/dist/index.esm.min.js +1 -4535
- package/dist/index.js +1 -1600
- package/dist/index.js.LICENSE.txt +2 -2
- package/dist/types/data/KeyWordList.d.ts +1 -0
- package/dist/types/data/TypeDataList.d.ts +129 -0
- package/dist/types/data/index.d.ts +31 -0
- package/dist/types/data/initSchemaEntity/Api.d.ts +43 -0
- package/dist/types/data/initSchemaEntity/Array.d.ts +20 -0
- package/dist/types/data/initSchemaEntity/Boolean.d.ts +6 -0
- package/dist/types/data/initSchemaEntity/BoxStyle.d.ts +32 -0
- package/dist/types/data/initSchemaEntity/Cascader.d.ts +20 -0
- package/dist/types/data/initSchemaEntity/Checkbox.d.ts +10 -0
- package/dist/types/data/initSchemaEntity/CodeArea.d.ts +7 -0
- package/dist/types/data/initSchemaEntity/Color.d.ts +6 -0
- package/dist/types/data/initSchemaEntity/DataSource.d.ts +73 -0
- package/dist/types/data/initSchemaEntity/Date.d.ts +7 -0
- package/dist/types/data/initSchemaEntity/DateTime.d.ts +7 -0
- package/dist/types/data/initSchemaEntity/DynamicData.d.ts +105 -0
- package/dist/types/data/initSchemaEntity/EmptyArray.d.ts +12 -0
- package/dist/types/data/initSchemaEntity/EmptyObject.d.ts +6 -0
- package/dist/types/data/initSchemaEntity/Event.d.ts +96 -0
- package/dist/types/data/initSchemaEntity/FuncBody.d.ts +7 -0
- package/dist/types/data/initSchemaEntity/HtmlArea.d.ts +7 -0
- package/dist/types/data/initSchemaEntity/IMG.d.ts +12 -0
- package/dist/types/data/initSchemaEntity/Input.d.ts +7 -0
- package/dist/types/data/initSchemaEntity/InputImage.d.ts +7 -0
- package/dist/types/data/initSchemaEntity/JSONSchema.d.ts +60 -0
- package/dist/types/data/initSchemaEntity/Json.d.ts +6 -0
- package/dist/types/data/initSchemaEntity/Number.d.ts +8 -0
- package/dist/types/data/initSchemaEntity/Object.d.ts +24 -0
- package/dist/types/data/initSchemaEntity/PaddingMargin.d.ts +38 -0
- package/dist/types/data/initSchemaEntity/Quantity.d.ts +34 -0
- package/dist/types/data/initSchemaEntity/Radio.d.ts +9 -0
- package/dist/types/data/initSchemaEntity/Select.d.ts +9 -0
- package/dist/types/data/initSchemaEntity/TextEditor.d.ts +7 -0
- package/dist/types/data/initSchemaEntity/Textarea.d.ts +7 -0
- package/dist/types/data/initSchemaEntity/Time.d.ts +7 -0
- package/dist/types/data/initSchemaEntity/URL.d.ts +7 -0
- package/dist/types/function/getExpectType.d.ts +2 -0
- package/dist/types/function/getJsonDataByKeyRoute.d.ts +8 -0
- package/dist/types/function/getSchemaByIndexRoute.d.ts +8 -0
- package/dist/types/function/getSchemaByKeyRoute.d.ts +8 -0
- package/dist/types/function/indexRoute2keyRoute.d.ts +7 -0
- package/dist/types/function/json2schema.d.ts +4 -0
- package/dist/types/function/json2treeData.d.ts +8 -0
- package/dist/types/function/keyRoute2indexRoute.d.ts +7 -0
- package/dist/types/function/metaElemAnalyzer.d.ts +2 -0
- package/dist/types/function/oldSchemaToNewSchema.d.ts +2 -0
- package/dist/types/function/schema2conditionValue.d.ts +4 -0
- package/dist/types/function/schema2json.d.ts +5 -0
- package/dist/types/function/schemaMetaList.d.ts +1 -0
- package/dist/types/main.d.ts +74 -0
- package/dist/types/utils/index.d.ts +24 -0
- package/dist/types/utils/jsonData.d.ts +8 -0
- package/dist/types/utils/jsonSchema.d.ts +55 -0
- package/dist/types/utils/typeof.d.ts +32 -0
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -1,1601 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!(function (e, t) {
|
|
3
|
-
'object' == typeof exports && 'object' == typeof module
|
|
4
|
-
? (module.exports = t())
|
|
5
|
-
: 'function' == typeof define && define.amd
|
|
6
|
-
? define([], t)
|
|
7
|
-
: 'object' == typeof exports
|
|
8
|
-
? (exports.JSONUtils = t())
|
|
9
|
-
: (e.JSONUtils = t());
|
|
10
|
-
})(this, function () {
|
|
11
|
-
return (function () {
|
|
12
|
-
'use strict';
|
|
13
|
-
var e = {
|
|
14
|
-
n: function (t) {
|
|
15
|
-
var r =
|
|
16
|
-
t && t.__esModule
|
|
17
|
-
? function () {
|
|
18
|
-
return t.default;
|
|
19
|
-
}
|
|
20
|
-
: function () {
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
return e.d(r, { a: r }), r;
|
|
24
|
-
},
|
|
25
|
-
d: function (t, r) {
|
|
26
|
-
for (var i in r)
|
|
27
|
-
e.o(r, i) &&
|
|
28
|
-
!e.o(t, i) &&
|
|
29
|
-
Object.defineProperty(t, i, { enumerable: !0, get: r[i] });
|
|
30
|
-
},
|
|
31
|
-
o: function (e, t) {
|
|
32
|
-
return Object.prototype.hasOwnProperty.call(e, t);
|
|
33
|
-
},
|
|
34
|
-
r: function (e) {
|
|
35
|
-
'undefined' != typeof Symbol &&
|
|
36
|
-
Symbol.toStringTag &&
|
|
37
|
-
Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
|
|
38
|
-
Object.defineProperty(e, '__esModule', { value: !0 });
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
t = {};
|
|
42
|
-
e.r(t),
|
|
43
|
-
e.d(t, {
|
|
44
|
-
DataSourceTypeList: function () {
|
|
45
|
-
return d;
|
|
46
|
-
},
|
|
47
|
-
EventTypeDataList: function () {
|
|
48
|
-
return s;
|
|
49
|
-
},
|
|
50
|
-
KeyWordList: function () {
|
|
51
|
-
return be;
|
|
52
|
-
},
|
|
53
|
-
TypeDataList: function () {
|
|
54
|
-
return c;
|
|
55
|
-
},
|
|
56
|
-
dataRoute2dataPath: function () {
|
|
57
|
-
return de;
|
|
58
|
-
},
|
|
59
|
-
dynamicDataAnalyzer: function () {
|
|
60
|
-
return se;
|
|
61
|
-
},
|
|
62
|
-
evalExpression: function () {
|
|
63
|
-
return U;
|
|
64
|
-
},
|
|
65
|
-
getCurPosition: function () {
|
|
66
|
-
return Y;
|
|
67
|
-
},
|
|
68
|
-
getDefaultOptionVal: function () {
|
|
69
|
-
return ae;
|
|
70
|
-
},
|
|
71
|
-
getExpectType: function () {
|
|
72
|
-
return H;
|
|
73
|
-
},
|
|
74
|
-
getJsonDataByKeyRoute: function () {
|
|
75
|
-
return P;
|
|
76
|
-
},
|
|
77
|
-
getNextIndexRoute: function () {
|
|
78
|
-
return te;
|
|
79
|
-
},
|
|
80
|
-
getParentIndexRoute: function () {
|
|
81
|
-
return ee;
|
|
82
|
-
},
|
|
83
|
-
getParentIndexRoute_CurIndex: function () {
|
|
84
|
-
return re;
|
|
85
|
-
},
|
|
86
|
-
getParentKeyRoute: function () {
|
|
87
|
-
return me;
|
|
88
|
-
},
|
|
89
|
-
getParentKeyRoute_CurKey: function () {
|
|
90
|
-
return ve;
|
|
91
|
-
},
|
|
92
|
-
getSchemaByIndexRoute: function () {
|
|
93
|
-
return E;
|
|
94
|
-
},
|
|
95
|
-
getSchemaByKeyRoute: function () {
|
|
96
|
-
return J;
|
|
97
|
-
},
|
|
98
|
-
hasProperties: function () {
|
|
99
|
-
return w;
|
|
100
|
-
},
|
|
101
|
-
indexRoute2keyRoute: function () {
|
|
102
|
-
return A;
|
|
103
|
-
},
|
|
104
|
-
isArray: function () {
|
|
105
|
-
return j;
|
|
106
|
-
},
|
|
107
|
-
isBoolean: function () {
|
|
108
|
-
return v;
|
|
109
|
-
},
|
|
110
|
-
isColor: function () {
|
|
111
|
-
return S;
|
|
112
|
-
},
|
|
113
|
-
isContainerSchema: function () {
|
|
114
|
-
return Q;
|
|
115
|
-
},
|
|
116
|
-
isDateStr: function () {
|
|
117
|
-
return b;
|
|
118
|
-
},
|
|
119
|
-
isDateTimeStr: function () {
|
|
120
|
-
return g;
|
|
121
|
-
},
|
|
122
|
-
isEmptySchema: function () {
|
|
123
|
-
return W;
|
|
124
|
-
},
|
|
125
|
-
isEqual: function () {
|
|
126
|
-
return R;
|
|
127
|
-
},
|
|
128
|
-
isEqualByIdT: function () {
|
|
129
|
-
return F;
|
|
130
|
-
},
|
|
131
|
-
isFunction: function () {
|
|
132
|
-
return k;
|
|
133
|
-
},
|
|
134
|
-
isNewSchemaData: function () {
|
|
135
|
-
return Z;
|
|
136
|
-
},
|
|
137
|
-
isNumber: function () {
|
|
138
|
-
return m;
|
|
139
|
-
},
|
|
140
|
-
isObject: function () {
|
|
141
|
-
return x;
|
|
142
|
-
},
|
|
143
|
-
isQuantity: function () {
|
|
144
|
-
return q;
|
|
145
|
-
},
|
|
146
|
-
isSameParent: function () {
|
|
147
|
-
return X;
|
|
148
|
-
},
|
|
149
|
-
isSelect: function () {
|
|
150
|
-
return O;
|
|
151
|
-
},
|
|
152
|
-
isString: function () {
|
|
153
|
-
return y;
|
|
154
|
-
},
|
|
155
|
-
isStructuredSchema: function () {
|
|
156
|
-
return G;
|
|
157
|
-
},
|
|
158
|
-
isTimeStr: function () {
|
|
159
|
-
return h;
|
|
160
|
-
},
|
|
161
|
-
isURL: function () {
|
|
162
|
-
return f;
|
|
163
|
-
},
|
|
164
|
-
json2schema: function () {
|
|
165
|
-
return B;
|
|
166
|
-
},
|
|
167
|
-
json2treeData: function () {
|
|
168
|
-
return fe;
|
|
169
|
-
},
|
|
170
|
-
keyRoute2indexRoute: function () {
|
|
171
|
-
return $;
|
|
172
|
-
},
|
|
173
|
-
metaElemAnalyzer: function () {
|
|
174
|
-
return z;
|
|
175
|
-
},
|
|
176
|
-
moveBackward: function () {
|
|
177
|
-
return ne;
|
|
178
|
-
},
|
|
179
|
-
moveForward: function () {
|
|
180
|
-
return ie;
|
|
181
|
-
},
|
|
182
|
-
objClone: function () {
|
|
183
|
-
return D;
|
|
184
|
-
},
|
|
185
|
-
oldSchemaToNewSchema: function () {
|
|
186
|
-
return K;
|
|
187
|
-
},
|
|
188
|
-
oldSchemaToNewSchemaV1: function () {
|
|
189
|
-
return I;
|
|
190
|
-
},
|
|
191
|
-
registerExpectType: function () {
|
|
192
|
-
return V;
|
|
193
|
-
},
|
|
194
|
-
schema2conditionValue: function () {
|
|
195
|
-
return ye;
|
|
196
|
-
},
|
|
197
|
-
schema2json: function () {
|
|
198
|
-
return le;
|
|
199
|
-
},
|
|
200
|
-
schemaMetaList: function () {
|
|
201
|
-
return ce;
|
|
202
|
-
},
|
|
203
|
-
truncate: function () {
|
|
204
|
-
return C;
|
|
205
|
-
},
|
|
206
|
-
urlParse: function () {
|
|
207
|
-
return T;
|
|
208
|
-
},
|
|
209
|
-
urlStringify: function () {
|
|
210
|
-
return N;
|
|
211
|
-
},
|
|
212
|
-
});
|
|
213
|
-
var r,
|
|
214
|
-
i = require('lodash'),
|
|
215
|
-
n = require('qs'),
|
|
216
|
-
a = e.n(n),
|
|
217
|
-
o = {
|
|
218
|
-
type: 'event',
|
|
219
|
-
title: '事件',
|
|
220
|
-
isContainer: !1,
|
|
221
|
-
properties: {
|
|
222
|
-
type: {
|
|
223
|
-
default: 'emit',
|
|
224
|
-
type: 'select',
|
|
225
|
-
options: [
|
|
226
|
-
{ label: 'on', value: 'on' },
|
|
227
|
-
{ label: 'emit', value: 'emit' },
|
|
228
|
-
],
|
|
229
|
-
title: '事件类型',
|
|
230
|
-
},
|
|
231
|
-
trigger: {
|
|
232
|
-
type: 'input',
|
|
233
|
-
default: 'eventName',
|
|
234
|
-
title: '触发事件',
|
|
235
|
-
description: '用于输入触发事件的名称',
|
|
236
|
-
placeholder: '请输入触发事件的名称',
|
|
237
|
-
},
|
|
238
|
-
eventData: {
|
|
239
|
-
title: '事件数据',
|
|
240
|
-
type: 'json',
|
|
241
|
-
default: '{}',
|
|
242
|
-
description: '传递给触发事件的数据对象',
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
propertyOrder: ['type', 'trigger', 'eventData'],
|
|
246
|
-
},
|
|
247
|
-
p = {
|
|
248
|
-
type: 'datasource',
|
|
249
|
-
title: '数据源',
|
|
250
|
-
isContainer: !1,
|
|
251
|
-
properties: {
|
|
252
|
-
type: {
|
|
253
|
-
default: 'local',
|
|
254
|
-
type: 'select',
|
|
255
|
-
options: [
|
|
256
|
-
{ label: '本地数据', value: 'local' },
|
|
257
|
-
{ label: '接口数据', value: 'remote' },
|
|
258
|
-
],
|
|
259
|
-
title: '数据源类型',
|
|
260
|
-
},
|
|
261
|
-
data: {
|
|
262
|
-
title: '本地json数据',
|
|
263
|
-
placeholder: '请输入静态json数据',
|
|
264
|
-
type: 'json',
|
|
265
|
-
default: '{}',
|
|
266
|
-
description: '用于设置本地的静态json数据',
|
|
267
|
-
isRequired: !0,
|
|
268
|
-
},
|
|
269
|
-
filter: {
|
|
270
|
-
title: '过滤器',
|
|
271
|
-
type: 'codearea',
|
|
272
|
-
default: '() => {}',
|
|
273
|
-
description: '用于定义过滤当前数据的函数',
|
|
274
|
-
isRequired: !0,
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
propertyOrder: ['type', 'data', 'filter'],
|
|
278
|
-
},
|
|
279
|
-
u =
|
|
280
|
-
(((r = { type: 'object' }).type = 'datasource'),
|
|
281
|
-
(r.title = '数据源'),
|
|
282
|
-
(r.isContainer = !1),
|
|
283
|
-
(r.properties = {
|
|
284
|
-
type: {
|
|
285
|
-
type: 'select',
|
|
286
|
-
default: 'remote',
|
|
287
|
-
options: [
|
|
288
|
-
{ label: '本地数据', value: 'local' },
|
|
289
|
-
{ label: '接口数据', value: 'remote' },
|
|
290
|
-
],
|
|
291
|
-
title: '数据源类型',
|
|
292
|
-
},
|
|
293
|
-
data: {
|
|
294
|
-
type: 'url',
|
|
295
|
-
title: '远程json数据',
|
|
296
|
-
placeholder: '请输入远程json数据源地址',
|
|
297
|
-
default: 'http://xxx',
|
|
298
|
-
isRequired: !0,
|
|
299
|
-
description: '用于设置获取元素数据的请求地址',
|
|
300
|
-
},
|
|
301
|
-
filter: {
|
|
302
|
-
type: 'codearea',
|
|
303
|
-
title: '过滤器',
|
|
304
|
-
default: '() => {}',
|
|
305
|
-
description: '用于定义过滤当前数据的函数',
|
|
306
|
-
isRequired: !0,
|
|
307
|
-
},
|
|
308
|
-
}),
|
|
309
|
-
(r.propertyOrder = ['type', 'data', 'filter']),
|
|
310
|
-
r),
|
|
311
|
-
l = {
|
|
312
|
-
type: 'local',
|
|
313
|
-
config: { dataName: '', body: {}, filter: 'return data;' },
|
|
314
|
-
data: '{}',
|
|
315
|
-
localFilter: 'return data;',
|
|
316
|
-
},
|
|
317
|
-
c = {
|
|
318
|
-
jsonschema: {
|
|
319
|
-
type: 'object',
|
|
320
|
-
title: 'jsonSchemaObject',
|
|
321
|
-
properties: {
|
|
322
|
-
func: {
|
|
323
|
-
type: 'object',
|
|
324
|
-
title: '功能设置',
|
|
325
|
-
properties: {
|
|
326
|
-
a: {
|
|
327
|
-
title: '单文本框',
|
|
328
|
-
type: 'input',
|
|
329
|
-
default: '',
|
|
330
|
-
description: '',
|
|
331
|
-
placeholder: '',
|
|
332
|
-
isRequired: !1,
|
|
333
|
-
},
|
|
334
|
-
},
|
|
335
|
-
propertyOrder: ['a'],
|
|
336
|
-
},
|
|
337
|
-
style: {
|
|
338
|
-
type: 'object',
|
|
339
|
-
title: '样式设置',
|
|
340
|
-
properties: {
|
|
341
|
-
b: {
|
|
342
|
-
title: '单文本框',
|
|
343
|
-
type: 'input',
|
|
344
|
-
default: '',
|
|
345
|
-
description: '',
|
|
346
|
-
placeholder: '',
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
propertyOrder: ['b'],
|
|
350
|
-
},
|
|
351
|
-
data: {
|
|
352
|
-
type: 'data',
|
|
353
|
-
title: '数据设置',
|
|
354
|
-
properties: {
|
|
355
|
-
c: {
|
|
356
|
-
title: '单文本框',
|
|
357
|
-
type: 'input',
|
|
358
|
-
default: '',
|
|
359
|
-
description: '',
|
|
360
|
-
placeholder: '',
|
|
361
|
-
isRequired: !1,
|
|
362
|
-
},
|
|
363
|
-
},
|
|
364
|
-
propertyOrder: ['c'],
|
|
365
|
-
},
|
|
366
|
-
},
|
|
367
|
-
propertyOrder: ['func', 'style', 'data'],
|
|
368
|
-
},
|
|
369
|
-
input: {
|
|
370
|
-
title: '单文本框',
|
|
371
|
-
type: 'input',
|
|
372
|
-
default: '',
|
|
373
|
-
description: '',
|
|
374
|
-
placeholder: '',
|
|
375
|
-
},
|
|
376
|
-
boolean: {
|
|
377
|
-
type: 'boolean',
|
|
378
|
-
title: '布尔值',
|
|
379
|
-
default: !1,
|
|
380
|
-
description: '',
|
|
381
|
-
},
|
|
382
|
-
object: {
|
|
383
|
-
type: 'object',
|
|
384
|
-
title: '对象Object',
|
|
385
|
-
description: '',
|
|
386
|
-
properties: {
|
|
387
|
-
a: {
|
|
388
|
-
type: 'input',
|
|
389
|
-
title: '单文本框',
|
|
390
|
-
default: '',
|
|
391
|
-
description: '',
|
|
392
|
-
placeholder: '',
|
|
393
|
-
},
|
|
394
|
-
},
|
|
395
|
-
propertyOrder: ['a'],
|
|
396
|
-
},
|
|
397
|
-
array: {
|
|
398
|
-
type: 'array',
|
|
399
|
-
title: '数组Array',
|
|
400
|
-
description: '',
|
|
401
|
-
items: {
|
|
402
|
-
type: 'object',
|
|
403
|
-
title: '数组项',
|
|
404
|
-
description: '',
|
|
405
|
-
properties: {
|
|
406
|
-
name: {
|
|
407
|
-
type: 'input',
|
|
408
|
-
title: '名字',
|
|
409
|
-
default: '',
|
|
410
|
-
description: '',
|
|
411
|
-
placeholder: '',
|
|
412
|
-
},
|
|
413
|
-
},
|
|
414
|
-
propertyOrder: ['name'],
|
|
415
|
-
},
|
|
416
|
-
},
|
|
417
|
-
'empty-array': {
|
|
418
|
-
type: 'array',
|
|
419
|
-
title: '数组Array',
|
|
420
|
-
description: '',
|
|
421
|
-
default: [],
|
|
422
|
-
items: {
|
|
423
|
-
type: 'object',
|
|
424
|
-
title: '数组项',
|
|
425
|
-
description: '',
|
|
426
|
-
properties: {},
|
|
427
|
-
},
|
|
428
|
-
},
|
|
429
|
-
'empty-object': {
|
|
430
|
-
type: 'object',
|
|
431
|
-
title: '对象Object',
|
|
432
|
-
description: '',
|
|
433
|
-
properties: {},
|
|
434
|
-
},
|
|
435
|
-
url: {
|
|
436
|
-
type: 'url',
|
|
437
|
-
title: '链接地址url',
|
|
438
|
-
default: '',
|
|
439
|
-
description: '',
|
|
440
|
-
placeholder: '',
|
|
441
|
-
},
|
|
442
|
-
textarea: {
|
|
443
|
-
type: 'textarea',
|
|
444
|
-
title: '多行文本框',
|
|
445
|
-
default: '',
|
|
446
|
-
description: '',
|
|
447
|
-
placeholder: '',
|
|
448
|
-
},
|
|
449
|
-
color: {
|
|
450
|
-
type: 'color',
|
|
451
|
-
title: '颜色color',
|
|
452
|
-
default: '#ffffff',
|
|
453
|
-
description: '',
|
|
454
|
-
},
|
|
455
|
-
image: {
|
|
456
|
-
title: '图片',
|
|
457
|
-
type: 'image',
|
|
458
|
-
default: '',
|
|
459
|
-
description: '上传图片',
|
|
460
|
-
imgWidth: 200,
|
|
461
|
-
imgHeight: 200,
|
|
462
|
-
imgRatioReadOnly: !0,
|
|
463
|
-
},
|
|
464
|
-
number: {
|
|
465
|
-
type: 'number',
|
|
466
|
-
title: '数量number',
|
|
467
|
-
default: 1,
|
|
468
|
-
minimum: 0,
|
|
469
|
-
maximum: 1e3,
|
|
470
|
-
description: '',
|
|
471
|
-
},
|
|
472
|
-
'input-image': {
|
|
473
|
-
title: '图片地址',
|
|
474
|
-
type: 'input-image',
|
|
475
|
-
description: '',
|
|
476
|
-
accept: '.jpeg,.jpg,.png',
|
|
477
|
-
multiple: !0,
|
|
478
|
-
},
|
|
479
|
-
json: {
|
|
480
|
-
title: 'json数据',
|
|
481
|
-
type: 'json',
|
|
482
|
-
default: '{}',
|
|
483
|
-
description: '',
|
|
484
|
-
},
|
|
485
|
-
codearea: {
|
|
486
|
-
type: 'codearea',
|
|
487
|
-
title: '函数类型',
|
|
488
|
-
placeholder: '请输入函数方法',
|
|
489
|
-
default: 'function func() { console.log("hello, world!"); }',
|
|
490
|
-
description: '用于定义函数方法',
|
|
491
|
-
},
|
|
492
|
-
htmlarea: {
|
|
493
|
-
title: '富文本',
|
|
494
|
-
type: 'htmlarea',
|
|
495
|
-
placeholder: '请输入html代码片段',
|
|
496
|
-
default: '<p>hello,world!</p>',
|
|
497
|
-
description: '用于放置html代码片段',
|
|
498
|
-
},
|
|
499
|
-
'text-editor': {
|
|
500
|
-
type: 'text-editor',
|
|
501
|
-
title: '富文本',
|
|
502
|
-
default: '',
|
|
503
|
-
description: '',
|
|
504
|
-
placeholder: '',
|
|
505
|
-
},
|
|
506
|
-
date: {
|
|
507
|
-
type: 'date',
|
|
508
|
-
title: '日期Date',
|
|
509
|
-
default: '',
|
|
510
|
-
description: '',
|
|
511
|
-
placeholder: '',
|
|
512
|
-
},
|
|
513
|
-
'date-time': {
|
|
514
|
-
type: 'date-time',
|
|
515
|
-
title: '日期时间',
|
|
516
|
-
default: '',
|
|
517
|
-
description: '',
|
|
518
|
-
placeholder: '',
|
|
519
|
-
},
|
|
520
|
-
time: {
|
|
521
|
-
type: 'time',
|
|
522
|
-
title: '时间Time',
|
|
523
|
-
default: '',
|
|
524
|
-
description: '',
|
|
525
|
-
placeholder: '',
|
|
526
|
-
},
|
|
527
|
-
quantity: {
|
|
528
|
-
type: 'quantity',
|
|
529
|
-
title: '单位计量',
|
|
530
|
-
isContainer: !1,
|
|
531
|
-
properties: {
|
|
532
|
-
unit: {
|
|
533
|
-
type: 'number',
|
|
534
|
-
title: '单位数值',
|
|
535
|
-
default: 50,
|
|
536
|
-
minimum: 0,
|
|
537
|
-
maximum: 1e3,
|
|
538
|
-
description: '',
|
|
539
|
-
},
|
|
540
|
-
quantity: {
|
|
541
|
-
type: 'select',
|
|
542
|
-
default: 'px',
|
|
543
|
-
options: [
|
|
544
|
-
{ label: 'px', value: 'px' },
|
|
545
|
-
{ label: 'rem', value: 'rem' },
|
|
546
|
-
{ label: 'em', value: 'em' },
|
|
547
|
-
{ label: '%', value: '%' },
|
|
548
|
-
],
|
|
549
|
-
title: '单位类型',
|
|
550
|
-
},
|
|
551
|
-
},
|
|
552
|
-
propertyOrder: ['unit', 'quantity'],
|
|
553
|
-
},
|
|
554
|
-
'box-style': {
|
|
555
|
-
type: 'box-style',
|
|
556
|
-
title: '盒子模型',
|
|
557
|
-
isContainer: !1,
|
|
558
|
-
properties: {
|
|
559
|
-
unit: {
|
|
560
|
-
title: '单位数值',
|
|
561
|
-
type: 'input',
|
|
562
|
-
default: '0',
|
|
563
|
-
description: '',
|
|
564
|
-
},
|
|
565
|
-
quantity: {
|
|
566
|
-
type: 'select',
|
|
567
|
-
default: 'px',
|
|
568
|
-
options: [
|
|
569
|
-
{ label: 'px', value: 'px' },
|
|
570
|
-
{ label: 'rem', value: 'rem' },
|
|
571
|
-
{ label: 'em', value: 'em' },
|
|
572
|
-
{ label: '%', value: '%' },
|
|
573
|
-
],
|
|
574
|
-
title: '单位类型',
|
|
575
|
-
},
|
|
576
|
-
},
|
|
577
|
-
propertyOrder: ['unit', 'quantity'],
|
|
578
|
-
},
|
|
579
|
-
'padding-margin': {
|
|
580
|
-
type: 'padding-margin',
|
|
581
|
-
title: '边距设置',
|
|
582
|
-
isContainer: !1,
|
|
583
|
-
properties: {
|
|
584
|
-
margin: {
|
|
585
|
-
title: '外边距',
|
|
586
|
-
type: 'input',
|
|
587
|
-
default: '0',
|
|
588
|
-
description: '',
|
|
589
|
-
},
|
|
590
|
-
padding: {
|
|
591
|
-
title: '内边距',
|
|
592
|
-
type: 'input',
|
|
593
|
-
default: '0',
|
|
594
|
-
description: '',
|
|
595
|
-
},
|
|
596
|
-
quantity: {
|
|
597
|
-
type: 'select',
|
|
598
|
-
default: 'px',
|
|
599
|
-
options: [
|
|
600
|
-
{ label: 'px', value: 'px' },
|
|
601
|
-
{ label: 'rem', value: 'rem' },
|
|
602
|
-
{ label: 'em', value: 'em' },
|
|
603
|
-
{ label: '%', value: '%' },
|
|
604
|
-
],
|
|
605
|
-
title: '单位类型',
|
|
606
|
-
},
|
|
607
|
-
},
|
|
608
|
-
propertyOrder: ['margin', 'padding', 'quantity'],
|
|
609
|
-
},
|
|
610
|
-
radio: {
|
|
611
|
-
type: 'radio',
|
|
612
|
-
title: '单选',
|
|
613
|
-
options: [
|
|
614
|
-
{ label: '选项a', value: 'a' },
|
|
615
|
-
{ label: '选项b', value: 'b' },
|
|
616
|
-
{ label: '选项c', value: 'c' },
|
|
617
|
-
],
|
|
618
|
-
description: '',
|
|
619
|
-
},
|
|
620
|
-
select: {
|
|
621
|
-
type: 'select',
|
|
622
|
-
title: '下拉选择',
|
|
623
|
-
options: [
|
|
624
|
-
{ label: '选项a', value: 'a' },
|
|
625
|
-
{ label: '选项b', value: 'b' },
|
|
626
|
-
{ label: '选项c', value: 'c' },
|
|
627
|
-
],
|
|
628
|
-
description: '',
|
|
629
|
-
},
|
|
630
|
-
cascader: {
|
|
631
|
-
type: 'cascader',
|
|
632
|
-
title: '级联选择',
|
|
633
|
-
options: [
|
|
634
|
-
{
|
|
635
|
-
value: 'zhejiang',
|
|
636
|
-
label: 'Zhejiang',
|
|
637
|
-
children: [
|
|
638
|
-
{
|
|
639
|
-
value: 'hangzhou',
|
|
640
|
-
label: 'Hangzhou',
|
|
641
|
-
children: [{ value: 'xihu', label: 'West Lake' }],
|
|
642
|
-
},
|
|
643
|
-
],
|
|
644
|
-
},
|
|
645
|
-
{
|
|
646
|
-
value: 'jiangsu',
|
|
647
|
-
label: 'Jiangsu',
|
|
648
|
-
children: [
|
|
649
|
-
{
|
|
650
|
-
value: 'nanjing',
|
|
651
|
-
label: 'Nanjing',
|
|
652
|
-
children: [{ value: 'zhonghuamen', label: 'Zhong Hua Men' }],
|
|
653
|
-
},
|
|
654
|
-
],
|
|
655
|
-
},
|
|
656
|
-
],
|
|
657
|
-
default: 'a',
|
|
658
|
-
description: '',
|
|
659
|
-
showSearch: !0,
|
|
660
|
-
allowClear: !0,
|
|
661
|
-
},
|
|
662
|
-
checkboxes: {
|
|
663
|
-
type: 'checkboxes',
|
|
664
|
-
title: '多选',
|
|
665
|
-
options: [
|
|
666
|
-
{ label: '选项a', value: 'a' },
|
|
667
|
-
{ label: '选项b', value: 'b' },
|
|
668
|
-
{ label: '选项c', value: 'c' },
|
|
669
|
-
],
|
|
670
|
-
default: ['a'],
|
|
671
|
-
description: '',
|
|
672
|
-
},
|
|
673
|
-
'dynamic-data': {
|
|
674
|
-
type: 'dynamic-data',
|
|
675
|
-
title: '动态数据源',
|
|
676
|
-
isContainer: !1,
|
|
677
|
-
properties: {
|
|
678
|
-
type: {
|
|
679
|
-
default: 'local',
|
|
680
|
-
type: 'select',
|
|
681
|
-
options: [
|
|
682
|
-
{ label: '本地数据', value: 'local' },
|
|
683
|
-
{ label: '接口数据', value: 'remote' },
|
|
684
|
-
],
|
|
685
|
-
title: '数据类型',
|
|
686
|
-
},
|
|
687
|
-
config: {
|
|
688
|
-
title: '接口配置',
|
|
689
|
-
type: 'object',
|
|
690
|
-
description: '用于存放接口的配置数据(url、请求参数等)',
|
|
691
|
-
isRequired: !0,
|
|
692
|
-
properties: {
|
|
693
|
-
dataName: {
|
|
694
|
-
default: 'local',
|
|
695
|
-
type: 'select',
|
|
696
|
-
options: [
|
|
697
|
-
{ label: '本地数据', value: 'local' },
|
|
698
|
-
{ label: '接口数据', value: 'remote' },
|
|
699
|
-
],
|
|
700
|
-
title: '数据类型',
|
|
701
|
-
},
|
|
702
|
-
body: {
|
|
703
|
-
type: 'object',
|
|
704
|
-
title: '请求参数配置',
|
|
705
|
-
description: '用于配置当前接口的请求参数数值',
|
|
706
|
-
isRequired: !0,
|
|
707
|
-
},
|
|
708
|
-
filter: {
|
|
709
|
-
title: '过滤器函数体',
|
|
710
|
-
type: 'codearea',
|
|
711
|
-
default: 'return data;',
|
|
712
|
-
description: '用于定义过滤接口数据',
|
|
713
|
-
isRequired: !0,
|
|
714
|
-
},
|
|
715
|
-
},
|
|
716
|
-
propertyOrder: ['dataName', 'body', 'filter'],
|
|
717
|
-
},
|
|
718
|
-
data: {
|
|
719
|
-
title: '数据内容',
|
|
720
|
-
type: 'json',
|
|
721
|
-
default: '{}',
|
|
722
|
-
description: '用于存放DynamicData的数据内容',
|
|
723
|
-
isRequired: !0,
|
|
724
|
-
},
|
|
725
|
-
localFilter: {
|
|
726
|
-
title: '过滤器',
|
|
727
|
-
type: 'codearea',
|
|
728
|
-
default: 'return data;',
|
|
729
|
-
description: '用于定义过滤本地数据',
|
|
730
|
-
isRequired: !0,
|
|
731
|
-
},
|
|
732
|
-
},
|
|
733
|
-
propertyOrder: ['type', 'config', 'data', 'localFilter'],
|
|
734
|
-
},
|
|
735
|
-
datasource: p,
|
|
736
|
-
event: o,
|
|
737
|
-
},
|
|
738
|
-
s = {
|
|
739
|
-
on: {
|
|
740
|
-
type: 'event',
|
|
741
|
-
title: '事件',
|
|
742
|
-
isContainer: !1,
|
|
743
|
-
properties: {
|
|
744
|
-
type: {
|
|
745
|
-
default: 'on',
|
|
746
|
-
type: 'select',
|
|
747
|
-
options: [
|
|
748
|
-
{ label: 'on', value: 'on' },
|
|
749
|
-
{ label: 'emit', value: 'emit' },
|
|
750
|
-
],
|
|
751
|
-
title: '事件类型',
|
|
752
|
-
},
|
|
753
|
-
register: {
|
|
754
|
-
type: 'input',
|
|
755
|
-
default: 'eventName',
|
|
756
|
-
title: '注册事件',
|
|
757
|
-
description: '用于输入注册事件的名称',
|
|
758
|
-
placeholder: '请输入注册事件的名称',
|
|
759
|
-
},
|
|
760
|
-
actionFunc: {
|
|
761
|
-
title: '执行函数',
|
|
762
|
-
type: 'codearea',
|
|
763
|
-
default: '() => {}',
|
|
764
|
-
description: '',
|
|
765
|
-
},
|
|
766
|
-
},
|
|
767
|
-
propertyOrder: ['type', 'register', 'actionFunc'],
|
|
768
|
-
},
|
|
769
|
-
emit: o,
|
|
770
|
-
},
|
|
771
|
-
d = { local: p, remote: u };
|
|
772
|
-
function f(e) {
|
|
773
|
-
return /^http[s]?:\/\/.*/.test(e);
|
|
774
|
-
}
|
|
775
|
-
function y(e) {
|
|
776
|
-
return 'String' === Object.prototype.toString.call(e).slice(8, -1);
|
|
777
|
-
}
|
|
778
|
-
function m(e) {
|
|
779
|
-
return (
|
|
780
|
-
'number' == typeof e ||
|
|
781
|
-
'[object Number]' === Object.prototype.toString.call(e)
|
|
782
|
-
);
|
|
783
|
-
}
|
|
784
|
-
function v(e) {
|
|
785
|
-
return 'Boolean' === Object.prototype.toString.call(e).slice(8, -1);
|
|
786
|
-
}
|
|
787
|
-
function b(e) {
|
|
788
|
-
return /^\d{4}-\d{2}-\d{2}$/.test(e);
|
|
789
|
-
}
|
|
790
|
-
function g(e) {
|
|
791
|
-
return (
|
|
792
|
-
/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/.test(e) ||
|
|
793
|
-
/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/.test(e)
|
|
794
|
-
);
|
|
795
|
-
}
|
|
796
|
-
function h(e) {
|
|
797
|
-
return /^\d{2}:\d{2}:\d{2}$/.test(e) || /^\d{2}:\d{2}$/.test(e);
|
|
798
|
-
}
|
|
799
|
-
function j(e) {
|
|
800
|
-
var t = !1;
|
|
801
|
-
return (
|
|
802
|
-
'Array' === Object.prototype.toString.call(e).slice(8, -1) && (t = !0),
|
|
803
|
-
t
|
|
804
|
-
);
|
|
805
|
-
}
|
|
806
|
-
function O(e) {
|
|
807
|
-
if (!j(e)) return !1;
|
|
808
|
-
for (var t = 0, r = e.length; t < r; t++) if (!y(e[t])) return !1;
|
|
809
|
-
return !0;
|
|
810
|
-
}
|
|
811
|
-
function x(e) {
|
|
812
|
-
var t = !1;
|
|
813
|
-
return (
|
|
814
|
-
'Object' === Object.prototype.toString.call(e).slice(8, -1) && (t = !0),
|
|
815
|
-
t
|
|
816
|
-
);
|
|
817
|
-
}
|
|
818
|
-
function q(e) {
|
|
819
|
-
var t = !1;
|
|
820
|
-
return c.quantity.properties.quantity.enum.indexOf(e) >= 0 && (t = !0), t;
|
|
821
|
-
}
|
|
822
|
-
function S(e) {
|
|
823
|
-
return /^#[0-9a-f]{6}$/.test(e) || /^#[0-9a-f]{3}$/.test(e);
|
|
824
|
-
}
|
|
825
|
-
function k(e) {
|
|
826
|
-
var t = !1;
|
|
827
|
-
return (
|
|
828
|
-
'Function' === Object.prototype.toString.call(e).slice(8, -1) &&
|
|
829
|
-
(t = !0),
|
|
830
|
-
t
|
|
831
|
-
);
|
|
832
|
-
}
|
|
833
|
-
function T() {
|
|
834
|
-
var e = {};
|
|
835
|
-
return (
|
|
836
|
-
location.search && (e = a().parse(location.search.substring(1))), e
|
|
837
|
-
);
|
|
838
|
-
}
|
|
839
|
-
function N(e) {
|
|
840
|
-
var t = '';
|
|
841
|
-
return url && (t = a().stringify(e)), t;
|
|
842
|
-
}
|
|
843
|
-
function D(e) {
|
|
844
|
-
return (0, i.cloneDeep)(e);
|
|
845
|
-
}
|
|
846
|
-
function R(e, t) {
|
|
847
|
-
if ((w(e) && !w(t)) || (!w(e) && w(t)) || typeof e != typeof t) return !1;
|
|
848
|
-
if (x(e) && (e.id !== t.id || e.lastUpdateTime !== t.lastUpdateTime))
|
|
849
|
-
return !1;
|
|
850
|
-
var r = new Date().getTime();
|
|
851
|
-
return (
|
|
852
|
-
!!(
|
|
853
|
-
x(e) &&
|
|
854
|
-
e.lastUpdateTime &&
|
|
855
|
-
e.lastUpdateTime === t.lastUpdateTime &&
|
|
856
|
-
r - e.lastUpdateTime < 500
|
|
857
|
-
) || (0, i.isEqual)(e, t)
|
|
858
|
-
);
|
|
859
|
-
}
|
|
860
|
-
function F(e, t) {
|
|
861
|
-
if ((w(e) && !w(t)) || (!w(e) && w(t)) || typeof e != typeof t) return !1;
|
|
862
|
-
if (x(e) && (e.id !== t.id || e.lastUpdateTime !== t.lastUpdateTime))
|
|
863
|
-
return !1;
|
|
864
|
-
var r = new Date().getTime();
|
|
865
|
-
return (
|
|
866
|
-
!!(
|
|
867
|
-
x(e) &&
|
|
868
|
-
e.lastUpdateTime &&
|
|
869
|
-
e.lastUpdateTime === t.lastUpdateTime &&
|
|
870
|
-
r - e.lastUpdateTime < 500
|
|
871
|
-
) ||
|
|
872
|
-
!(
|
|
873
|
-
!x(e) ||
|
|
874
|
-
!(
|
|
875
|
-
(w(e.id) && e.id === t.id) ||
|
|
876
|
-
(w(e.lastUpdateTime) && e.lastUpdateTime === t.lastUpdateTime)
|
|
877
|
-
)
|
|
878
|
-
) ||
|
|
879
|
-
(0, i.isEqual)(e, t)
|
|
880
|
-
);
|
|
881
|
-
}
|
|
882
|
-
function w(e) {
|
|
883
|
-
var t = !1;
|
|
884
|
-
return null != e && (t = !0), t;
|
|
885
|
-
}
|
|
886
|
-
function C(e, t) {
|
|
887
|
-
return (0, i.truncate)(e, t);
|
|
888
|
-
}
|
|
889
|
-
function U(e, t) {
|
|
890
|
-
var r = t || {};
|
|
891
|
-
if (!e) return !1;
|
|
892
|
-
var i = new Function('data', 'with(data) { return (' + e + ');}'),
|
|
893
|
-
n = '';
|
|
894
|
-
try {
|
|
895
|
-
n = i(r);
|
|
896
|
-
} catch (t) {
|
|
897
|
-
return console.warn('表达式运算出错: ' + e + ',报错信息:', t), n;
|
|
898
|
-
}
|
|
899
|
-
return n;
|
|
900
|
-
}
|
|
901
|
-
function P(e, t, r) {
|
|
902
|
-
var i = t;
|
|
903
|
-
if ((r && (i = D(t)), e))
|
|
904
|
-
for (var n = e.split('-'), a = 0, o = n.length; a < o; a++) {
|
|
905
|
-
var p = n[a];
|
|
906
|
-
p && (i = i && i[p]);
|
|
907
|
-
}
|
|
908
|
-
return i;
|
|
909
|
-
}
|
|
910
|
-
function E(e, t, r) {
|
|
911
|
-
var i = t;
|
|
912
|
-
if ((r && (i = D(t)), e))
|
|
913
|
-
for (var n = e.split('-'), a = 0, o = n.length; a < o; a++) {
|
|
914
|
-
var p = n[a];
|
|
915
|
-
if (
|
|
916
|
-
'0' !== p ||
|
|
917
|
-
('array' !== i.type &&
|
|
918
|
-
'radio' !== i.type &&
|
|
919
|
-
'select' !== i.type &&
|
|
920
|
-
'checkboxes' !== i.type) ||
|
|
921
|
-
(!i.options && !i.items)
|
|
922
|
-
) {
|
|
923
|
-
if (p) {
|
|
924
|
-
var u = '0';
|
|
925
|
-
i.propertyOrder
|
|
926
|
-
? (u = i.propertyOrder[p])
|
|
927
|
-
: i.properties && (u = Object.keys(i.properties)[p]),
|
|
928
|
-
(i = i.properties[u]);
|
|
929
|
-
}
|
|
930
|
-
} else i = i.options || i.items;
|
|
931
|
-
}
|
|
932
|
-
return i;
|
|
933
|
-
}
|
|
934
|
-
function J(e, t, r) {
|
|
935
|
-
var i = t;
|
|
936
|
-
if ((r && (i = D(t)), e && i))
|
|
937
|
-
for (var n = e.split('-'), a = 0, o = n.length; a < o; a++) {
|
|
938
|
-
var p = n[a];
|
|
939
|
-
p && i.properties && (i = i.properties[p]);
|
|
940
|
-
}
|
|
941
|
-
return i;
|
|
942
|
-
}
|
|
943
|
-
function A(e, t) {
|
|
944
|
-
for (
|
|
945
|
-
var r = t, i = '', n = e.split('-'), a = 0, o = n.length;
|
|
946
|
-
a < o;
|
|
947
|
-
a++
|
|
948
|
-
) {
|
|
949
|
-
var p = n[a];
|
|
950
|
-
if ('0' === p && r.items)
|
|
951
|
-
(r = r.items), (i = i ? i + '-items' : 'items');
|
|
952
|
-
else if ('0' === p && r.options)
|
|
953
|
-
(r = r.options), (i = i ? i + '-options' : 'options');
|
|
954
|
-
else if (p) {
|
|
955
|
-
var u = '0';
|
|
956
|
-
r.propertyOrder
|
|
957
|
-
? (u = r.propertyOrder[p])
|
|
958
|
-
: r.properties && (u = Object.keys(r.properties)[p]),
|
|
959
|
-
(r = r.properties[u]),
|
|
960
|
-
(i = i ? i + '-' + u : u);
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
return i;
|
|
964
|
-
}
|
|
965
|
-
function $(e, t) {
|
|
966
|
-
for (
|
|
967
|
-
var r = t, i = '', n = e.split('-'), a = 0, o = n.length;
|
|
968
|
-
a < o;
|
|
969
|
-
a++
|
|
970
|
-
) {
|
|
971
|
-
var p = n[a];
|
|
972
|
-
if (p) {
|
|
973
|
-
var u = -1;
|
|
974
|
-
r.propertyOrder
|
|
975
|
-
? ((u = r.propertyOrder.indexOf(p)), (r = r.properties[p]))
|
|
976
|
-
: r.properties
|
|
977
|
-
? ((u = Object.keys(r.properties).indexOf(p)),
|
|
978
|
-
(r = r.properties[p]))
|
|
979
|
-
: r.items
|
|
980
|
-
? ((u = 0), (r = r.items))
|
|
981
|
-
: r.options && ((u = 0), (r = r.options)),
|
|
982
|
-
(i = i ? i + '-' + u : u.toString());
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
return i;
|
|
986
|
-
}
|
|
987
|
-
function B(e) {
|
|
988
|
-
var t;
|
|
989
|
-
return (
|
|
990
|
-
(t =
|
|
991
|
-
e && x(e)
|
|
992
|
-
? (function (e) {
|
|
993
|
-
var t;
|
|
994
|
-
if (x(e)) {
|
|
995
|
-
var r = Object.keys(e);
|
|
996
|
-
e.data && e.filter && 2 === r.length
|
|
997
|
-
? (t = j(e.data) || x(e.data) ? D(d.local) : D(d.remote))
|
|
998
|
-
: e.trigger && e.eventData && 2 === r.length
|
|
999
|
-
? (t = D(s.emit))
|
|
1000
|
-
: e.register && e.actionFunc && 2 === r.length
|
|
1001
|
-
? (t = D(s.on))
|
|
1002
|
-
: e.quantity && q(e.quantity) && 2 === r.length
|
|
1003
|
-
? (t = D(c.quantity))
|
|
1004
|
-
: ((t = D(c['empty-object'])),
|
|
1005
|
-
Object.keys(e).map(function (r) {
|
|
1006
|
-
var i = e[r];
|
|
1007
|
-
t.properties[r] = B(i);
|
|
1008
|
-
}));
|
|
1009
|
-
}
|
|
1010
|
-
return t;
|
|
1011
|
-
})(e)
|
|
1012
|
-
: e && j(e)
|
|
1013
|
-
? (function (e) {
|
|
1014
|
-
var t;
|
|
1015
|
-
if (e && j(e))
|
|
1016
|
-
if (O(e)) {
|
|
1017
|
-
(t = D(c.select)).items.enum = e;
|
|
1018
|
-
var r = t.items.enumextra.length,
|
|
1019
|
-
i = e.length;
|
|
1020
|
-
if (i > r)
|
|
1021
|
-
for (var n = r, a = i; n < a; n++)
|
|
1022
|
-
t.items.enumextra.push('选项' + e(n));
|
|
1023
|
-
} else {
|
|
1024
|
-
t = D(c['empty-array']);
|
|
1025
|
-
var o = B(e[0]);
|
|
1026
|
-
t.items.properties = o.properties;
|
|
1027
|
-
}
|
|
1028
|
-
return t;
|
|
1029
|
-
})(e)
|
|
1030
|
-
: (function (e) {
|
|
1031
|
-
var t = '';
|
|
1032
|
-
if (v(e)) t = D(c.boolean);
|
|
1033
|
-
else if (m(e)) t = D(c.number);
|
|
1034
|
-
else if (f(e)) t = D(c.url);
|
|
1035
|
-
else if (b(e)) t = D(c.date);
|
|
1036
|
-
else if (g(e)) t = D(c['date-time']);
|
|
1037
|
-
else if (h(e)) t = D(c.time);
|
|
1038
|
-
else if (S(e)) t = D(c.color);
|
|
1039
|
-
else
|
|
1040
|
-
try {
|
|
1041
|
-
t = m(JSON.parse(e)) ? D(c.input) : D(c.json);
|
|
1042
|
-
} catch (r) {
|
|
1043
|
-
t = e && e.length > 30 ? D(c.textarea) : D(c.input);
|
|
1044
|
-
}
|
|
1045
|
-
return t;
|
|
1046
|
-
})(e)),
|
|
1047
|
-
t
|
|
1048
|
-
);
|
|
1049
|
-
}
|
|
1050
|
-
function L(e, t) {
|
|
1051
|
-
var r = t || {};
|
|
1052
|
-
return (
|
|
1053
|
-
x(e) &&
|
|
1054
|
-
'object' === getExpectType(e.type) &&
|
|
1055
|
-
e.properties &&
|
|
1056
|
-
(e.propertyOrder ? e.propertyOrder : Object.keys(e.properties)).map(
|
|
1057
|
-
function (t) {
|
|
1058
|
-
var i = e.properties[t];
|
|
1059
|
-
r = z(i, r);
|
|
1060
|
-
},
|
|
1061
|
-
),
|
|
1062
|
-
r
|
|
1063
|
-
);
|
|
1064
|
-
}
|
|
1065
|
-
function z(e, t) {
|
|
1066
|
-
var r = !t,
|
|
1067
|
-
i = t || {};
|
|
1068
|
-
if (e && '{}' !== JSON.stringify(e)) {
|
|
1069
|
-
var n = e.type;
|
|
1070
|
-
'object' === n || 'func' === n || 'style' === n || 'data' === n
|
|
1071
|
-
? (!r && i.object ? (i.object += 1) : r || (i.object = 1),
|
|
1072
|
-
(i = L(e, i)))
|
|
1073
|
-
: 'array' === n
|
|
1074
|
-
? (!r && i.array ? (i.array += 1) : r || (i.array = 1),
|
|
1075
|
-
(i = L((e = e.items), i)))
|
|
1076
|
-
: !r && i[n]
|
|
1077
|
-
? (i[n] += 1)
|
|
1078
|
-
: r || (i[n] = 1);
|
|
1079
|
-
}
|
|
1080
|
-
return i;
|
|
1081
|
-
}
|
|
1082
|
-
function I(e) {
|
|
1083
|
-
var t = D(e);
|
|
1084
|
-
if (
|
|
1085
|
-
(!t.title && t.description && (t.title = t.description),
|
|
1086
|
-
t.type || (t.type = t.format),
|
|
1087
|
-
('quantity' !== t.type &&
|
|
1088
|
-
'array' !== t.type &&
|
|
1089
|
-
'datasource' !== t.type &&
|
|
1090
|
-
'event' !== t.type &&
|
|
1091
|
-
'object' !== t.type) ||
|
|
1092
|
-
!w(t.default) ||
|
|
1093
|
-
delete t.default,
|
|
1094
|
-
'radio' === t.type &&
|
|
1095
|
-
((t.type = 'string'),
|
|
1096
|
-
t.enum &&
|
|
1097
|
-
t.enumextra &&
|
|
1098
|
-
((t.items = {
|
|
1099
|
-
type: 'string',
|
|
1100
|
-
enum: D(t.enum),
|
|
1101
|
-
enumextra: D(t.enumextra),
|
|
1102
|
-
}),
|
|
1103
|
-
delete t.enum,
|
|
1104
|
-
delete t.enumextra)),
|
|
1105
|
-
'quantity' === t.type)
|
|
1106
|
-
) {
|
|
1107
|
-
var r = t.properties,
|
|
1108
|
-
i = D(c.quantity);
|
|
1109
|
-
if (r.quantity && x(r.quantity) && r.quantity.default) {
|
|
1110
|
-
var n = r.quantity.default;
|
|
1111
|
-
i.properties.quantity.default = 'percent' === n ? '%' : n;
|
|
1112
|
-
}
|
|
1113
|
-
t = i;
|
|
1114
|
-
}
|
|
1115
|
-
if ('datasource' === t.type) {
|
|
1116
|
-
var a = t.properties,
|
|
1117
|
-
o = a.type && a.type.default,
|
|
1118
|
-
p = a.data && a.data.default,
|
|
1119
|
-
u = a.filter && a.filter.default;
|
|
1120
|
-
'local' === o
|
|
1121
|
-
? ((t = D(d.local)).properties.data.default = p ? D(p) : '{}')
|
|
1122
|
-
: ((t = D(d.remote)).properties.data.default = p
|
|
1123
|
-
? D(p)
|
|
1124
|
-
: 'http://xxx'),
|
|
1125
|
-
(t.properties.filter.default = u ? D(u) : '() => {}');
|
|
1126
|
-
}
|
|
1127
|
-
if ('event' === t.type) {
|
|
1128
|
-
var l = t.properties,
|
|
1129
|
-
f = l.type && l.type.default;
|
|
1130
|
-
if ('in' === f || 'on' === f) {
|
|
1131
|
-
var y = (l.filter && l.filter.default) || '() => {}';
|
|
1132
|
-
(t = D(s.on)),
|
|
1133
|
-
l.actionFunc &&
|
|
1134
|
-
x(l.actionFunc) &&
|
|
1135
|
-
(t.properties.actionFunc.default = l.actionFunc.default || D(y));
|
|
1136
|
-
} else {
|
|
1137
|
-
var m = (l.filter && l.filter.default) || '{}';
|
|
1138
|
-
(t = D(s.emit)),
|
|
1139
|
-
l.eventData &&
|
|
1140
|
-
x(l.eventData) &&
|
|
1141
|
-
(t.properties.eventData.default = l.eventData.default || D(m));
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
return (
|
|
1145
|
-
t.properties &&
|
|
1146
|
-
(t.propertyOrder || (t.propertyOrder = Object.keys(t.properties)),
|
|
1147
|
-
t.propertyOrder.map(function (e) {
|
|
1148
|
-
t.properties[e] = K(t.properties[e]);
|
|
1149
|
-
})),
|
|
1150
|
-
t.items && (t.items = K(t.items)),
|
|
1151
|
-
t
|
|
1152
|
-
);
|
|
1153
|
-
}
|
|
1154
|
-
function K(e) {
|
|
1155
|
-
var t = D(e);
|
|
1156
|
-
return (
|
|
1157
|
-
t.required || delete t.required,
|
|
1158
|
-
t.type && t.type && (t.type = t.type),
|
|
1159
|
-
('quantity' !== t.type &&
|
|
1160
|
-
'array' !== t.type &&
|
|
1161
|
-
'datasource' !== t.type &&
|
|
1162
|
-
'event' !== t.type &&
|
|
1163
|
-
'object' !== t.type) ||
|
|
1164
|
-
!w(t.default) ||
|
|
1165
|
-
delete t.default,
|
|
1166
|
-
('radio' !== t.type &&
|
|
1167
|
-
'checkboxes' !== t.type &&
|
|
1168
|
-
'select' !== t.type) ||
|
|
1169
|
-
(t.items &&
|
|
1170
|
-
t.items.enum &&
|
|
1171
|
-
t.items.enumextra &&
|
|
1172
|
-
((t.options = []),
|
|
1173
|
-
t.items.enum.forEach(function (e, r) {
|
|
1174
|
-
t.options.push({ label: t.items.enumextra[r] || e, value: e });
|
|
1175
|
-
}),
|
|
1176
|
-
delete t.items)),
|
|
1177
|
-
t.properties &&
|
|
1178
|
-
(t.propertyOrder || (t.propertyOrder = Object.keys(t.properties)),
|
|
1179
|
-
t.propertyOrder.map(function (e) {
|
|
1180
|
-
t.properties[e] = K(t.properties[e]);
|
|
1181
|
-
})),
|
|
1182
|
-
'array' === t.type && t.items && (t.items = K(t.items)),
|
|
1183
|
-
t
|
|
1184
|
-
);
|
|
1185
|
-
}
|
|
1186
|
-
require('mobx');
|
|
1187
|
-
var _,
|
|
1188
|
-
M =
|
|
1189
|
-
(((_ = {
|
|
1190
|
-
array: 'array',
|
|
1191
|
-
boolean: 'boolean',
|
|
1192
|
-
'box-style': 'object',
|
|
1193
|
-
'padding-margin': 'object',
|
|
1194
|
-
codearea: 'string',
|
|
1195
|
-
color: 'string',
|
|
1196
|
-
datasource: 'object',
|
|
1197
|
-
date: 'string',
|
|
1198
|
-
'date-time': 'string',
|
|
1199
|
-
'dynamic-data': 'object',
|
|
1200
|
-
event: 'object',
|
|
1201
|
-
'func-body': 'string',
|
|
1202
|
-
htmlarea: 'string',
|
|
1203
|
-
image: 'string',
|
|
1204
|
-
input: 'string',
|
|
1205
|
-
json: 'string',
|
|
1206
|
-
number: 'number',
|
|
1207
|
-
'input-image': 'string',
|
|
1208
|
-
object: 'object',
|
|
1209
|
-
quantity: 'object',
|
|
1210
|
-
radio: 'string',
|
|
1211
|
-
select: 'array',
|
|
1212
|
-
}).select = 'string'),
|
|
1213
|
-
(_.textarea = 'string'),
|
|
1214
|
-
(_['text-editor'] = 'string'),
|
|
1215
|
-
(_.time = 'string'),
|
|
1216
|
-
(_.url = 'string'),
|
|
1217
|
-
_);
|
|
1218
|
-
function H(e) {
|
|
1219
|
-
return M[e] || e;
|
|
1220
|
-
}
|
|
1221
|
-
function V(e, t) {
|
|
1222
|
-
M[e]
|
|
1223
|
-
? console.warn('当前已经存在' + e + '(' + M[e] + '),暂时不支持覆盖。')
|
|
1224
|
-
: (M[e] = t);
|
|
1225
|
-
}
|
|
1226
|
-
function W(e) {
|
|
1227
|
-
var t = !0;
|
|
1228
|
-
if (!e) return t;
|
|
1229
|
-
var r = e.type;
|
|
1230
|
-
return (
|
|
1231
|
-
(('object' === r &&
|
|
1232
|
-
e.properties &&
|
|
1233
|
-
e.propertyOrder &&
|
|
1234
|
-
e.propertyOrder.length > 0) ||
|
|
1235
|
-
('array' === r &&
|
|
1236
|
-
e.items &&
|
|
1237
|
-
e.items.properties &&
|
|
1238
|
-
e.items.propertyOrder &&
|
|
1239
|
-
e.items.propertyOrder.length > 0) ||
|
|
1240
|
-
(e.type && 'array' !== e.type && 'object' !== e.type) ||
|
|
1241
|
-
e.type) &&
|
|
1242
|
-
(t = !1),
|
|
1243
|
-
t
|
|
1244
|
-
);
|
|
1245
|
-
}
|
|
1246
|
-
function Z(e) {
|
|
1247
|
-
var t = !1,
|
|
1248
|
-
r = e.lastUpdateTime,
|
|
1249
|
-
i = new Date('2024-10-05T00:01:00.691Z').getTime();
|
|
1250
|
-
return r && new Date(r).getTime() >= i && (t = !0), t;
|
|
1251
|
-
}
|
|
1252
|
-
function Q(e) {
|
|
1253
|
-
var t = !1,
|
|
1254
|
-
r = H(e.type),
|
|
1255
|
-
i = void 0 === e.isContainer || e.isContainer;
|
|
1256
|
-
return 'object' === r && i && (t = !0), t;
|
|
1257
|
-
}
|
|
1258
|
-
function G(e) {
|
|
1259
|
-
var t = !0;
|
|
1260
|
-
return (
|
|
1261
|
-
'object' === e.type && e.propertyOrder && e.properties
|
|
1262
|
-
? e.propertyOrder.map(function (r) {
|
|
1263
|
-
var i = e.properties[r];
|
|
1264
|
-
('object' === e.type && i.propertyOrder && i.properties) ||
|
|
1265
|
-
(t = !1);
|
|
1266
|
-
})
|
|
1267
|
-
: (t = !1),
|
|
1268
|
-
t
|
|
1269
|
-
);
|
|
1270
|
-
}
|
|
1271
|
-
function X(e, t) {
|
|
1272
|
-
var r = e.split('-'),
|
|
1273
|
-
i = t.split('-');
|
|
1274
|
-
return r.pop(), i.pop(), r.join('-') === i.join('-');
|
|
1275
|
-
}
|
|
1276
|
-
function Y(e, t) {
|
|
1277
|
-
for (
|
|
1278
|
-
var r = e.split('-'),
|
|
1279
|
-
i = t.split('-'),
|
|
1280
|
-
n = 'before',
|
|
1281
|
-
a = 0,
|
|
1282
|
-
o = (r.length > i.length ? i : r).length;
|
|
1283
|
-
a < o;
|
|
1284
|
-
a += 1
|
|
1285
|
-
)
|
|
1286
|
-
Number(r[a]) > Number(i[a]) && (n = 'after');
|
|
1287
|
-
return n;
|
|
1288
|
-
}
|
|
1289
|
-
function ee(e) {
|
|
1290
|
-
var t = e.split('-');
|
|
1291
|
-
return t.pop(), t.join('-');
|
|
1292
|
-
}
|
|
1293
|
-
function te(e) {
|
|
1294
|
-
var t = e.split('-'),
|
|
1295
|
-
r = t.pop(),
|
|
1296
|
-
i = Number(r) + 1;
|
|
1297
|
-
return t.push('' + i), t.join('-');
|
|
1298
|
-
}
|
|
1299
|
-
function re(e) {
|
|
1300
|
-
var t = e.split('-'),
|
|
1301
|
-
r = t.pop();
|
|
1302
|
-
return [t.join('-'), r];
|
|
1303
|
-
}
|
|
1304
|
-
function ie(e) {
|
|
1305
|
-
var t = e.split('-'),
|
|
1306
|
-
r = t.pop();
|
|
1307
|
-
return t.push(Number(r) - 1), t.join('-');
|
|
1308
|
-
}
|
|
1309
|
-
function ne(e) {
|
|
1310
|
-
var t = e.split('-'),
|
|
1311
|
-
r = t.pop();
|
|
1312
|
-
return t.push(Number(r) + 1), t.join('-');
|
|
1313
|
-
}
|
|
1314
|
-
function ae(e, t) {
|
|
1315
|
-
var r = '',
|
|
1316
|
-
i = !1;
|
|
1317
|
-
if (!1 !== e.defaultActiveFirstOption && e.defaultActiveFirstOption)
|
|
1318
|
-
return (
|
|
1319
|
-
e.options && e.options[0] && ((r = e.options[0].value), (i = !0)),
|
|
1320
|
-
(t || e.multiple) && (r = i ? [r] : []),
|
|
1321
|
-
r
|
|
1322
|
-
);
|
|
1323
|
-
}
|
|
1324
|
-
function oe(e, t) {
|
|
1325
|
-
var r,
|
|
1326
|
-
i,
|
|
1327
|
-
n = void 0,
|
|
1328
|
-
a = t;
|
|
1329
|
-
w(a) &&
|
|
1330
|
-
w(e.default) &&
|
|
1331
|
-
(typeof a != typeof e.default ||
|
|
1332
|
-
((r = a), (i = e.default), x(r) + '-' + j(r) != x(i) + '-' + j(i))) &&
|
|
1333
|
-
(a = void 0);
|
|
1334
|
-
var o = w(a) ? a : e.default;
|
|
1335
|
-
switch (e.type) {
|
|
1336
|
-
case 'select':
|
|
1337
|
-
case 'radio':
|
|
1338
|
-
n = null != o ? o : ae(e);
|
|
1339
|
-
break;
|
|
1340
|
-
case 'checkboxes':
|
|
1341
|
-
n = null != o ? o : ae(e, !0);
|
|
1342
|
-
break;
|
|
1343
|
-
case 'color':
|
|
1344
|
-
('#fff' !== o && '#FFF' !== o) || (o = '#ffffff'),
|
|
1345
|
-
(n = w(o) ? o : '#ffffff');
|
|
1346
|
-
break;
|
|
1347
|
-
case 'boolean':
|
|
1348
|
-
n = !!w(o) && o;
|
|
1349
|
-
break;
|
|
1350
|
-
case 'number':
|
|
1351
|
-
n = w(o) ? o : void 0;
|
|
1352
|
-
break;
|
|
1353
|
-
case 'json':
|
|
1354
|
-
var p = '';
|
|
1355
|
-
if (x(o) || j(o)) p = o;
|
|
1356
|
-
else if (k(o) || '' === o) p = {};
|
|
1357
|
-
else
|
|
1358
|
-
try {
|
|
1359
|
-
p = JSON.parse(o);
|
|
1360
|
-
} catch (e) {
|
|
1361
|
-
p = {};
|
|
1362
|
-
}
|
|
1363
|
-
n = p;
|
|
1364
|
-
break;
|
|
1365
|
-
default:
|
|
1366
|
-
n =
|
|
1367
|
-
'input' === e.type && '0' === e.default
|
|
1368
|
-
? o || e.default
|
|
1369
|
-
: w(o)
|
|
1370
|
-
? o
|
|
1371
|
-
: void 0;
|
|
1372
|
-
}
|
|
1373
|
-
return n;
|
|
1374
|
-
}
|
|
1375
|
-
function pe(e, t) {
|
|
1376
|
-
var r = {},
|
|
1377
|
-
i = e.type;
|
|
1378
|
-
if (x(e) && 'object' === H(e.type)) {
|
|
1379
|
-
var n = e,
|
|
1380
|
-
a = t;
|
|
1381
|
-
w(a) &&
|
|
1382
|
-
((w(n.default) && typeof a != typeof e.default) || !x(a)) &&
|
|
1383
|
-
(a = void 0);
|
|
1384
|
-
var o = w(a) ? a : n.default;
|
|
1385
|
-
'dynamic-data' === i
|
|
1386
|
-
? ((r = D(l)),
|
|
1387
|
-
o &&
|
|
1388
|
-
x(o) &&
|
|
1389
|
-
'{}' !== JSON.stringify(o) &&
|
|
1390
|
-
(r = Object.assign(r, o)))
|
|
1391
|
-
: 'datasource' === i
|
|
1392
|
-
? n.properties &&
|
|
1393
|
-
n.properties.type &&
|
|
1394
|
-
n.properties.type.default &&
|
|
1395
|
-
'local' === n.properties.type.default
|
|
1396
|
-
? ((r = { data: '{}', filter: '() => {}' }),
|
|
1397
|
-
o && o.data && (r.data = o.data),
|
|
1398
|
-
o && o.filter && (r.filter = o.filter),
|
|
1399
|
-
'http://xxx' === r.data && (r.data = '{}'))
|
|
1400
|
-
: ((r = { data: 'http://xxx', filter: '() => {}' }),
|
|
1401
|
-
o && o.data && (r.data = o.data),
|
|
1402
|
-
o && o.filter && (r.filter = o.filter),
|
|
1403
|
-
'{}' === r.data && (r.data = 'http://xxx'))
|
|
1404
|
-
: 'event' === i
|
|
1405
|
-
? n.properties &&
|
|
1406
|
-
n.properties.type &&
|
|
1407
|
-
n.properties.type.default &&
|
|
1408
|
-
'emit' === n.properties.type.default
|
|
1409
|
-
? o && 'out' === o.type
|
|
1410
|
-
? (r = {
|
|
1411
|
-
trigger: (o && o.filter) || 'eventName',
|
|
1412
|
-
eventData: '{}',
|
|
1413
|
-
})
|
|
1414
|
-
: ((r = { trigger: 'eventName', eventData: '{}' }),
|
|
1415
|
-
o && o.trigger && (r.trigger = o.trigger),
|
|
1416
|
-
o && o.eventData && (r.eventData = o.eventData))
|
|
1417
|
-
: o && 'in' === o.type
|
|
1418
|
-
? (r = {
|
|
1419
|
-
register: 'eventName',
|
|
1420
|
-
actionFunc: (o && o.filter) || '() => {}',
|
|
1421
|
-
})
|
|
1422
|
-
: ((r = { register: 'eventName', actionFunc: '() => {}' }),
|
|
1423
|
-
o && o.register && (r.register = o.register),
|
|
1424
|
-
o && o.actionFunc && (r.actionFunc = o.actionFunc))
|
|
1425
|
-
: !1 === e.isContainer && o && x(o) && '{}' !== JSON.stringify(o)
|
|
1426
|
-
? (r = Object.assign(r, o))
|
|
1427
|
-
: void 0 === a && n.default && x(n.default)
|
|
1428
|
-
? (r = n.default)
|
|
1429
|
-
: e.properties &&
|
|
1430
|
-
(e.propertyOrder
|
|
1431
|
-
? e.propertyOrder
|
|
1432
|
-
: Object.keys(e.properties)
|
|
1433
|
-
).map(function (i) {
|
|
1434
|
-
var n = e.properties[i],
|
|
1435
|
-
a = t && t[i];
|
|
1436
|
-
switch (H(n.type)) {
|
|
1437
|
-
case 'array':
|
|
1438
|
-
r[i] = ue(n, a);
|
|
1439
|
-
break;
|
|
1440
|
-
case 'object':
|
|
1441
|
-
r[i] = pe(n, a);
|
|
1442
|
-
break;
|
|
1443
|
-
default:
|
|
1444
|
-
r[i] = oe(n, a);
|
|
1445
|
-
}
|
|
1446
|
-
});
|
|
1447
|
-
}
|
|
1448
|
-
return r;
|
|
1449
|
-
}
|
|
1450
|
-
function ue(e, t) {
|
|
1451
|
-
var r = [];
|
|
1452
|
-
if (e && 'array' === H(e.type)) {
|
|
1453
|
-
var i = t;
|
|
1454
|
-
w(i) &&
|
|
1455
|
-
((w(e.default) && typeof i != typeof e.default) || !j(i)) &&
|
|
1456
|
-
(i = void 0);
|
|
1457
|
-
var n = w(i) ? i : e.default;
|
|
1458
|
-
if ('array' === H(e.type))
|
|
1459
|
-
if (j(n))
|
|
1460
|
-
n.map(function (t) {
|
|
1461
|
-
r.push(pe(e.items, t));
|
|
1462
|
-
});
|
|
1463
|
-
else if (n) r = n;
|
|
1464
|
-
else {
|
|
1465
|
-
var a = pe(e.items, n);
|
|
1466
|
-
r.push(a);
|
|
1467
|
-
}
|
|
1468
|
-
else r = w(n) ? n : [];
|
|
1469
|
-
}
|
|
1470
|
-
return r;
|
|
1471
|
-
}
|
|
1472
|
-
function le(e, t) {
|
|
1473
|
-
return 'object' === H(e.type)
|
|
1474
|
-
? pe(e, t)
|
|
1475
|
-
: 'array' === H(e.type)
|
|
1476
|
-
? ue(e, t)
|
|
1477
|
-
: oe(e, t);
|
|
1478
|
-
}
|
|
1479
|
-
var ce = c;
|
|
1480
|
-
function se(e, t) {
|
|
1481
|
-
var r = t || [];
|
|
1482
|
-
if (e && '{}' !== JSON.stringify(e))
|
|
1483
|
-
if (x(e))
|
|
1484
|
-
if (
|
|
1485
|
-
e.type &&
|
|
1486
|
-
'remote' === e.type &&
|
|
1487
|
-
e.config &&
|
|
1488
|
-
x(e.config) &&
|
|
1489
|
-
e.config.dataName &&
|
|
1490
|
-
w(e.localFilter) &&
|
|
1491
|
-
w(e.data)
|
|
1492
|
-
) {
|
|
1493
|
-
var i = e.config.body;
|
|
1494
|
-
if (i && !x(i))
|
|
1495
|
-
try {
|
|
1496
|
-
i = JSON.parse(i);
|
|
1497
|
-
} catch (e) {
|
|
1498
|
-
i = {};
|
|
1499
|
-
}
|
|
1500
|
-
r.push({ id: e.config.id, dataName: e.config.dataName, body: i });
|
|
1501
|
-
} else
|
|
1502
|
-
Object.keys(e).map(function (t) {
|
|
1503
|
-
se(e[t], r);
|
|
1504
|
-
});
|
|
1505
|
-
else
|
|
1506
|
-
j(e) &&
|
|
1507
|
-
e.map(function (e) {
|
|
1508
|
-
se(e, r);
|
|
1509
|
-
});
|
|
1510
|
-
return r;
|
|
1511
|
-
}
|
|
1512
|
-
function de(e, t) {
|
|
1513
|
-
var r = t || 'data';
|
|
1514
|
-
return (
|
|
1515
|
-
e.split('-').map(function (e) {
|
|
1516
|
-
r = /^\d+$/.test(e) ? r + '[' + e + ']' : r + '.' + e;
|
|
1517
|
-
}),
|
|
1518
|
-
r
|
|
1519
|
-
);
|
|
1520
|
-
}
|
|
1521
|
-
function fe(e, t) {
|
|
1522
|
-
var r = [];
|
|
1523
|
-
return (
|
|
1524
|
-
x(e)
|
|
1525
|
-
? Object.keys(e).map(function (i) {
|
|
1526
|
-
var n = e[i],
|
|
1527
|
-
a = t ? t + '-' + i : i;
|
|
1528
|
-
x(n) || j(n)
|
|
1529
|
-
? r.push({ title: i, value: a, key: a, children: fe(n, a) })
|
|
1530
|
-
: r.push({ title: i, value: a, key: a });
|
|
1531
|
-
})
|
|
1532
|
-
: j(e) &&
|
|
1533
|
-
e.map(function (e, i) {
|
|
1534
|
-
var n = i.toString(),
|
|
1535
|
-
a = t ? t + '-' + i : n;
|
|
1536
|
-
x(e) || j(e)
|
|
1537
|
-
? r.push({ title: n, value: a, key: a, children: fe(e, a) })
|
|
1538
|
-
: r.push({ title: n, value: a, key: a });
|
|
1539
|
-
}),
|
|
1540
|
-
r
|
|
1541
|
-
);
|
|
1542
|
-
}
|
|
1543
|
-
function ye(e, t) {
|
|
1544
|
-
var r = '';
|
|
1545
|
-
return (
|
|
1546
|
-
'object' === H(e.type) &&
|
|
1547
|
-
e.properties &&
|
|
1548
|
-
(e.propertyOrder ? e.propertyOrder : Object.keys(e.properties)).map(
|
|
1549
|
-
function (i) {
|
|
1550
|
-
var n = e.properties[i],
|
|
1551
|
-
a = t[i];
|
|
1552
|
-
('array' === H(n.type) && 'object' === H(n.type)) ||
|
|
1553
|
-
(a &&
|
|
1554
|
-
n.isConditionProp &&
|
|
1555
|
-
(r.indexOf('-') > 0 ? (r += '-' + a) : (r = a)));
|
|
1556
|
-
},
|
|
1557
|
-
),
|
|
1558
|
-
r
|
|
1559
|
-
);
|
|
1560
|
-
}
|
|
1561
|
-
function me(e) {
|
|
1562
|
-
var t = e.split('-');
|
|
1563
|
-
return t.pop(), t.join('-');
|
|
1564
|
-
}
|
|
1565
|
-
function ve(e) {
|
|
1566
|
-
var t = e.split('-'),
|
|
1567
|
-
r = t.pop();
|
|
1568
|
-
return [t.join('-'), r];
|
|
1569
|
-
}
|
|
1570
|
-
var be = [
|
|
1571
|
-
'key',
|
|
1572
|
-
'enum',
|
|
1573
|
-
'enumextra',
|
|
1574
|
-
'items',
|
|
1575
|
-
'input',
|
|
1576
|
-
'boolean',
|
|
1577
|
-
'number',
|
|
1578
|
-
'color',
|
|
1579
|
-
'url',
|
|
1580
|
-
'textarea',
|
|
1581
|
-
'text-editor',
|
|
1582
|
-
'radio',
|
|
1583
|
-
'select',
|
|
1584
|
-
'checkboxes',
|
|
1585
|
-
'date',
|
|
1586
|
-
'date-time',
|
|
1587
|
-
'time',
|
|
1588
|
-
'json',
|
|
1589
|
-
'codearea',
|
|
1590
|
-
'htmlarea',
|
|
1591
|
-
'quantity',
|
|
1592
|
-
'box-style',
|
|
1593
|
-
'dynamic-data',
|
|
1594
|
-
'datasource',
|
|
1595
|
-
'event',
|
|
1596
|
-
'array',
|
|
1597
|
-
'object',
|
|
1598
|
-
];
|
|
1599
|
-
return t;
|
|
1600
|
-
})();
|
|
1601
|
-
});
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.JSONUtils=t():e.JSONUtils=t()}(this,function(){return function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{DataSourceTypeList:function(){return s},EventTypeDataList:function(){return u},KeyWordList:function(){return fe},TypeDataList:function(){return l},dataRoute2dataPath:function(){return le},evalExpression:function(){return U},getCurPosition:function(){return G},getDefaultOptionVal:function(){return re},getExpectType:function(){return I},getJsonDataByKeyRoute:function(){return P},getNextIndexRoute:function(){return X},getParentIndexRoute:function(){return Q},getParentIndexRoute_CurIndex:function(){return Y},getParentKeyRoute:function(){return ce},getParentKeyRoute_CurKey:function(){return de},getSchemaByIndexRoute:function(){return C},getSchemaByKeyRoute:function(){return w},hasProperties:function(){return N},indexRoute2keyRoute:function(){return E},isArray:function(){return g},isBoolean:function(){return y},isColor:function(){return x},isContainerSchema:function(){return V},isDateStr:function(){return m},isDateTimeStr:function(){return v},isEmptySchema:function(){return M},isEqual:function(){return D},isEqualByIdT:function(){return R},isFunction:function(){return S},isNewSchemaData:function(){return H},isNumber:function(){return f},isObject:function(){return j},isQuantity:function(){return O},isSameParent:function(){return Z},isSelect:function(){return h},isString:function(){return d},isStructuredSchema:function(){return W},isTimeStr:function(){return b},isURL:function(){return c},json2schema:function(){return L},json2treeData:function(){return ue},keyRoute2indexRoute:function(){return A},metaElemAnalyzer:function(){return K},moveBackward:function(){return te},moveForward:function(){return ee},objClone:function(){return k},oldSchemaToNewSchema:function(){return z},oldSchemaToNewSchemaV1:function(){return _},registerExpectType:function(){return $},schema2conditionValue:function(){return se},schema2json:function(){return oe},schemaMetaList:function(){return pe},truncate:function(){return F},urlParse:function(){return q},urlStringify:function(){return T}});var r=require("lodash"),i=require("qs"),n=e.n(i),a={type:"event",title:"事件",isContainer:!1,properties:{type:{default:"emit",type:"select",options:[{label:"on",value:"on"},{label:"emit",value:"emit"}],title:"事件类型"},trigger:{type:"input",default:"eventName",title:"触发事件",description:"用于输入触发事件的名称",placeholder:"请输入触发事件的名称"},eventData:{title:"事件数据",type:"json",default:"{}",description:"传递给触发事件的数据对象"}},propertyOrder:["type","trigger","eventData"]},o={type:"datasource",title:"数据源",isContainer:!1,properties:{type:{default:"local",type:"select",options:[{label:"本地数据",value:"local"},{label:"接口数据",value:"remote"}],title:"数据源类型"},data:{title:"本地json数据",placeholder:"请输入静态json数据",type:"json",default:"{}",description:"用于设置本地的静态json数据",isRequired:!0},filter:{title:"过滤器",type:"codearea",default:"() => {}",description:"用于定义过滤当前数据的函数",isRequired:!0}},propertyOrder:["type","data","filter"]},p={type:"local",config:{url:"",method:"get",headers:{},data:{},dataType:"json"},data:"{}",localFilter:"return data;"},l={jsonschema:{type:"object",title:"jsonSchemaObject",properties:{func:{type:"object",title:"功能设置",properties:{a:{title:"单文本框",type:"input",default:"",description:"",placeholder:"",isRequired:!1}},propertyOrder:["a"]},style:{type:"object",title:"样式设置",properties:{b:{title:"单文本框",type:"input",default:"",description:"",placeholder:""}},propertyOrder:["b"]},data:{type:"data",title:"数据设置",properties:{c:{title:"单文本框",type:"input",default:"",description:"",placeholder:"",isRequired:!1}},propertyOrder:["c"]}},propertyOrder:["func","style","data"]},input:{title:"单文本框",type:"input",default:"",description:"",placeholder:""},boolean:{type:"boolean",title:"布尔值",default:!1,description:""},object:{type:"object",title:"对象Object",description:"",properties:{a:{type:"input",title:"单文本框",default:"",description:"",placeholder:""}},propertyOrder:["a"]},array:{type:"array",title:"数组Array",description:"",items:{type:"object",title:"数组项",description:"",properties:{name:{type:"input",title:"名字",default:"",description:"",placeholder:""}},propertyOrder:["name"]}},"empty-array":{type:"array",title:"数组Array",description:"",default:[],items:{type:"object",title:"数组项",description:"",properties:{}}},"empty-object":{type:"object",title:"对象Object",description:"",properties:{}},url:{type:"url",title:"链接地址url",default:"",description:"",placeholder:""},textarea:{type:"textarea",title:"多行文本框",default:"",description:"",placeholder:""},color:{type:"color",title:"颜色color",default:"#ffffff",description:""},image:{title:"图片",type:"image",default:"",description:"上传图片",imgWidth:200,imgHeight:200,imgRatioReadOnly:!0},number:{type:"number",title:"数量number",default:1,minimum:0,maximum:1e3,description:""},"input-image":{title:"图片地址",type:"input-image",description:"",accept:".jpeg,.jpg,.png",multiple:!0},json:{title:"json数据",type:"json",default:"{}",description:""},codearea:{type:"codearea",title:"函数类型",placeholder:"请输入函数方法",default:'function func() { console.log("hello, world!"); }',description:"用于定义函数方法"},htmlarea:{title:"富文本",type:"htmlarea",placeholder:"请输入html代码片段",default:"<p>hello,world!</p>",description:"用于放置html代码片段"},"text-editor":{type:"text-editor",title:"富文本",default:"",description:"",placeholder:""},date:{type:"date",title:"日期Date",default:"",description:"",placeholder:""},"date-time":{type:"date-time",title:"日期时间",default:"",description:"",placeholder:""},time:{type:"time",title:"时间Time",default:"",description:"",placeholder:""},quantity:{type:"quantity",title:"单位计量",isContainer:!1,properties:{unit:{type:"number",title:"单位数值",default:50,minimum:0,maximum:1e3,description:""},quantity:{type:"select",default:"px",options:[{label:"px",value:"px"},{label:"rem",value:"rem"},{label:"em",value:"em"},{label:"%",value:"%"}],title:"单位类型"}},propertyOrder:["unit","quantity"]},"box-style":{type:"box-style",title:"盒子模型",isContainer:!1,properties:{unit:{title:"单位数值",type:"input",default:"0",description:""},quantity:{type:"select",default:"px",options:[{label:"px",value:"px"},{label:"rem",value:"rem"},{label:"em",value:"em"},{label:"%",value:"%"}],title:"单位类型"}},propertyOrder:["unit","quantity"]},"padding-margin":{type:"padding-margin",title:"边距设置",isContainer:!1,properties:{margin:{title:"外边距",type:"input",default:"0",description:""},padding:{title:"内边距",type:"input",default:"0",description:""},quantity:{type:"select",default:"px",options:[{label:"px",value:"px"},{label:"rem",value:"rem"},{label:"em",value:"em"},{label:"%",value:"%"}],title:"单位类型"}},propertyOrder:["margin","padding","quantity"]},radio:{type:"radio",title:"单选",options:[{label:"选项a",value:"a"},{label:"选项b",value:"b"},{label:"选项c",value:"c"}],description:""},select:{type:"select",title:"下拉选择",options:[{label:"选项a",value:"a"},{label:"选项b",value:"b"},{label:"选项c",value:"c"}],description:""},cascader:{type:"cascader",title:"级联选择",options:[{value:"zhejiang",label:"Zhejiang",children:[{value:"hangzhou",label:"Hangzhou",children:[{value:"xihu",label:"West Lake"}]}]},{value:"jiangsu",label:"Jiangsu",children:[{value:"nanjing",label:"Nanjing",children:[{value:"zhonghuamen",label:"Zhong Hua Men"}]}]}],default:"a",description:"",showSearch:!0,allowClear:!0},checkboxes:{type:"checkboxes",title:"多选",options:[{label:"选项a",value:"a"},{label:"选项b",value:"b"},{label:"选项c",value:"c"}],default:["a"],description:""},"dynamic-data":{type:"dynamic-data",title:"动态数据源",isContainer:!1,properties:{type:{default:"local",type:"select",options:[{label:"本地数据",value:"local"},{label:"接口数据",value:"remote"}],title:"数据类型"},config:{title:"接口配置",type:"api",description:"用于存放接口的配置数据(url、请求参数等)",isRequired:!0,properties:{url:{type:"url",title:"请求地址",default:"",description:"API 的 URL",isRequired:!0},method:{type:"select",title:"请求方式",default:"get",options:[{label:"GET",value:"get"},{label:"POST",value:"post"},{label:"PUT",value:"put"},{label:"PATCH",value:"patch"},{label:"DELETE",value:"delete"}],isRequired:!0},headers:{type:"json",title:"请求头",default:"{}",description:"请求头对象"},data:{type:"json",title:"请求参数",default:"{}",description:"请求体或查询参数"},dataType:{type:"select",title:"数据格式",default:"json",options:[{label:"JSON",value:"json"},{label:"FormData",value:"form-data"},{label:"Form",value:"form"}]},cache:{type:"number",title:"缓存时间",default:void 0,description:"缓存时间(ms),不设置则不缓存"}},propertyOrder:["url","method","headers","data","dataType","cache"]},data:{title:"数据内容",type:"json",default:"{}",description:"用于存放DynamicData的数据内容",isRequired:!0},localFilter:{title:"过滤器",type:"codearea",default:"return data;",description:"用于定义过滤本地数据",isRequired:!0}},propertyOrder:["type","config","data","localFilter"]},datasource:o,event:a,api:{type:"api",title:"API 配置",isContainer:!1,properties:{url:{type:"url",title:"请求地址",default:"",description:"API 的 URL",isRequired:!0},method:{type:"select",title:"请求方式",default:"get",options:[{label:"GET",value:"get"},{label:"POST",value:"post"},{label:"PUT",value:"put"},{label:"DELETE",value:"delete"}],isRequired:!0},headers:{type:"json",title:"请求头",default:"{}",description:"请求头对象"},data:{type:"json",title:"请求参数",default:"{}",description:"请求体或查询参数"}},propertyOrder:["url","method","headers","data"]}},u={on:{type:"event",title:"事件",isContainer:!1,properties:{type:{default:"on",type:"select",options:[{label:"on",value:"on"},{label:"emit",value:"emit"}],title:"事件类型"},register:{type:"input",default:"eventName",title:"注册事件",description:"用于输入注册事件的名称",placeholder:"请输入注册事件的名称"},actionFunc:{title:"执行函数",type:"codearea",default:"() => {}",description:""}},propertyOrder:["type","register","actionFunc"]},emit:a},s={local:o,remote:{type:"datasource",title:"数据源",isContainer:!1,properties:{type:{type:"select",default:"remote",options:[{label:"本地数据",value:"local"},{label:"接口数据",value:"remote"}],title:"数据源类型"},data:{type:"url",title:"远程json数据",placeholder:"请输入远程json数据源地址",default:"http://xxx",isRequired:!0,description:"用于设置获取元素数据的请求地址"},filter:{type:"codearea",title:"过滤器",default:"() => {}",description:"用于定义过滤当前数据的函数",isRequired:!0}},propertyOrder:["type","data","filter"]}};function c(e){return/^http[s]?:\/\/.*/.test(e)}function d(e){return"String"===Object.prototype.toString.call(e).slice(8,-1)}function f(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function y(e){return"Boolean"===Object.prototype.toString.call(e).slice(8,-1)}function m(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)}function v(e){return/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/.test(e)||/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/.test(e)}function b(e){return/^\d{2}:\d{2}:\d{2}$/.test(e)||/^\d{2}:\d{2}$/.test(e)}function g(e){var t=!1;return"Array"===Object.prototype.toString.call(e).slice(8,-1)&&(t=!0),t}function h(e){if(!g(e))return!1;for(var t=0,r=e.length;t<r;t++)if(!d(e[t]))return!1;return!0}function j(e){var t=!1;return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&(t=!0),t}function O(e){var t,r=!1;return((null===(t=l.quantity.properties.quantity)||void 0===t?void 0:t.enum)||[]).indexOf(e)>=0&&(r=!0),r}function x(e){return/^#[0-9a-f]{6}$/.test(e)||/^#[0-9a-f]{3}$/.test(e)}function S(e){var t=!1;return"Function"===Object.prototype.toString.call(e).slice(8,-1)&&(t=!0),t}function q(){var e={};return location.search&&(e=n().parse(location.search.substring(1))),e}function T(e){var t="";return e&&(t=n().stringify(e)),t}function k(e){return(0,r.cloneDeep)(e)}function D(e,t){if(N(e)&&!N(t)||!N(e)&&N(t)||typeof e!=typeof t)return!1;if(j(e)&&(e.id!==t.id||e.lastUpdateTime!==t.lastUpdateTime))return!1;var i=(new Date).getTime();return!!(j(e)&&e.lastUpdateTime&&e.lastUpdateTime===t.lastUpdateTime&&i-e.lastUpdateTime<500)||(0,r.isEqual)(e,t)}function R(e,t){if(N(e)&&!N(t)||!N(e)&&N(t)||typeof e!=typeof t)return!1;if(j(e)&&(e.id!==t.id||e.lastUpdateTime!==t.lastUpdateTime))return!1;var i=(new Date).getTime();return!!(j(e)&&e.lastUpdateTime&&e.lastUpdateTime===t.lastUpdateTime&&i-e.lastUpdateTime<500)||!(!j(e)||!(N(e.id)&&e.id===t.id||N(e.lastUpdateTime)&&e.lastUpdateTime===t.lastUpdateTime))||(0,r.isEqual)(e,t)}function N(e){var t=!1;return null!=e&&(t=!0),t}function F(e,t){return(0,r.truncate)(e,t)}function U(e,t){var r=t||{};if(!e)return!1;var i=new Function("data","with(data) { return ("+e+");}"),n="";try{n=i(r)}catch(t){return console.warn("表达式运算出错: "+e+",报错信息:",t),n}return n}function P(e,t,r){var i=t;if(r&&(i=k(t)),e)for(var n=e.split("-"),a=0,o=n.length;a<o;a++){var p=n[a];p&&(i=i&&i[p])}return i}function C(e,t,r){var i=t;if(r&&(i=k(t)),e)for(var n="string"==typeof e?e.split("-"):[e.toString()],a=0,o=n.length;a<o;a++){var p=n[a];if("0"!==p||"array"!==i.type&&"radio"!==i.type&&"select"!==i.type&&"checkboxes"!==i.type||!i.options&&!i.items){if(p){var l="0";i.propertyOrder?l=i.propertyOrder[p]:i.properties&&(l=Object.keys(i.properties)[Number(p)]),i=i.properties[l]}}else i=i.options||i.items}return i}function w(e,t,r){var i=t;if(r&&(i=k(t)),e&&i)for(var n=e.split("-"),a=0,o=n.length;a<o;a++){var p=n[a];p&&i.properties&&(i=i.properties[p])}return i}function E(e,t){for(var r=t,i="",n="string"==typeof e?e.split("-"):[e.toString()],a=0,o=n.length;a<o;a++){var p=n[a];if("0"===p&&r.items)r=r.items,i=i?i+"-items":"items";else if("0"===p&&r.options)r=r.options,i=i?i+"-options":"options";else if(p){var l="0";r.propertyOrder?l=r.propertyOrder[p]:r.properties&&(l=Object.keys(r.properties)[Number(p)]),r=r.properties[l],i=i?i+"-"+l:l}}return i}function A(e,t){for(var r=t,i="",n=e.split("-"),a=0,o=n.length;a<o;a++){var p=n[a];if(p){var l=-1;r.propertyOrder?(l=r.propertyOrder.indexOf(p),r=r.properties[p]):r.properties?(l=Object.keys(r.properties).indexOf(p),r=r.properties[p]):r.items?(l=0,r=r.items):r.options&&(l=0,r=r.options),i=i?i+"-"+l:l.toString()}}return i}function L(e){var t;return t=e&&j(e)?function(e){var t={};if(j(e)){var r=Object.keys(e);e.data&&e.filter&&2===r.length?t=g(e.data)||j(e.data)?k(s.local):k(s.remote):e.trigger&&e.eventData&&2===r.length?t=k(u.emit):e.register&&e.actionFunc&&2===r.length?t=k(u.on):e.quantity&&O(e.quantity)&&2===r.length?t=k(l.quantity):(t=k(l["empty-object"]),Object.keys(e).map(function(r){var i=e[r];t.properties[r]=L(i)}))}return t}(e):e&&g(e)?function(e){var t;if(e&&g(e))if(h(e)){(t=k(l.select)).items.enum=e;var r=t.items.enumextra.length,i=e.length;if(i>r)for(var n=r,a=i;n<a;n++)t.items.enumextra.push("选项"+e(n))}else{t=k(l["empty-array"]);var o=L(e[0]);t.items.properties=o.properties}return t}(e):function(e){var t="";if(y(e))t=k(l.boolean);else if(f(e))t=k(l.number);else if(c(e))t=k(l.url);else if(m(e))t=k(l.date);else if(v(e))t=k(l["date-time"]);else if(b(e))t=k(l.time);else if(x(e))t=k(l.color);else try{t=f(JSON.parse(e))?k(l.input):k(l.json)}catch(r){t=e&&e.length>30?k(l.textarea):k(l.input)}return t}(e),t}var J={array:"array",boolean:"boolean","box-style":"object","padding-margin":"object",codearea:"string",color:"string",datasource:"object",date:"string","date-time":"string","dynamic-data":"object",event:"object","func-body":"string",htmlarea:"string",image:"string",input:"string",json:"string",number:"number","input-image":"string",object:"object",quantity:"object",radio:"string",select:"string",textarea:"string","text-editor":"string",time:"string",url:"string"};function I(e){return J[e]||e}function $(e,t){J[e]?console.warn("当前已经存在"+e+"("+J[e]+"),暂时不支持覆盖。"):J[e]=t}function B(e,t){var r=t||{};return j(e)&&"object"===I(e.type)&&e.properties&&(e.propertyOrder?e.propertyOrder:Object.keys(e.properties)).map(function(t){var i=e.properties[t];r=K(i,r)}),r}function K(e,t){var r=!t,i=t||{};if(e&&"{}"!==JSON.stringify(e)){var n=e.type;"object"===n||"func"===n||"style"===n||"data"===n?(!r&&i.object?i.object+=1:r||(i.object=1),i=B(e,i)):"array"===n?(!r&&i.array?i.array+=1:r||(i.array=1),i=B(e=e.items,i)):!r&&i[n]?i[n]+=1:r||(i[n]=1)}return i}function _(e){var t=k(e);if(!t.title&&t.description&&(t.title=t.description),t.type||(t.type=t.format),"quantity"!==t.type&&"array"!==t.type&&"datasource"!==t.type&&"event"!==t.type&&"object"!==t.type||!N(t.default)||delete t.default,"radio"===t.type&&(t.type="string",t.enum&&t.enumextra&&(t.items={type:"string",enum:k(t.enum),enumextra:k(t.enumextra)},delete t.enum,delete t.enumextra)),"quantity"===t.type){var r=t.properties,i=k(l.quantity);if(r.quantity&&j(r.quantity)&&r.quantity.default){var n=r.quantity.default;i.properties.quantity.default="percent"===n?"%":n}t=i}if("datasource"===t.type){var a=t.properties,o=a.type&&a.type.default,p=a.data&&a.data.default,c=a.filter&&a.filter.default;"local"===o?(t=k(s.local)).properties.data.default=p?k(p):"{}":(t=k(s.remote)).properties.data.default=p?k(p):"http://xxx",t.properties.filter.default=c?k(c):"() => {}"}if("event"===t.type){var d=t.properties,f=d.type&&d.type.default;if("in"===f||"on"===f){var y=d.filter&&d.filter.default||"() => {}";t=k(u.on),d.actionFunc&&j(d.actionFunc)&&(t.properties.actionFunc.default=d.actionFunc.default||k(y))}else{var m=d.filter&&d.filter.default||"{}";t=k(u.emit),d.eventData&&j(d.eventData)&&(t.properties.eventData.default=d.eventData.default||k(m))}}return t.properties&&(t.propertyOrder||(t.propertyOrder=Object.keys(t.properties)),t.propertyOrder.map(function(e){t.properties[e]=z(t.properties[e])})),t.items&&(t.items=z(t.items)),t}function z(e){var t=k(e);return t.required||delete t.required,t.type&&t.type&&(t.type=t.type),"quantity"!==t.type&&"array"!==t.type&&"datasource"!==t.type&&"event"!==t.type&&"object"!==t.type||!N(t.default)||delete t.default,"radio"!==t.type&&"checkboxes"!==t.type&&"select"!==t.type||t.items&&t.items.enum&&t.items.enumextra&&(t.options=[],t.items.enum.forEach(function(e,r){t.options.push({label:t.items.enumextra[r]||e,value:e})}),delete t.items),t.properties&&(t.propertyOrder||(t.propertyOrder=Object.keys(t.properties)),t.propertyOrder.map(function(e){t.properties[e]=z(t.properties[e])})),"array"===t.type&&t.items&&(t.items=z(t.items)),t}function M(e){var t=!0;if(!e)return t;var r=e.type;return("object"===r&&e.properties&&e.propertyOrder&&e.propertyOrder.length>0||"array"===r&&e.items&&e.items.properties&&e.items.propertyOrder&&e.items.propertyOrder.length>0||e.type&&"array"!==e.type&&"object"!==e.type||e.type)&&(t=!1),t}function H(e){var t=!1,r=e.lastUpdateTime,i=new Date("2024-10-05T00:01:00.691Z").getTime();return r&&new Date(r).getTime()>=i&&(t=!0),t}function V(e){var t=!1,r=I(e.type),i=void 0===e.isContainer||e.isContainer;return"object"===r&&i&&(t=!0),t}function W(e){var t=!0;return"object"===e.type&&e.propertyOrder&&e.properties?e.propertyOrder.map(function(r){var i=e.properties[r];"object"===e.type&&i.propertyOrder&&i.properties||(t=!1)}):t=!1,t}function Z(e,t){var r=e.split("-"),i=t.split("-");return r.pop(),i.pop(),r.join("-")===i.join("-")}function G(e,t){for(var r=e.split("-"),i=t.split("-"),n="before",a=0,o=(r.length>i.length?i:r).length;a<o;a+=1)Number(r[a])>Number(i[a])&&(n="after");return n}function Q(e){var t="string"==typeof e?e.split("-"):[e.toString()];return t.pop(),t.join("-")}function X(e){var t="string"==typeof e?e.split("-"):[e.toString()],r=t.pop(),i=Number(r)+1;return t.push(""+i),t.join("-")}function Y(e){var t="string"==typeof e?e.split("-"):[e.toString()],r=t.pop()||"";return[t.join("-"),r]}function ee(e){var t="string"==typeof e?e.split("-"):[e.toString()],r=t.pop();return t.push(Number(r)-1),t.join("-")}function te(e){var t="string"==typeof e?e.split("-"):[e.toString()],r=t.pop();return t.push(Number(r)+1),t.join("-")}function re(e,t){var r="",i=!1;if(!1!==e.defaultActiveFirstOption&&e.defaultActiveFirstOption)return e.options&&e.options[0]&&(r=e.options[0].value,i=!0),(t||e.multiple)&&(r=i?[r]:[]),r}function ie(e,t){var r,i,n=void 0,a=t;N(a)&&N(e.default)&&(typeof a!=typeof e.default||(r=a,i=e.default,j(r)+"-"+g(r)!=j(i)+"-"+g(i)))&&(a=void 0);var o=N(a)?a:e.default;switch(e.type){case"select":case"radio":n=null!=o?o:re(e);break;case"checkboxes":n=null!=o?o:re(e,!0);break;case"color":"#fff"!==o&&"#FFF"!==o||(o="#ffffff"),n=N(o)?o:"#ffffff";break;case"boolean":n=!!N(o)&&o;break;case"number":n=N(o)?o:void 0;break;case"json":var p="";if(j(o)||g(o))p=o;else if(S(o)||""===o)p={};else try{p=JSON.parse(o)}catch(e){p={}}n=p;break;default:n="input"===e.type&&"0"===e.default?o||e.default:N(o)?o:void 0}return n}function ne(e,t){var r={},i=e.type;if(j(e)&&"object"===I(e.type)){var n=e,a=t;N(a)&&(N(n.default)&&typeof a!=typeof e.default||!j(a))&&(a=void 0);var o=N(a)?a:n.default;"dynamic-data"===i?(r=k(p),o&&j(o)&&"{}"!==JSON.stringify(o)&&(r=Object.assign(r,o))):"datasource"===i?n.properties&&n.properties.type&&n.properties.type.default&&"local"===n.properties.type.default?(r={data:"{}",filter:"() => {}"},o&&o.data&&(r.data=o.data),o&&o.filter&&(r.filter=o.filter),"http://xxx"===r.data&&(r.data="{}")):(r={data:"http://xxx",filter:"() => {}"},o&&o.data&&(r.data=o.data),o&&o.filter&&(r.filter=o.filter),"{}"===r.data&&(r.data="http://xxx")):"event"===i?n.properties&&n.properties.type&&n.properties.type.default&&"emit"===n.properties.type.default?o&&"out"===o.type?r={trigger:o&&o.filter||"eventName",eventData:"{}"}:(r={trigger:"eventName",eventData:"{}"},o&&o.trigger&&(r.trigger=o.trigger),o&&o.eventData&&(r.eventData=o.eventData)):o&&"in"===o.type?r={register:"eventName",actionFunc:o&&o.filter||"() => {}"}:(r={register:"eventName",actionFunc:"() => {}"},o&&o.register&&(r.register=o.register),o&&o.actionFunc&&(r.actionFunc=o.actionFunc)):!1===e.isContainer&&o&&j(o)&&"{}"!==JSON.stringify(o)?r=Object.assign(r,o):void 0===a&&n.default&&j(n.default)?r=n.default:e.properties&&(e.propertyOrder?e.propertyOrder:Object.keys(e.properties)).map(function(i){var n=e.properties[i],a=t&&t[i];switch(I(n.type)){case"array":r[i]=ae(n,a);break;case"object":r[i]=ne(n,a);break;default:r[i]=ie(n,a)}})}return r}function ae(e,t){var r=[];if(e&&"array"===I(e.type)){var i=t;N(i)&&(N(e.default)&&typeof i!=typeof e.default||!g(i))&&(i=void 0);var n=N(i)?i:e.default;if("array"===I(e.type))if(g(n))n.map(function(t){r.push(ne(e.items,t))});else if(n)r=n;else{var a=ne(e.items,n);r.push(a)}else r=N(n)?n:[]}return r}function oe(e,t){return"object"===I(e.type)?ne(e,t):"array"===I(e.type)?ae(e,t):ie(e,t)}var pe=l;function le(e,t){var r=t||"data";return e.split("-").map(function(e){r=/^\d+$/.test(e)?r+"["+e+"]":r+"."+e}),r}function ue(e,t){var r=[];return j(e)?Object.keys(e).map(function(i){var n=e[i],a=t?t+"-"+i:i;j(n)||g(n)?r.push({title:i,value:a,key:a,children:ue(n,a)}):r.push({title:i,value:a,key:a})}):g(e)&&e.map(function(e,i){var n=i.toString(),a=t?t+"-"+i:n;j(e)||g(e)?r.push({title:n,value:a,key:a,children:ue(e,a)}):r.push({title:n,value:a,key:a})}),r}function se(e,t){var r="";return"object"===I(e.type)&&e.properties&&(e.propertyOrder?e.propertyOrder:Object.keys(e.properties)).map(function(i){var n=e.properties[i],a=t[i];"array"===I(n.type)&&"object"===I(n.type)||a&&n.isConditionProp&&(r.indexOf("-")>0?r+="-"+a:r=a)}),r}function ce(e){var t=e.split("-");return t.pop(),t.join("-")}function de(e){var t=e.split("-"),r=t.pop()||"";return[t.join("-"),r]}var fe=["key","enum","enumextra","items","input","boolean","number","color","url","textarea","text-editor","radio","select","checkboxes","date","date-time","time","json","codearea","htmlarea","quantity","box-style","dynamic-data","datasource","event","array","object"];return t}()});
|