ronds-metadata 1.1.87 → 1.1.89

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 (35) hide show
  1. package/es/api/index.d.ts +1 -1
  2. package/es/api/index.js +21 -7
  3. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +3 -2
  4. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.d.ts +2 -0
  5. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +17 -0
  6. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +45 -3
  7. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +5 -2
  8. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.d.ts +2 -0
  9. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +22 -0
  10. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +47 -3
  11. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +4 -2
  12. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +5 -2
  13. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +122 -2
  14. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +6 -2
  15. package/es/comps/FormGenerator/comps/Canvas/core/index.js +72 -14
  16. package/es/comps/FormGenerator/comps/Canvas/core/index.less +0 -1
  17. package/es/comps/FormGenerator/comps/Settings/index.js +1 -1
  18. package/es/comps/FormGenerator/comps/Sidebar/index.js +1 -1
  19. package/es/comps/FormGenerator/settings/index.d.ts +645 -17
  20. package/es/comps/FormGenerator/settings/index.js +71 -17
  21. package/es/comps/FormGenerator/settings/ruleConfig.d.ts +51 -2
  22. package/es/comps/FormGenerator/settings/ruleConfig.js +220 -7
  23. package/es/comps/FormGenerator/transformer.js +2 -2
  24. package/es/comps/MetadataForm/DataCell/Array.js +18 -4
  25. package/es/comps/MetadataForm/DataCell/Select.js +59 -9
  26. package/es/comps/MetadataForm/DataCell/layout/TableArray.d.ts +1 -1
  27. package/es/comps/MetadataForm/DataCell/layout/TableArray.js +75 -28
  28. package/es/comps/MetadataForm/utils.d.ts +1 -0
  29. package/es/comps/MetadataForm/utils.js +23 -2
  30. package/es/framework/metadata/MetadataService.d.ts +1 -1
  31. package/es/framework/metadata/MetadataService.js +8 -3
  32. package/es/framework/metadata/types.d.ts +98 -98
  33. package/es/utils.d.ts +3 -0
  34. package/es/utils.js +28 -2
  35. package/package.json +1 -1
@@ -1,31 +1,61 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+
1
3
  /*
2
4
  * @Author: wangxian
3
5
  * @Date: 2023-02-06 08:24:17
4
- * @LastEditTime: 2023-02-09 14:09:26
6
+ * @LastEditTime: 2023-02-14 14:30:30
5
7
  */
6
8
  import { RefRule, Rule } from './ruleConfig';
7
9
  export var inputSchema = [{
8
10
  id: 'inputSchema',
9
11
  type: 'object',
10
- properties: [Rule.common.id, Rule.common.label, Rule.common.color, Rule.common.defaultValue, Rule.common.help, Rule.common.tooltip, Rule.common.placeholder, Rule.common.require, Rule.common.disabled, Rule.common.hidden, RefRule.common.depend.props, RefRule.common.rules.props],
11
- types: [RefRule.common.depend.types]
12
+ properties: [Rule.common.id, Rule.common.label, Rule.common.color, Rule.common.colSpan, Rule.common.defaultValue, Rule.common.help, Rule.common.tooltip, Rule.common.placeholder, Rule.common.require, Rule.common.disabled, Rule.common.hidden, RefRule.common.depend.props, RefRule.common.rules.props],
13
+ types: [].concat(_toConsumableArray(RefRule.common.depend.types), _toConsumableArray(RefRule.common.rules.types))
12
14
  }];
13
15
  export var textareaSchema = [{
14
16
  id: 'textareaSchema',
15
17
  type: 'object',
16
- properties: [Rule.common.id, Rule.common.label, Rule.common.color, Rule.common.defaultValue, Rule.common.help, Rule.common.tooltip, Rule.common.placeholder, Rule.common.require, Rule.common.disabled, Rule.common.hidden, RefRule.common.depend.props, RefRule.common.rules.props],
17
- types: [RefRule.common.depend.types]
18
+ properties: [Rule.common.id, Rule.common.label, Rule.common.color, Rule.common.colSpan, Rule.common.defaultValue, Rule.common.help, Rule.common.tooltip, Rule.common.placeholder, Rule.common.require, Rule.common.disabled, Rule.common.hidden, RefRule.common.depend.props, RefRule.common.rules.props],
19
+ types: [].concat(_toConsumableArray(RefRule.common.depend.types), _toConsumableArray(RefRule.common.rules.types))
18
20
  }];
