ronds-metadata 1.2.38 → 1.2.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. package/es/api/index.js +83 -131
  2. package/es/comps/DynamicPorts/comps/ContextMenu.js +3 -11
  3. package/es/comps/DynamicPorts/comps/DragNode.js +2 -7
  4. package/es/comps/DynamicPorts/comps/GraphHandler/index.js +4 -5
  5. package/es/comps/DynamicPorts/comps/NodeElement.js +1 -4
  6. package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +3 -6
  7. package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +3 -7
  8. package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +18 -21
  9. package/es/comps/DynamicPorts/comps/shape/edge.js +5 -18
  10. package/es/comps/DynamicPorts/comps/shape/node.js +4 -17
  11. package/es/comps/DynamicPorts/constant/index.js +2 -5
  12. package/es/comps/DynamicPorts/graph.d.ts +2 -2
  13. package/es/comps/DynamicPorts/graph.js +228 -312
  14. package/es/comps/DynamicPorts/index.js +39 -58
  15. package/es/comps/DynamicPorts/utils.js +21 -25
  16. package/es/comps/Editable/DataCell/ButtonCell.js +4 -10
  17. package/es/comps/Editable/DataCell/ColorPicker.js +2 -7
  18. package/es/comps/Editable/DataCell/Input.js +5 -14
  19. package/es/comps/Editable/DataCell/Number.js +3 -10
  20. package/es/comps/Editable/DataCell/Select.js +7 -14
  21. package/es/comps/Editable/DataCell/Switch.js +2 -7
  22. package/es/comps/Editable/comps/EditableAction.js +8 -12
  23. package/es/comps/Editable/comps/EditableCell.js +16 -26
  24. package/es/comps/Editable/comps/EditableHeardCell.js +21 -34
  25. package/es/comps/Editable/comps/EditableRow.js +49 -59
  26. package/es/comps/Editable/comps/Texty.js +36 -72
  27. package/es/comps/Editable/index.js +67 -112
  28. package/es/comps/Editable/interface.d.ts +1 -1
  29. package/es/comps/Editable/utils.js +0 -1
  30. package/es/comps/FileView/index.js +65 -101
  31. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +8 -13
  32. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +8 -4
  33. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +6 -2
  34. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +8 -4
  35. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +6 -11
  36. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +6 -10
  37. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +6 -2
  38. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +6 -11
  39. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +8 -4
  40. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +8 -13
  41. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +6 -10
  42. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +6 -2
  43. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +6 -11
  44. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +6 -3
  45. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +2 -5
  46. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +86 -109
  47. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +3 -7
  48. package/es/comps/FormGenerator/comps/Canvas/core/index.js +54 -91
  49. package/es/comps/FormGenerator/comps/Canvas/core/index.less +23 -23
  50. package/es/comps/FormGenerator/comps/Canvas/index.js +8 -15
  51. package/es/comps/FormGenerator/comps/Settings/index.js +16 -30
  52. package/es/comps/FormGenerator/comps/Sidebar/Elements.js +23 -22
  53. package/es/comps/FormGenerator/comps/Sidebar/index.js +6 -2
  54. package/es/comps/FormGenerator/index.js +3 -9
  55. package/es/comps/FormGenerator/interface.d.ts +1 -1
  56. package/es/comps/FormGenerator/settings/index.js +12 -11
  57. package/es/comps/FormGenerator/settings/ruleConfig.js +0 -1
  58. package/es/comps/FormGenerator/transformer.js +40 -105
  59. package/es/comps/Icons/index.js +4 -7
  60. package/es/comps/JsonEdit/index.js +25 -50
  61. package/es/comps/JsonView/index.js +7 -21
  62. package/es/comps/JsonView/index.less +41 -41
  63. package/es/comps/MdEdit/index.js +7 -10
  64. package/es/comps/MdEdit/index.less +6 -6
  65. package/es/comps/MdEditPro/index.d.ts +10 -0
  66. package/es/comps/MdEditPro/index.js +22 -0
  67. package/es/comps/MdEditPro/index.less +74 -0
  68. package/es/comps/MdNavbar/index.js +17 -40
  69. package/es/comps/MdNavbar/utils.js +0 -4
  70. package/es/comps/MdView/index.js +7 -11
  71. package/es/comps/MdView/index.less +353 -353
  72. package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +129 -183
  73. package/es/comps/MetadataEdit/components/MetaPropsEdit.js +11 -27
  74. package/es/comps/MetadataEdit/hooks/index.js +3 -11
  75. package/es/comps/MetadataEdit/index.js +25 -58
  76. package/es/comps/MetadataEdit/index.less +10 -10
  77. package/es/comps/MetadataEdit/type.d.ts +20 -20
  78. package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +17 -33
  79. package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +15 -29
  80. package/es/comps/MetadataEditV2/hooks/index.js +5 -12
  81. package/es/comps/MetadataEditV2/index.js +30 -65
  82. package/es/comps/MetadataForm/DataCell/Array.js +12 -23
  83. package/es/comps/MetadataForm/DataCell/Input.js +12 -32
  84. package/es/comps/MetadataForm/DataCell/Number.js +10 -21
  85. package/es/comps/MetadataForm/DataCell/Ref.js +87 -121
  86. package/es/comps/MetadataForm/DataCell/Select.js +127 -222
  87. package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
  88. package/es/comps/MetadataForm/DataCell/layout/TableArray.js +93 -164
  89. package/es/comps/MetadataForm/HOC/index.js +20 -37
  90. package/es/comps/MetadataForm/HOC/index.less +41 -41
  91. package/es/comps/MetadataForm/hooks/index.js +12 -38
  92. package/es/comps/MetadataForm/index.js +37 -72
  93. package/es/comps/MetadataForm/interface.d.ts +3 -3
  94. package/es/comps/MetadataForm/utils.js +0 -14
  95. package/es/comps/Split/index.js +20 -22
  96. package/es/config.js +0 -4
  97. package/es/framework/RxStore/demo/index.js +9 -10
  98. package/es/framework/RxStore/hooks.d.ts +9 -9
  99. package/es/framework/RxStore/hooks.js +10 -35
  100. package/es/framework/RxStore/store.d.ts +4 -4
  101. package/es/framework/RxStore/store.js +0 -10
  102. package/es/framework/fg/index.js +18 -80
  103. package/es/framework/fg/interface.d.ts +2 -2
  104. package/es/framework/fg/utils.js +0 -10
  105. package/es/framework/graph/index.d.ts +2 -2
  106. package/es/framework/graph/index.js +55 -110
  107. package/es/framework/hooks/use-async-memo.js +3 -7
  108. package/es/framework/hooks/use-sync-scroll.js +2 -15
  109. package/es/framework/http/cache.js +25 -32
  110. package/es/framework/http/cancel.js +1 -7
  111. package/es/framework/http/index.js +22 -82
  112. package/es/framework/http/msgpack.js +0 -4
  113. package/es/framework/http/msgpack5/index.js +2 -12
  114. package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +1 -13
  115. package/es/framework/http/msgpack5/lib/decoder.js +10 -68
  116. package/es/framework/http/msgpack5/lib/encoder.js +8 -36
  117. package/es/framework/http/msgpack5/lib/helpers.js +3 -2
  118. package/es/framework/http/msgpack5/lib/streams.js +0 -18
  119. package/es/framework/libs/jquery.min.js +1009 -1696
  120. package/es/framework/locale/dil8/di18n.js +4 -15
  121. package/es/framework/locale/dil8/translate.js +0 -14
  122. package/es/framework/locale/dil8/util.js +0 -3
  123. package/es/framework/locale/index.js +2 -3
  124. package/es/framework/metadata/MetadataService.js +39 -78
  125. package/es/framework/metadata/index.js +4 -70
  126. package/es/framework/metadata/types.d.ts +98 -98
  127. package/es/framework/rxjs-hooks/useMemoSubject.js +0 -2
  128. package/es/framework/rxjs-hooks/useObservable.js +2 -4
  129. package/es/framework/rxjs-hooks/useObservableState.js +8 -14
  130. package/es/index.d.ts +1 -0
  131. package/es/index.js +2 -1
  132. package/es/theme.less +79 -79
  133. package/es/utils.js +58 -97
  134. package/package.json +104 -102
