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