19
21
  export var dateSchema = [{
20
- id: 'textareaSchema',
22
+ id: 'dateSchema',
23
+ type: 'object',
24
+ properties: [Rule.common.id, Rule.common.label, Rule.common.color, Rule.common.colSpan, Rule.common.defaultValue, Rule.common.help, Rule.common.tooltip, Rule.common.placeholder, Rule.common.require, Rule.common.disabled, Rule.common.hidden, RefRule.common.depend.props, RefRule.common.rules.props, RefRule.text.props],
25
+ types: [].concat(_toConsumableArray(RefRule.common.depend.types), _toConsumableArray(RefRule.text.types), _toConsumableArray(RefRule.common.rules.types))
26
+ }];
27
+ export var numberSchema = [{
28
+ id: 'numberSchema',
29
+ type: 'object',
30
+ properties: [Rule.common.id, Rule.common.label, Rule.common.color, Rule.common.colSpan, Rule.common.defaultValue, Rule.common.help, Rule.common.tooltip, Rule.common.placeholder, Rule.common.require, Rule.common.disabled, Rule.common.hidden, RefRule.common.depend.props, RefRule.common.rules.props],
31
+ types: [].concat(_toConsumableArray(RefRule.common.depend.types), _toConsumableArray(RefRule.common.rules.types))
32
+ }];
33
+ export var switchSchema = [{
34
+ id: 'switchSchema',
21
35
  type: 'object',
22
- properties: [Rule.common.id, Rule.common.label, Rule.common.color, Rule.common.defaultValue, Rule.common.help, Rule.common.tooltip, Rule.common.placeholder, Rule.common.require, Rule.common.disabled, Rule.common.hidden, RefRule.common.depend.props, RefRule.common.rules.props, RefRule.text.props],
23
- types: [RefRule.common.depend.types, RefRule.text.types]
36
+ properties: [Rule.common.id, Rule.common.label, Rule.common.color, Rule.common.colSpan, Rule.common.defaultValue, Rule.common.help, Rule.common.tooltip, Rule.common.require, Rule.common.disabled, Rule.common.hidden, RefRule.common.depend.props],
37
+ types: _toConsumableArray(RefRule.common.depend.types)
38
+ }];
39
+ export var selectSchema = [{
40
+ id: 'selectSchema',
41
+ type: 'object',
42
+ properties: [Rule.common.id, Rule.common.label, RefRule.enum.props, Rule.common.color, Rule.common.colSpan, Rule.common.defaultValue, Rule.common.help, Rule.common.tooltip, Rule.common.require, Rule.common.disabled, Rule.common.hidden, RefRule.common.depend.props],
43
+ types: [].concat(_toConsumableArray(RefRule.common.depend.types), _toConsumableArray(RefRule.enum.types))
44
+ }];
45
+ export var mutiSelectSchema = [{
46
+ id: 'mutiSelectSchema',
47
+ type: 'object',
48
+ properties: [Rule.common.id, Rule.common.label, RefRule.enum.props, Rule.common.color, Rule.common.colSpan, Rule.common.defaultValue, Rule.common.help, Rule.common.tooltip, Rule.common.require, Rule.common.disabled, Rule.common.hidden, RefRule.common.depend.props],
49
+ types: [].concat(_toConsumableArray(RefRule.common.depend.types), _toConsumableArray(RefRule.enum.types))
24
50
  }];
25
51
  export var settingSchema = {
26
52
  input: inputSchema,
27
53
  textarea: textareaSchema,
28
- dateSchema: dateSchema
54
+ date: dateSchema,
55
+ numebr: numberSchema,
56
+ switch: switchSchema,
57
+ select: selectSchema,
58
+ mutiSelect: mutiSelectSchema
29
59
  };