@@ -9,235 +9,188 @@ import _Select from "antd/es/select";
9
9
  import _extends from "@babel/runtime/helpers/esm/extends";
10
10
  import "antd/es/input/style";
11
11
  import _Input from "antd/es/input";
12
- import _regeneratorRuntime from "@babel/runtime/regenerator";
13
12
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
14
13
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
15
14
  import "antd/es/form/style";
16
15
  import _Form from "antd/es/form";
17
16
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
17
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
18
18
  import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
19
19
  import React from 'react';
20
20
  import { RULE_TYPES_OPTIONS } from '../constant';
21
21
  import { useMetaType } from '../hooks';
22
22
  import MetadataForm from '../../MetadataForm';
23
23
  import { MetadataService } from '../../../framework/metadata/MetadataService';
24
-
25
24
  var MetaFieldsEdit = function MetaFieldsEdit(props) {
26
25
  var type = props.type,
27
- defaultValues = props.defaultValues,
28
- onChange = props.onChange;
29
-
26
+ defaultValues = props.defaultValues,
27
+ onChange = props.onChange;
30
28
  var _Form$useForm = _Form.useForm(),
31
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
32
- form = _Form$useForm2[0];
33
-
29
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
30
+ form = _Form$useForm2[0];
34
31
  var _React$useState = React.useState({}),
35
- _React$useState2 = _slicedToArray(_React$useState, 2),
36
- ruleTypes = _React$useState2[0],
37
- setRuleTypes = _React$useState2[1];
38
-
32
+ _React$useState2 = _slicedToArray(_React$useState, 2),
33
+ ruleTypes = _React$useState2[0],
34
+ setRuleTypes = _React$useState2[1];
39
35
  var _React$useState3 = React.useState({}),
40
- _React$useState4 = _slicedToArray(_React$useState3, 2),
41
- refIds = _React$useState4[0],
42
- setRefIds = _React$useState4[1];
43
-
36
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
37
+ refIds = _React$useState4[0],
38
+ setRefIds = _React$useState4[1];
44
39
  var _React$useState5 = React.useState({}),
45
- _React$useState6 = _slicedToArray(_React$useState5, 2),
46
- refSchema = _React$useState6[0],
47
- setRefSchema = _React$useState6[1];
48
-
40
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
41
+ refSchema = _React$useState6[0],
42
+ setRefSchema = _React$useState6[1];
49
43
  var _React$useState7 = React.useState({}),
50
- _React$useState8 = _slicedToArray(_React$useState7, 2),
51
- refValues = _React$useState8[0],
52
- setRefValues = _React$useState8[1];
53
-
44
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
45
+ refValues = _React$useState8[0],
46
+ setRefValues = _React$useState8[1];
54
47
  var metaType = useMetaType('扩展规则');
55
-
56
48
  var processSpecialRuleData = /*#__PURE__*/function () {
57
49
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_refId, idx) {
58
50
  var server, res, _schema, _properties, _refSchema;
59
-
60
51
  return _regeneratorRuntime.wrap(function _callee$(_context) {
61
- while (1) {
62
- switch (_context.prev = _context.next) {
63
- case 0:
64
- server = new MetadataService();
65
- _context.next = 3;
66
- return server.GetMetadataDetailById(_refId);
67
-
68
- case 3:
69
- res = _context.sent;
70
- _schema = JSON.parse(res.schema);
71
- _properties = _schema[0].properties;
72
-
73
- if (_refId === 'com.ronds.schema.default.Rule.Form') {
74
- _properties = _properties.filter(function (it) {
75
- return it.id === 'common' || it.id === 'common-en-US' || it.id === type;
76
- });
77
- }
78
-
79
- _schema[0].properties = _properties;
80
- _refSchema = refSchema;
81
- _refSchema[idx] = _schema;
82
- setRefSchema(_objectSpread({}, _refSchema));
83
-
84
- case 11:
85
- case "end":
86
- return _context.stop();
87
- }
52
+ while (1) switch (_context.prev = _context.next) {
53
+ case 0:
54
+ server = new MetadataService();
55
+ _context.next = 3;
56
+ return server.GetMetadataDetailById(_refId);
57
+ case 3:
58
+ res = _context.sent;
59
+ _schema = JSON.parse(res.schema);
60
+ _properties = _schema[0].properties;
61
+ if (_refId === 'com.ronds.schema.default.Rule.Form') {
62
+ _properties = _properties.filter(function (it) {
63
+ return it.id === 'common' || it.id === 'common-en-US' || it.id === type;
64
+ });
65
+ }
66
+ _schema[0].properties = _properties;
67
+ _refSchema = refSchema;
68
+ _refSchema[idx] = _schema;
69
+ setRefSchema(_objectSpread({}, _refSchema));
70
+ case 11:
71
+ case "end":
72
+ return _context.stop();
88
73
  }
89
74
  }, _callee);
90
75
  }));
