@wibetter/json-utils 7.0.3 → 7.0.5

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