30
60
  export var inputParam = {
31
61
  type: 'text',
@@ -40,10 +70,29 @@ export var textareaParam = {
40
70
  };
41
71
  export var dateParam = {
42
72
  type: 'text',
43
- schema: settingSchema.dateSchema,
73
+ schema: settingSchema.date,
44
74
  rule: {
45
75
  type: 'datePicker'
46
76
  }
77
+ };
78
+ export var numberParam = {
79
+ type: 'number',
80
+ schema: settingSchema.numebr
81
+ };
82
+ export var switchParam = {
83
+ type: 'bool',
84
+ schema: settingSchema.switch
85
+ };
86
+ export var selectParam = {
87
+ type: 'enum',
88
+ schema: settingSchema.select
89
+ };
90
+ export var mutiSelectParam = {
91
+ type: 'enum',
92
+ schema: settingSchema.mutiSelect,
93
+ rule: {
94
+ isMutiple: true
95
+ }
47
96
  }; // 基础组件列表渲染
48
97
 
49
98
  export var basicComps = [{
@@ -65,30 +114,34 @@ export var basicComps = [{
65
114
  id: 'number',
66
115
  name: '数字输入框',
67
116
  type: 'number',
68
- param: inputParam
117
+ param: numberParam
69
118
  }, {
70
119
  id: 'switch',
71
120
  name: '开关',
72
121
  type: 'switch',
73
- param: inputParam
122
+ param: switchParam
74
123
  }, {
75
124
  id: 'select',
76
125
  name: '下拉单选',
77
126
  type: 'select',
78
- param: inputParam
127
+ param: selectParam
79
128
  }, {
80
129
  id: 'mutiSelect',
81
130
  name: '下拉多选',
82
131
  type: 'mutiSelect',
83
- param: inputParam
132
+ param: mutiSelectParam
84
133
  }]; // 布局组件列表渲染
85
134
 
86
135
  export var layoutComps = [{
87
136
  id: 'obj',
88
- name: '对象'
137
+ name: '对象',
138
+ type: 'obj',
139
+ param: inputParam
89
140
  }, {
90
141
  id: 'list',
91
- name: '常规列表'
142
+ name: '常规列表',
143
+ type: 'list',
144
+ param: inputParam
92
145
  }]; // Sidebar 内容配置
93
146
 
94
147
  export var sidebarCtx = [{
@@ -202,5 +255,6 @@ export var streamEventType = {
202
255
  onNodeDelete: 'onNodeDelete',
203
256
  onNodeCopy: 'onNodeCopy',
204
257
  onClearCanvas: 'onClearCanvas',
205
- onSettingValueChange: 'onSettingValueChange'
258
+ onSettingValueChange: 'onSettingValueChange',
259
+ onDropOver: 'onDropOver'
206
260
  };
@@ -38,6 +38,25 @@ export declare const Rule: {
38
38
  };
39
39
  }[];
40
40
  };
41
+ colSpan: {
42
+ id: string;
43
+ type: string;
44
+ fields: {
45
+ id: string;
46
+ refId: string;
47
+ type: string;
48
+ value: {
49
+ 'common-en-US': {
50
+ depend: {};
51
+ };
52
+ common: {
53
+ label: string;
54
+ tooltip: string;
55
+ help: string;
56
+ };
57
+ };
58
+ }[];
59
+ };
41
60
  defaultValue: {
42
61
  id: string;
43
62
  type: string;
@@ -238,6 +257,7 @@ export declare const Rule: {
238
257
  }[];
239
258
  };
240
259
  };
260
+ enum: {};
241
261
  };
242
262
  export declare const RefRule: {
243
263
  common: {
@@ -277,7 +297,7 @@ export declare const RefRule: {
277
297
  };
278
298
  }[];
279
299
  }[];
280
- };
300
+ }[];
281
301
  };
282
302
  rules: {
283
303
  props: {
@@ -319,7 +339,7 @@ export declare const RefRule: {
319
339
  };
320
340
  }[];
321
341
  }[];
322
- };
342
+ }[];
323
343
  };
324
344
  };
325
345
  text: {
@@ -359,6 +379,35 @@ export declare const RefRule: {
359
379
  };
360
380
  }[];
361
381
  }[];