91
-
92
76
  return function processSpecialRuleData(_x, _x2) {
93
77
  return _ref.apply(this, arguments);
94
78
  };
95
79
  }();
96
-
97
80
  var onRefSelectChange = React.useCallback( /*#__PURE__*/function () {
98
81
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(value, index) {
99
82
  var _refIds, _refSchema, newData;
100
-
101
83
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
102
- while (1) {
103
- switch (_context2.prev = _context2.next) {
104
- case 0:
105
- _refIds = refIds;
106
-
107
- if (!(value && value.indexOf('Rule.Form') > -1)) {
108
- _context2.next = 6;
109
- break;
110
- }
111
-
112
- _context2.next = 4;
113
- return processSpecialRuleData(value, index);
114
-
115
- case 4:
116
- _context2.next = 9;
84
+ while (1) switch (_context2.prev = _context2.next) {
85
+ case 0:
86
+ _refIds = refIds;
87
+ if (!(value && value.indexOf('Rule.Form') > -1)) {
88
+ _context2.next = 6;
117
89
  break;
118
-
119
- case 6:
120
- _refSchema = refSchema;
121
- _refSchema[index] = undefined;
122
- setRefSchema(_objectSpread({}, _refSchema));
123
-
124
- case 9:
125
- _refIds[index] = value;
126
- setRefIds(_objectSpread({}, _refIds));
127
- newData = form.getFieldValue('fields');
128
- newData[index].id = value;
129
- form.setFieldsValue({
130
- fields: newData
131
- });
132
-
133
- case 14:
134
- case "end":
135
- return _context2.stop();
136
- }
90
+ }
91
+ _context2.next = 4;
92
+ return processSpecialRuleData(value, index);
93
+ case 4:
94
+ _context2.next = 9;
95
+ break;
96
+ case 6:
97
+ _refSchema = refSchema;
98
+ _refSchema[index] = undefined;
99
+ setRefSchema(_objectSpread({}, _refSchema));
100
+ case 9:
101
+ _refIds[index] = value;
102
+ setRefIds(_objectSpread({}, _refIds));
103
+ newData = form.getFieldValue('fields');
104
+ newData[index].id = value;
105
+ form.setFieldsValue({
106
+ fields: newData
107
+ });
108
+ case 14:
109
+ case "end":
110
+ return _context2.stop();
137
111
  }
138
112
  }, _callee2);
139
113
  }));
140
-
141
114
  return function (_x3, _x4) {
142
115
  return _ref2.apply(this, arguments);
143
116
  };
144
117
  }(), [form]);
145
118
  var processInitRule = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
146
119
  var _defaultValues, _refIds, _ruleTypes;
147
-
148
120
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
149
- while (1) {
150
- switch (_context3.prev = _context3.next) {
151
- case 0:
152
- _defaultValues = [{
153
- id: 'Rule.Form',
154
- refId: 'com.ronds.schema.default.Rule.Form',
155
- type: 'ref',
156
- value: {}
157
- }];
158
- _refIds = refIds;
159
- _ruleTypes = ruleTypes;
160
-
161
- if (!(_defaultValues[0].refId.indexOf('Rule.Form') > -1)) {
162
- _context3.next = 6;
163
- break;
164
- }
165
-
121
+ while (1) switch (_context3.prev = _context3.next) {
122
+ case 0:
123
+ _defaultValues = [{
124
+ id: 'Rule.Form',
125
+ refId: 'com.ronds.schema.default.Rule.Form',
126
+ type: 'ref',
127
+ value: {}
128
+ }];
129
+ _refIds = refIds;
130
+ _ruleTypes = ruleTypes;
131
+ if (!(_defaultValues[0].refId.indexOf('Rule.Form') > -1)) {
166
132
  _context3.next = 6;
167
- return processSpecialRuleData(_defaultValues[0].refId, 0);
168
-
169
- case 6:
170
- _refIds[0] = _defaultValues[0].refId;
171
- setRefIds(_objectSpread({}, _refIds));
172
- _ruleTypes[0] = 'ref';
173
- setRuleTypes(_objectSpread({}, _ruleTypes));
174
- form.setFieldsValue({
175
- fields: _defaultValues
176
- });
177
-
178
- case 11:
179
- case "end":
180
- return _context3.stop();
181
- }
133
+ break;
134
+ }
135
+ _context3.next = 6;
136
+ return processSpecialRuleData(_defaultValues[0].refId, 0);
137
+ case 6:
138
+ _refIds[0] = _defaultValues[0].refId;
139
+ setRefIds(_objectSpread({}, _refIds));
140
+ _ruleTypes[0] = 'ref';
141
+ setRuleTypes(_objectSpread({}, _ruleTypes));
142
+ form.setFieldsValue({
143
+ fields: _defaultValues
144
+ });
145
+ case 11:
146
+ case "end":
147
+ return _context3.stop();
182
148
  }
183
149
  }, _callee3);