382
+ }[];
383
+ };
384
+ enum: {
385
+ props: {
386
+ id: string;
387
+ type: string;
388
+ refId: string;
389
+ fields: {
390
+ id: string;
391
+ type: string;
392
+ refId: string;
393
+ value: {
394
+ common: {
395
+ label: string;
396
+ };
397
+ ref: {
398
+ titleHidden: boolean;
399
+ };
400
+ 'common-en-US': {};
401
+ };
402
+ }[];
362
403
  };
404
+ types: {
405
+ id: string;
406
+ type: string;
407
+ properties: {
408
+ id: string;
409
+ type: string;
410
+ }[];
411
+ }[];
363
412
  };
364
413
  };
@@ -1,7 +1,9 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+
1
3
  /*
2
4
  * @Author: wangxian
3
5
  * @Date: 2023-02-08 10:36:25
4
- * @LastEditTime: 2023-02-09 14:08:23
6
+ * @LastEditTime: 2023-02-10 19:38:32
5
7
  */
6
8
  import { DEFAULT_DATE_FORMAT } from '../../../comps/MetadataForm/DataCell/Input';
7
9
  export var Rule = {
@@ -44,6 +46,25 @@ export var Rule = {
44
46
  }
45
47
  }]
46
48
  },
49
+ colSpan: {
50
+ id: 'colSpan',
51
+ type: 'number',
52
+ fields: [{
53
+ id: 'Rule.Form',
54
+ refId: 'com.ronds.schema.default.Rule.Form',
55
+ type: 'ref',
56
+ value: {
57
+ 'common-en-US': {
58
+ depend: {}
59
+ },
60
+ common: {
61
+ label: '组件布局',
62
+ tooltip: '默认按照整体布局配置排布',
63
+ help: '这里填写表单整体布局的倍数,最大一行'
64
+ }
65
+ }
66
+ }]
67
+ },
47
68
  defaultValue: {
48
69
  id: 'defaultValue',
49
70
  type: 'text',
@@ -265,6 +286,172 @@ export var Rule = {
265
286
  }
266
287
  }]
267
288
  }
289
+ },
290
+ enum: {}
291
+ };
292
+ var Ref2Rule = {
293
+ enum: {
294
+ value: {
295
+ props: {
296
+ id: 'value',
297
+ type: 'array',
298
+ items: {
299
+ type: 'ref',
300
+ refId: 'enumValueRule'
301
+ },
302
+ fields: [{
303
+ id: 'com.ronds.schema.default.Rule.Form.Common',
304
+ type: 'ref',
305
+ refId: 'com.ronds.schema.default.Rule.Form.Common',
306
+ value: {
307
+ common: {
308
+ label: '枚举值'
309
+ },
310
+ 'common-en-US': {},
311
+ array: {
312
+ layout: 'table',
313
+ rowNumber: 4
314
+ }
315
+ }
316
+ }]
317
+ },
318
+ types: [{
319
+ id: 'enumValueRule',
320
+ type: 'object',
321
+ properties: [{
322
+ id: 'key',
323
+ type: 'text'
324
+ }, {
325
+ id: 'value',
326
+ type: 'text'
327
+ }]
328
+ }]
329
+ },
330
+ http: {
331
+ props: {
332
+ id: 'http',
333
+ type: 'ref',
334
+ refId: 'httpRef',
335
+ fields: [{
336
+ id: 'Rule.Form',
337
+ type: 'ref',
338
+ refId: 'com.ronds.schema.default.Rule.Form',
339
+ value: {
340
+ common: {
341
+ label: '动态枚举值',
342
+ tooltip: '通过接口调用获取枚举值'
343
+ },
344
+ 'common-en-US': {}
345
+ }
346
+ }]
347
+ },
348
+ types: [{
349
+ id: 'httpRef',
350
+ type: 'object',
351
+ properties: [{
352
+ id: 'url',
353
+ type: 'text',
354
+ fields: [{
355
+ id: 'Rule.Form',
356
+ type: 'ref',
357
+ refId: 'com.ronds.schema.default.Rule.Form',
358
+ value: {
359
+ text: {},
360
+ common: {
361
+ label: '请求URL'
362
+ },
363
+ 'common-en-US': {}
364
+ }
365
+ }]
366
+ }, {
367
+ id: 'method',
368
+ type: 'enum',
369
+ enum: [{
370
+ value: 'get'
371
+ }, {
372
+ value: 'post'
373
+ }],
374
+ fields: [{
375
+ id: 'Rule.Form',
376
+ type: 'ref',
377
+ refId: 'com.ronds.schema.default.Rule.Form',
378
+ value: {
379
+ text: {},
380
+ common: {
381
+ label: '请求方法',
382
+ defaultValue: 'get'
383
+ },
384
+ 'common-en-US': {}
385
+ }
386
+ }]
387
+ }, {
388
+ id: 'body',
389
+ type: 'text',
390
+ fields: [{
391
+ id: 'Rule.Form',
392
+ type: 'ref',
393
+ refId: 'com.ronds.schema.default.Rule.Form',
394
+ value: {
395
+ text: {},
396
+ common: {
397
+ label: 'Body参数',
398
+ help: '支持Json字符串,系统会自动序列化',
399
+ depend: {// show: `method=='post'`,
400
+ }
401
+ },
402
+ 'common-en-US': {}
403
+ }
404
+ }]
405
+ }, {
406
+ id: 'key',
407
+ type: 'text',
408
+ fields: [{
409
+ id: 'Rule.Form',
410
+ type: 'ref',
411
+ refId: 'com.ronds.schema.default.Rule.Form',
412
+ value: {
413
+ text: {},
414
+ common: {
415
+ label: 'Key的替换属性'
416
+ },
417
+ 'common-en-US': {}
418
+ }
419
+ }]
420
+ }, {
421
+ id: 'value',
422
+ type: 'text',
423
+ fields: [{
424
+ id: 'Rule.Form',
425
+ type: 'ref',
426
+ refId: 'com.ronds.schema.default.Rule.Form',
427
+ value: {
428
+ text: {},
429
+ common: {
430
+ label: 'Vaule的替换属性'
431
+ },
432
+ 'common-en-US': {}
433
+ }
434
+ }]
435
+ }, {
436
+ id: 'watch',
437
+ type: 'text',
438
+ fields: [{
439
+ id: 'Rule.Form',
440
+ type: 'ref',
441
+ refId: 'com.ronds.schema.default.Rule.Form',
442
+ value: {
443
+ text: {},
444
+ common: {
445
+ label: '监听',
446
+ help: '监听多个属性,用英文逗号隔开',
447
+ placeholder: 'id,name'
448
+ },
449
+ 'common-en-US': {}
450
+ }
451
+ }]
452
+ }]
453
+ }]
454
+ }
268
455
  }
269
456
  };
270
457
  export var RefRule = {
@@ -286,11 +473,11 @@ export var RefRule = {
286
473
  }
287
474
  }]
288
475
  },
289
- types: {
476
+ types: [{
290
477
  id: 'dependRule',
291
478
  type: 'object',
292
479
  properties: [Rule.depend.show, Rule.depend.hidden]
293
- }
480
+ }]
294
481
  },
295
482
  rules: {
296
483
  props: {
@@ -313,11 +500,11 @@ export var RefRule = {
313
500
  }
314
501
  }]
315
502
  },
316
- types: {
503
+ types: [{
317
504
  id: 'rulesRule',
318
505
  type: 'object',
319
506
  properties: [Rule.rules.regExp, Rule.rules.message]
320
- }
507
+ }]
321
508
  }
322
509
  },
323
510
  text: {
@@ -337,10 +524,36 @@ export var RefRule = {
337
524
  }
338
525
  }]
339
526
  },
340
- types: {
527
+ types: [{
341
528
  id: 'textRule',
342
529
  type: 'object',
343
530
  properties: [Rule.text.format]
344
- }
531
+ }]
532
+ },
533
+ enum: {
534
+ props: {
535
+ id: 'enum',
536
+ type: 'ref',
537
+ refId: 'enumRule',
538
+ fields: [{
539
+ id: 'Rule.Form',
540
+ type: 'ref',
541
+ refId: 'com.ronds.schema.default.Rule.Form',
542
+ value: {
543
+ common: {
544
+ label: '高级设置'
545
+ },
546
+ ref: {
547
+ titleHidden: true
548
+ },
549
+ 'common-en-US': {}
550
+ }
551
+ }]
552
+ },
553
+ types: [{
554
+ id: 'enumRule',
555
+ type: 'object',
556
+ properties: [Ref2Rule.enum.value.props, Ref2Rule.enum.http.props]
557
+ }].concat(_toConsumableArray(Ref2Rule.enum.value.types), _toConsumableArray(Ref2Rule.enum.http.types))
345
558
  }