184
150
  })), [form]);
185
151
  var processDefaultValues = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
186
152
  var _ruleTypes, _refIds, i;
187
-
188
153
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
189
- while (1) {
190
- switch (_context4.prev = _context4.next) {
191
- case 0:
192
- if (!defaultValues) {
193
- _context4.next = 17;
194
- break;
195
- }
196
-
197
- _ruleTypes = ruleTypes;
198
- _refIds = refIds;
199
- form.setFieldsValue({
200
- fields: defaultValues
201
- });
202
- i = 0;
203
-
204
- case 5:
205
- if (!(i < defaultValues.length)) {
206
- _context4.next = 15;
207
- break;
208
- }
209
-
210
- _ruleTypes[i] = defaultValues[i].type;
211
-
212
- if (!(defaultValues[i].type === 'ref')) {
213
- _context4.next = 12;
214
- break;
215
- }
216
-
217
- if (!(defaultValues[i].refId.indexOf('Rule.Form') > -1)) {
218
- _context4.next = 11;
219
- break;
220
- }
221
-
154
+ while (1) switch (_context4.prev = _context4.next) {
155
+ case 0:
156
+ if (!defaultValues) {
157
+ _context4.next = 17;
158
+ break;
159
+ }
160
+ _ruleTypes = ruleTypes;
161
+ _refIds = refIds;
162
+ form.setFieldsValue({
163
+ fields: defaultValues
164
+ });
165
+ i = 0;
166
+ case 5:
167
+ if (!(i < defaultValues.length)) {
168
+ _context4.next = 15;
169
+ break;
170
+ }
171
+ _ruleTypes[i] = defaultValues[i].type;
172
+ if (!(defaultValues[i].type === 'ref')) {
173
+ _context4.next = 12;
174
+ break;
175
+ }
176
+ if (!(defaultValues[i].refId.indexOf('Rule.Form') > -1)) {
222
177
  _context4.next = 11;
223
- return processSpecialRuleData(defaultValues[i].refId, i);
224
-
225
- case 11:
226
- _refIds[i] = defaultValues[i].refId;
227
-
228
- case 12:
229
- i++;
230
- _context4.next = 5;
231
178
  break;
232
-
233
- case 15:
234
- setRefIds(_objectSpread({}, _refIds));
235
- setRuleTypes(_objectSpread({}, _ruleTypes));
236
-
237
- case 17:
238
- case "end":
239
- return _context4.stop();
240
- }
179
+ }
180
+ _context4.next = 11;
181
+ return processSpecialRuleData(defaultValues[i].refId, i);
182
+ case 11:
183
+ _refIds[i] = defaultValues[i].refId;
184
+ case 12:
185
+ i++;
186
+ _context4.next = 5;
187
+ break;
188
+ case 15:
189
+ setRefIds(_objectSpread({}, _refIds));
190
+ setRuleTypes(_objectSpread({}, _ruleTypes));
191
+ case 17:
192
+ case "end":
193
+ return _context4.stop();
241
194
  }
242
195
  }, _callee4);
243
196
  })), [form]);
@@ -248,25 +201,20 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
248
201
  processInitRule();
249
202
  }
250
203
  }, [defaultValues, processInitRule, processDefaultValues]);
251
-
252
204
  var onFinish = function onFinish(values) {
253
205
  var _fields = values.fields;
254
-
255
206
  for (var i = 0; i < _fields.length; i++) {
256
207
  if (_fields[i].type === 'ref') {
257
208
  _fields[i].value = refValues[i] || _fields[i].value;
258
209
  }
259
210
  }
260
-
261
211
  onChange && onChange(_fields);
262
212
  };
263
-
264
213
  var onRefRulesValuesChange = function onRefRulesValuesChange(values, idx) {
265
214
  var _refValues = refValues;
266
215
  _refValues[idx] = _refValues[idx] ? _objectSpread(_objectSpread({}, _refValues[idx]), values) : _objectSpread({}, values);
267
216
  setRefValues(_objectSpread({}, _refValues));
268
217
  };
269
-
270
218
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form, {
271
219
  className: "metadata-edit",
272
220
  style: {
@@ -283,10 +231,9 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
283
231
  name: "fields"
284
232
  }, function (fields, _ref5) {
285
233
  var add = _ref5.add,
286
- remove = _ref5.remove;
234
+ remove = _ref5.remove;
287
235
  return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, index) {
288
236
  var _defaultValues$index;
289
-
290
237
  return /*#__PURE__*/React.createElement("div", {
291
238
  key: "".concat(field.key)
292
239
  }, /*#__PURE__*/React.createElement("div", {
@@ -415,5 +362,4 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
415
362
  htmlType: "submit"
416
363
  }, "\u786E\u5B9A")))));
417
364
  };
418
-
419
365
  export default MetaFieldsEdit;
@@ -17,29 +17,23 @@ import { MinusCircleOutlined, PlusOutlined, ReloadOutlined } from '@ant-design/i
17
17
  import { ARRAY_TYPES_OPTIONS, BASIC_TYPES_OPTIONS, NUMBER_FORMAT_OPTIONS } from '../constant';
18
18
  import { useMetaType } from '../hooks';
19
19
  import { guid } from '../../../utils';
20
-
21
20
  var MetaPropsEdit = function MetaPropsEdit(props) {
22
21
  var form = props.form,
23
- id = props.id,
24
- metadataTag = props.metadataTag,
25
- name = props.name,
26
- _props$isAddFields = props.isAddFields,
27
- isAddFields = _props$isAddFields === void 0 ? true : _props$isAddFields,
28
- onAddFields = props.onAddFields,
29
- onNewRefClick = props.onNewRefClick;
30
-
22
+ id = props.id,
23
+ metadataTag = props.metadataTag,
24
+ name = props.name,
25
+ _props$isAddFields = props.isAddFields,
26
+ isAddFields = _props$isAddFields === void 0 ? true : _props$isAddFields,
27
+ onAddFields = props.onAddFields,
28
+ onNewRefClick = props.onNewRefClick;
31
29
  var _React$useState = React.useState(true),
32
- _React$useState2 = _slicedToArray(_React$useState, 2),
33
- refresh = _React$useState2[0],
34
- setRefresh = _React$useState2[1];
35
-
30
+ _React$useState2 = _slicedToArray(_React$useState, 2),
31
+ refresh = _React$useState2[0],
32
+ setRefresh = _React$useState2[1];
36
33
  var metaType = useMetaType(metadataTag, refresh);
37
-
38
34
  var onTypeChange = function onTypeChange(idx) {
39
35
  var _properties$idx, _properties$idx2;
40
-
41
36
  var _properties = form.getFieldValue('properties') || [];
42
-
43
37
  var __properties = {
44
38
  id: (_properties$idx = _properties[idx]) === null || _properties$idx === void 0 ? void 0 : _properties$idx.id,
45
39
  type: (_properties$idx2 = _properties[idx]) === null || _properties$idx2 === void 0 ? void 0 : _properties$idx2.type
@@ -49,12 +43,11 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
49
43
  properties: _properties
50
44
  });
51
45
  };