346
559
  };
@@ -4,7 +4,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  /*
5
5
  * @Author: wangxian
6
6
  * @Date: 2023-02-08 14:45:46
7
- * @LastEditTime: 2023-02-09 14:50:08
7
+ * @LastEditTime: 2023-02-10 18:18:23
8
8
  */
9
9
  import { deepClone } from '../../utils';
10
10
  var EMPTY_OBJ = [{
@@ -39,7 +39,7 @@ var renderProp = function renderProp(node, setting) {
39
39
  _prop.type = node.param.type;
40
40
  _prop.fields[0].value = _objectSpread(_objectSpread({}, _setting), {}, _defineProperty({
41
41
  label: (_setting === null || _setting === void 0 ? void 0 : _setting.label) || node.name
42
- }, node.param.type, _objectSpread({}, node.param.rule || {})));
42
+ }, node.param.type, _objectSpread({}, node.param.rule || _objectSpread({}, _setting[node.param.type]))));
43
43
  return _prop;
44
44
  }; // FG配置生成 metedata
45
45
 
@@ -12,11 +12,11 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
12
12
  /*
13
13
  * @Author: wangxian
14
14
  * @Date: 2021-09-18 14:15:04
15
- * @LastEditTime: 2023-02-04 09:02:03
15
+ * @LastEditTime: 2023-02-10 14:10:03
16
16
  */
17
17
  import React from 'react';
18
18
  import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
19
- import { MetadataFormContext } from '../interface';
19
+ import { MetadataFormContext, MetadataRefContext } from '../interface';
20
20
  import { useGetExtraInfo, useWatchDepend } from '../hooks';
21
21
  import { getDataCell } from '../utils';
22
22
  import { deepClone } from '../../../utils';
@@ -34,7 +34,21 @@ function Index(props) {
34
34
  name = props.name,
35
35
  disabled = props.disabled;
36
36
  var formContext = React.useContext(MetadataFormContext) || {};
37
- var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form, props.type);
37
+ var refContext = React.useContext(MetadataRefContext) || {};
38
+
39
+ var _fileds = React.useMemo(function () {
40
+ var ff = formContext === null || formContext === void 0 ? void 0 : formContext.fields;
41
+
42
+ if (refContext === null || refContext === void 0 ? void 0 : refContext.fields) {
43
+ refContext === null || refContext === void 0 ? void 0 : refContext.fields.forEach(function (v, k) {
44
+ ff.set(k, v);
45
+ });
46
+ }
47
+
48
+ return ff;
49
+ }, [formContext === null || formContext === void 0 ? void 0 : formContext.fields, refContext === null || refContext === void 0 ? void 0 : refContext.fields]);
50
+
51
+ var extraInfo = useGetExtraInfo(formContext === null || formContext === void 0 ? void 0 : formContext.fields, id, formContext.form, props.type);
38
52
 
39
53
  var _React$useState = React.useState(),
40
54
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -99,7 +113,7 @@ function Index(props) {
99
113
  rowNumber: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.rowNumber) || 10,
100
114
  refId: items.refId,
101
115
  form: formContext.form,