52
-
53
46
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form.List, {
54
47
  name: name
55
48
  }, function (fields, _ref) {
56
49
  var add = _ref.add,
57
- remove = _ref.remove;
50
+ remove = _ref.remove;
58
51
  return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, index) {
59
52
  return /*#__PURE__*/React.createElement("div", {
60
53
  key: guid()
@@ -121,16 +114,12 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
121
114
  noStyle: true,
122
115
  shouldUpdate: function shouldUpdate(prevValues, currentValues) {
123
116
  var _prevValues$name$inde, _currentValues$name$i, _prevValues$name$inde2, _currentValues$name$i2;
124
-
125
117
  return (prevValues === null || prevValues === void 0 ? void 0 : (_prevValues$name$inde = prevValues[name][index]) === null || _prevValues$name$inde === void 0 ? void 0 : _prevValues$name$inde.type) !== (currentValues === null || currentValues === void 0 ? void 0 : (_currentValues$name$i = currentValues[name][index]) === null || _currentValues$name$i === void 0 ? void 0 : _currentValues$name$i.type) || (prevValues === null || prevValues === void 0 ? void 0 : (_prevValues$name$inde2 = prevValues[name][index]) === null || _prevValues$name$inde2 === void 0 ? void 0 : _prevValues$name$inde2.items) !== (currentValues === null || currentValues === void 0 ? void 0 : (_currentValues$name$i2 = currentValues[name][index]) === null || _currentValues$name$i2 === void 0 ? void 0 : _currentValues$name$i2.items);
126
118
  }
127
119
  }, function (_ref2) {
128
120
  var _properties$index, _properties$index2, _properties$index2$it, _properties$index3, _properties$index3$it;
129
-
130
121
  var getFieldValue = _ref2.getFieldValue;
131
-
132
122
  var _properties = getFieldValue(name);
133
-
134
123
  switch ((_properties$index = _properties[index]) === null || _properties$index === void 0 ? void 0 : _properties$index.type) {
135
124
  case 'number':
136
125
  return /*#__PURE__*/React.createElement("div", {
@@ -155,7 +144,6 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
155
144
  return triggerNode.parentNode;
156
145
  }
157
146
  })));
158
-
159
147
  case 'ref':
160
148
  return /*#__PURE__*/React.createElement("div", {
161
149
  style: {
@@ -215,7 +203,6 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
215
203
  },
216
204
  icon: /*#__PURE__*/React.createElement(ReloadOutlined, null)
217
205
  }))));
218
-
219
206
  case 'array':
220
207
  return /*#__PURE__*/React.createElement("div", {
221
208
  style: {
@@ -306,7 +293,6 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
306
293
  return triggerNode.parentNode;
307
294
  }
308
295
  }))));
309
-
310
296
  case 'enum':
311
297
  return /*#__PURE__*/React.createElement("div", {
312
298
  style: {
@@ -342,7 +328,6 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
342
328
  icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
343
329
  }, "\u6DFB\u52A0Enum")));
344
330
  }));
345
-
346
331
  default:
347
332
  return null;
348
333
  }
@@ -364,5 +349,4 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
364
349
  }, "\u6DFB\u52A0\u6269\u5C55\u89C4\u5219")));
365
350
  }));
366
351
  };
367
-
368
352
  export default MetaPropsEdit;
@@ -1,5 +1,4 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
-
3
2
  /*
4
3
  * @Author: wangxian
5
4
  * @Date: 2021-09-18 14:15:04
@@ -9,32 +8,25 @@ import { MetadataService } from './../../../framework/metadata/MetadataService';
9
8
  import React from 'react';
10
9
  export var useMetaType = function useMetaType(tag) {
11
10
  var isFresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12
-
13
11
  var _React$useState = React.useState([]),
14
- _React$useState2 = _slicedToArray(_React$useState, 2),
15
- metaType = _React$useState2[0],
16
- setMetaType = _React$useState2[1];
17
-
12
+ _React$useState2 = _slicedToArray(_React$useState, 2),
13
+ metaType = _React$useState2[0],
14
+ setMetaType = _React$useState2[1];
18
15
  React.useEffect(function () {
19
16
  if (isFresh) {
20
17
  var service = new MetadataService();
21
-
22
18
  var _tag = tag ? [tag] : [];
23
-
24
19
  service.GetMetadataList(_tag).then(function (res) {
25
20
  var _metaType = [];
26
-
27
21
  if (res) {
28
22
  for (var i = 0; i < res.length; i++) {
29
23
  var obj = {
30
24
  label: res[i].name,
31
25
  value: res[i].id
32
26
  };
33
-
34
27
  _metaType.push(obj);
35
28
  }
36
29
  }
37
-
38
30
  setMetaType([].concat(_metaType));
39
31
  });
40
32
  }