102
- name: id
116
+ name: myName
103
117
  }) : /*#__PURE__*/React.createElement("div", {
104
118
  style: {
105
119
  padding: '10px',
@@ -20,13 +20,14 @@ import _Cascader from "antd/es/cascader";
20
20
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
21
21
  import _regeneratorRuntime from "@babel/runtime/regenerator";
22
22
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
23
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
23
24
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
24
25
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
25
26
 
26
27
  /*
27
28
  * @Author:wangxian
28
29
  * @Date: 2021-09-18 14:15:04
29
- * @LastEditTime: 2023-02-09 14:24:16
30
+ * @LastEditTime: 2023-02-14 08:54:35
30
31
  */
31
32
  import React from 'react';
32
33
  import { MetadataFormContext, MetadataRefContext } from '../interface';
@@ -82,13 +83,60 @@ function Index(props) {
82
83
  // 判断是否有 watch的扩展属性
83
84
  var _watch = extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http = extraInfo.http) === null || _extraInfo$http === void 0 ? void 0 : _extraInfo$http.watch;
84
85
 
85
- if (_watch && (p === null || p === void 0 ? void 0 : p.type) === 'onSelectChange') {
86
- var _value = p === null || p === void 0 ? void 0 : p.payload[_watch];
86
+ if (_watch && (p === null || p === void 0 ? void 0 : p.type) === 'onValuesChange') {
87
+ var _watchArr = _watch.split(',');
87
88
 
88
- if (_value) {
89
- setWatchValue(_value);
90
- watchValueRef.current = _value;
91
- formContext.form.setFieldsValue(_defineProperty({}, id, undefined));
89
+ if (_watchArr.length === 1) {
90
+ var _p$payload, _p$payload2;
91
+
92
+ var _value = p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : _p$payload.allVals[_watchArr[0]];
93
+
94
+ if (_value) {
95
+ if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http.method) === 'post') {
96
+ var _wRef = watchValueRef.current || {};
97
+
98
+ _wRef[_watchArr[0]] = _value;
99
+ watchValueRef.current = _wRef;
100
+ setWatchValue(_value);
101
+ } else {
102
+ setWatchValue(_value.toString());
103
+ watchValueRef.current = _value;
104
+ }
105
+ }
106
+
107
+ if (p === null || p === void 0 ? void 0 : (_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.val[_watchArr[0]]) {
108
+ setTimeout(function () {
109
+ formContext.form.setFieldsValue(_defineProperty({}, id, undefined));
110
+ }, 100);
111
+ }
112
+ } else {
113
+ var b = false;
114
+
115
+ for (var i = 0; i < _watchArr.length; i++) {
116
+ var _p$payload3;
117
+
118
+ var w = _watchArr[i];
119
+
120
+ var _value2 = p === null || p === void 0 ? void 0 : (_p$payload3 = p.payload) === null || _p$payload3 === void 0 ? void 0 : _p$payload3.allVals[w];
121
+
122
+ if (_value2) {
123
+ var _p$payload4;
124
+
125
+ var _wRef2 = watchValueRef.current || {};
126
+
127
+ _wRef2[w] = _value2;
128
+ watchValueRef.current = _wRef2;
129
+ b = p === null || p === void 0 ? void 0 : (_p$payload4 = p.payload) === null || _p$payload4 === void 0 ? void 0 : _p$payload4.val[w];
130
+ }
131
+ }
132
+
133
+ setWatchValue(_objectSpread({}, watchValueRef.current));
134
+
135
+ if (b) {
136
+ setTimeout(function () {
137
+ formContext.form.setFieldsValue(_defineProperty({}, id, undefined));
138
+ }, 100);
139
+ }
92
140
  }
93
141
  }
94
142
  }, [formContext.stream$, extraInfo]);
@@ -105,11 +153,13 @@ function Index(props) {
105
153
  _url = page ? http.url.replace('{page}', page) : _url;
106
154
 
107
155
  if (watchValueRef.current) {
108
- _url = _url.replace('{watch}', watchValueRef.current);
156
+ if (typeof watchValueRef.current === 'string') {
157
+ _url = _url.replace('{watch}', watchValueRef.current);
158
+ }
109
159
  }
110
160
 
111
161
  _context.next = 6;
112
- return server.GetEnumDataByUrl(_url);
162
+ return server.GetEnumDataByUrl(_url, http.method, (http === null || http === void 0 ? void 0 : http.body) && JSON.parse(http === null || http === void 0 ? void 0 : http.body) ? _objectSpread(_objectSpread({}, JSON.parse(http === null || http === void 0 ? void 0 : http.body)), watchValueRef.current || {}) : watchValueRef.current);
113
163
 
114
164
  case 6:
115
165
  res = _context.sent;
@@ -1,6 +1,6 @@
1
1
  import { FormInstance } from 'antd';
2
2
  interface ITableArrayProps {
3
- name: string;
3
+ name: string | string[];
4
4
  form: FormInstance;
5
5
  refId: string;
6
6
  initEnumValue: any[];