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
@@ -2,12 +2,12 @@ import "antd/es/form/style";
2
2
  import _Form from "antd/es/form";
3
3
  import "antd/es/tag/style";
4
4
  import _Tag from "antd/es/tag";
5
- import _regeneratorRuntime from "@babel/runtime/regenerator";
6
5
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
7
6
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
7
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
9
8
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
10
9
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
10
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
  import React, { useRef } from 'react';
12
12
  import { MetadataService } from '../../../../framework/metadata/MetadataService';
13
13
  import { JsonMetadataProvider } from '../../../../framework/metadata';
@@ -17,47 +17,39 @@ import { MetadataFormContext } from '../../interface';
17
17
  import { assignReplace, getLabelByProps } from '../../utils';
18
18
  import { deepClone, getConstantValue } from '../../../../utils';
19
19
  import { STREAM_EVENT_TYPE } from '../../constants';
20
-
21
20
  var TableArray = function TableArray(props) {
22
21
  var initValue = props.initValue,
23
- readonly = props.readonly,
24
- extraInfo = props.extraInfo,
25
- rowNumber = props.rowNumber,
26
- initEnumValue = props.initEnumValue,
27
- addButtonHidden = props.addButtonHidden,
28
- name = props.name,
29
- form = props.form,
30
- refId = props.refId;
22
+ readonly = props.readonly,
23
+ extraInfo = props.extraInfo,
24
+ rowNumber = props.rowNumber,
25
+ initEnumValue = props.initEnumValue,
26
+ addButtonHidden = props.addButtonHidden,
27
+ name = props.name,
28
+ form = props.form,
29
+ refId = props.refId;
31
30
  var formContext = React.useContext(MetadataFormContext) || {};
32
-
33
31
  var _React$useState = React.useState([]),
34
- _React$useState2 = _slicedToArray(_React$useState, 2),
35
- schema = _React$useState2[0],
36
- setSchema = _React$useState2[1];
37
-
32
+ _React$useState2 = _slicedToArray(_React$useState, 2),
33
+ schema = _React$useState2[0],
34
+ setSchema = _React$useState2[1];
38
35
  var _React$useState3 = React.useState({}),
39
- _React$useState4 = _slicedToArray(_React$useState3, 2),
40
- defaultValue = _React$useState4[0],
41
- setDefaultValue = _React$useState4[1];
42
-
36
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
37
+ defaultValue = _React$useState4[0],
38
+ setDefaultValue = _React$useState4[1];
43
39
  var _React$useState5 = React.useState({}),
44
- _React$useState6 = _slicedToArray(_React$useState5, 2),
45
- refFields = _React$useState6[0],
46
- setRefFields = _React$useState6[1];
47
-
40
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
41
+ refFields = _React$useState6[0],
42
+ setRefFields = _React$useState6[1];
48
43
  var refFieldsRef = React.useRef(refFields);
49
44
  var firstLoadRef = useRef(true);
50
-
51
45
  var _React$useState7 = React.useState(),
52
- _React$useState8 = _slicedToArray(_React$useState7, 2),
53
- tblStream = _React$useState8[0],
54
- setTblStream = _React$useState8[1];
55
-
46
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
47
+ tblStream = _React$useState8[0],
48
+ setTblStream = _React$useState8[1];
56
49
  var _React$useState9 = React.useState([]),
57
- _React$useState10 = _slicedToArray(_React$useState9, 2),
58
- list = _React$useState10[0],
59
- setList = _React$useState10[1];
60
-
50
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
51
+ list = _React$useState10[0],
52
+ setList = _React$useState10[1];
61
53
  var listRef = React.useRef([]);
62
54
  var enumOptionsRef = React.useRef({});
63
55
  useObservable(function (p) {
@@ -67,13 +59,10 @@ var TableArray = function TableArray(props) {
67
59
  listRef.current = p.payload[name];
68
60
  } else if (p.payload[name[0]]) {
69
61
  var evalString = 'p.payload';
70
-
71
62
  for (var i = 0; i < name.length; i++) {
72
63
  evalString = "".concat(evalString, "[name[").concat(i, "]]");
73
64
  }
74
-
75
65
  var _list = eval(evalString) || [];
76
-
77
66
  setList(_toConsumableArray(_list));
78
67
  listRef.current = _list;
79
68
  }
@@ -83,11 +72,9 @@ var TableArray = function TableArray(props) {
83
72
  if ((p === null || p === void 0 ? void 0 : p.type) === 'onValuesChange') {
84
73
  if (typeof name === 'string') {
85
74
  var _p$payload;
86
-
87
75
  var val = _defineProperty({}, "".concat(name), _objectSpread({
88
76
  rowIdx: p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : _p$payload.rowIdx
89
77
  }, p.payload.values));
90
-
91
78
  var allVals = form.getFieldsValue();
92
79
  allVals[name] = listRef.current;
93
80
  formContext.stream$.next({
@@ -99,11 +86,8 @@ var TableArray = function TableArray(props) {
99
86
  });
100
87
  } else {
101
88
  var _p$payload2;
102
-
103
89
  var _val2 = {};
104
-
105
90
  var _allVals = form.getFieldsValue();
106
-
107
91
  assignReplace(name, _objectSpread({
108
92
  rowIdx: p === null || p === void 0 ? void 0 : (_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.rowIdx
109
93
  }, p.payload.values), _val2);
@@ -121,57 +105,45 @@ var TableArray = function TableArray(props) {
121
105
  var getSchemaByRefId = React.useCallback( /*#__PURE__*/function () {
122
106
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(server, __TYPE__) {
123
107
  var _schema, res, provider, FormCls, formCls, _fields;
124
-
125
108
  return _regeneratorRuntime.wrap(function _callee$(_context) {
126
- while (1) {
127
- switch (_context.prev = _context.next) {
128
- case 0:
129
- _schema = []; // 如果有内部类,优先在内部类里面找
130
-
131
- if (__TYPE__.length > 0) {
132
- _schema = __TYPE__.filter(function (it) {
133
- return it.id === refId;
134
- });
135
- } // 内部类找不到 从接口里面拿
136
-
137
-
138
- if (!(_schema.length === 0)) {
139
- _context.next = 7;
140
- break;
141
- }
142
-
143
- _context.next = 5;
144
- return server.GetMetadataDetailById(refId);
145
-
146
- case 5:
147
- res = _context.sent;
148
-
149
- if (res === null || res === void 0 ? void 0 : res.schema) {
150
- _schema = JSON.parse(res === null || res === void 0 ? void 0 : res.schema);
151
- }
152
-
153
- case 7:
154
- provider = new JsonMetadataProvider();
155
-
156
- if (_schema.length > 0) {
157
- provider.add_types(_schema);
158
- FormCls = provider.get_type(_schema[0].id);
159
- formCls = new FormCls();
160
- _fields = formCls.__type__.__fields__;
161
- refFieldsRef.current = _fields;
162
- setRefFields(_objectSpread({}, _fields));
163
- setSchema(_toConsumableArray(_schema));
164
- setDefaultValue(_objectSpread({}, JSON.parse(JSON.stringify(formCls))));
165
- }
166
-
167
- case 9:
168
- case "end":
169
- return _context.stop();
170
- }
109
+ while (1) switch (_context.prev = _context.next) {
110
+ case 0:
111
+ _schema = []; // 如果有内部类,优先在内部类里面找
112
+ if (__TYPE__.length > 0) {
113
+ _schema = __TYPE__.filter(function (it) {
114
+ return it.id === refId;
115
+ });
116
+ }
117
+ // 内部类找不到 从接口里面拿
118
+ if (!(_schema.length === 0)) {
119
+ _context.next = 7;
120
+ break;
121
+ }
122
+ _context.next = 5;
123
+ return server.GetMetadataDetailById(refId);
124
+ case 5:
125
+ res = _context.sent;
126
+ if (res === null || res === void 0 ? void 0 : res.schema) {
127
+ _schema = JSON.parse(res === null || res === void 0 ? void 0 : res.schema);
128
+ }
129
+ case 7:
130
+ provider = new JsonMetadataProvider();
131
+ if (_schema.length > 0) {
132
+ provider.add_types(_schema);
133
+ FormCls = provider.get_type(_schema[0].id);
134
+ formCls = new FormCls();
135
+ _fields = formCls.__type__.__fields__;
136
+ refFieldsRef.current = _fields;
137
+ setRefFields(_objectSpread({}, _fields));
138
+ setSchema(_toConsumableArray(_schema));
139
+ setDefaultValue(_objectSpread({}, JSON.parse(JSON.stringify(formCls))));
140
+ }
141
+ case 9:
142
+ case "end":
143
+ return _context.stop();
171
144
  }
172
145
  }, _callee);
173
146
  }));
174
-
175
147
  return function (_x, _x2) {
176
148
  return _ref.apply(this, arguments);
177
149
  };
@@ -184,7 +156,6 @@ var TableArray = function TableArray(props) {
184
156
  server = null;
185
157
  };
186
158
  }
187
-
188
159
  return function () {};
189
160
  }, [refId]);
190
161
  React.useEffect(function () {
@@ -201,121 +172,93 @@ var TableArray = function TableArray(props) {
201
172
  listRef.current = initValue[name];
202
173
  } else if (initValue[name[0]]) {
203
174
  var evalString = 'initValue';
204
-
205
175
  for (var i = 0; i < name.length; i++) {
206
176
  evalString = "".concat(evalString, "[name[").concat(i, "]]");
207
177
  }
208
-
209
178
  var _list = eval(evalString);
210
-
211
179
  setList(_toConsumableArray(_list));
212
180
  listRef.current = _list;
213
181
  }
214
-
215
182
  firstLoadRef.current = false;
216
183
  }
217
184
  }, [initValue, form]);
218
185
  var getEnumDataByUrl = React.useCallback( /*#__PURE__*/function () {
219
186
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(http) {
220
187
  var server, _url, res, _res;
221
-
222
188
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
223
- while (1) {
224
- switch (_context2.prev = _context2.next) {
225
- case 0:
226
- server = new MetadataService();
227
- _url = http.url;
228
- _context2.next = 4;
229
- 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));
230
-
231
- case 4:
232
- res = _context2.sent;
233
- _res = (res === null || res === void 0 ? void 0 : res.total) ? res === null || res === void 0 ? void 0 : res.list : res;
234
-
235
- if (!(_res && _res.length > 0)) {
236
- _context2.next = 10;
237
- break;
238
- }
239
-
240
- return _context2.abrupt("return", _res.map(function (it) {
241
- return {
242
- value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
243
- label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
244
- disabled: false
245
- };
246
- }));
247
-
248
- case 10:
249
- console.warn("".concat(_url, " is not return success result"));
250
- return _context2.abrupt("return", []);
251
-
252
- case 12:
253
- case "end":
254
- return _context2.stop();
255
- }
189
+ while (1) switch (_context2.prev = _context2.next) {
190
+ case 0:
191
+ server = new MetadataService();
192
+ _url = http.url;
193
+ _context2.next = 4;
194
+ 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));
195
+ case 4:
196
+ res = _context2.sent;
197
+ _res = (res === null || res === void 0 ? void 0 : res.total) ? res === null || res === void 0 ? void 0 : res.list : res;
198
+ if (!(_res && _res.length > 0)) {
199
+ _context2.next = 10;
200
+ break;
201
+ }
202
+ return _context2.abrupt("return", _res.map(function (it) {
203
+ return {
204
+ value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
205
+ label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
206
+ disabled: false
207
+ };
208
+ }));
209
+ case 10:
210
+ console.warn("".concat(_url, " is not return success result"));
211
+ return _context2.abrupt("return", []);
212
+ case 12:
213
+ case "end":
214
+ return _context2.stop();
256
215
  }
257
216
  }, _callee2);
258
217
  }));
259
-
260
218
  return function (_x3) {
261
219
  return _ref2.apply(this, arguments);
262
220
  };
263
221
  }(), []);
264
222
  var processEnumData = React.useCallback(function (data, _extraInfo) {
265
223
  var _extraInfo$enum, _extraInfo$enum3, _extraInfo$enum3$http;
266
-
267
224
  var _options = [];
268
-
269
- var _enum = deepClone(data.enum || []); // 扩展规则的value
270
-
271
-
225
+ var _enum = deepClone(data.enum || []);
226
+ // 扩展规则的value
272
227
  if (_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$enum = _extraInfo.enum) === null || _extraInfo$enum === void 0 ? void 0 : _extraInfo$enum.value) {
273
228
  var _extraInfo$enum2;
274
-
275
229
  _enum = deepClone(_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$enum2 = _extraInfo.enum) === null || _extraInfo$enum2 === void 0 ? void 0 : _extraInfo$enum2.value);
276
- } // 从接口拿数据
277
-
278
-
230
+ }
231
+ // 从接口拿数据
279
232
  if (_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$enum3 = _extraInfo.enum) === null || _extraInfo$enum3 === void 0 ? void 0 : (_extraInfo$enum3$http = _extraInfo$enum3.http) === null || _extraInfo$enum3$http === void 0 ? void 0 : _extraInfo$enum3$http.url) {
280
233
  var _extraInfo$enum4;
281
-
282
234
  return getEnumDataByUrl(deepClone(_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$enum4 = _extraInfo.enum) === null || _extraInfo$enum4 === void 0 ? void 0 : _extraInfo$enum4.http));
283
- } // 目前是更具那么的id判断的,暂未考虑重名问题
284
-
285
-
235
+ }
236
+ // 目前是更具那么的id判断的,暂未考虑重名问题
286
237
  if (initEnumValue && initEnumValue[data.id]) {
287
238
  _enum = deepClone(initEnumValue[data.id]);
288
239
  }
289
-
290
240
  _enum.forEach(function (it) {
291
241
  var obj = {
292
242
  label: it.value,
293
243
  value: (it === null || it === void 0 ? void 0 : it.key) || (it === null || it === void 0 ? void 0 : it.value)
294
244
  };
295
-
296
245
  _options.push(obj);
297
246
  });
298
-
299
247
  enumOptionsRef.current[data.id] = _options;
300
248
  return _options;
301
249
  }, []);
302
250
  var processColumnType = React.useCallback(function (data, _extraInfo) {
303
251
  var _extraInfo$text, _extraInfo$text2;
304
-
305
252
  if ((data === null || data === void 0 ? void 0 : data.type) === 'text' && (_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$text = _extraInfo.text) === null || _extraInfo$text === void 0 ? void 0 : _extraInfo$text.type) && (_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$text2 = _extraInfo.text) === null || _extraInfo$text2 === void 0 ? void 0 : _extraInfo$text2.type) !== 'textarea') {
306
253
  var _extraInfo$text3;
307
-
308
254
  return (_extraInfo$text3 = _extraInfo.text) === null || _extraInfo$text3 === void 0 ? void 0 : _extraInfo$text3.type;
309
255
  }
310
-
311
256
  return data.type;
312
257
  }, []);
313
258
  var processSchemaToColumns = React.useCallback(function (_properties) {
314
259
  var _columns = [];
315
-
316
- var _loop = function _loop(i) {
260
+ var _loop = function _loop() {
317
261
  var _extraInfo$common, _extraInfo$enum5;
318
-
319
262
  var it = _properties[i];
320
263
  var extraInfo = refFieldsRef.current.get(it.id);
321
264
  var obj = {
@@ -336,33 +279,25 @@ var TableArray = function TableArray(props) {
336
279
  }, getConstantValue(enumOptionsRef.current[it.id], v, 'value', 'label'));
337
280
  });
338
281
  }
339
-
340
282
  return getConstantValue(enumOptionsRef.current[it.id], val, 'value', 'label');
341
283
  }
342
-
343
284
  return val;
344
285
  }
345
286
  };
346
-
347
287
  _columns.push(obj);
348
288
  };
349
-
350
289
  for (var i = 0; i < _properties.length; i++) {
351
- _loop(i);
290
+ _loop();
352
291
  }
353
-
354
292
  return _columns;
355
293
  }, []);
356
294
  var columns = React.useMemo(function () {
357
295
  var _columns = [];
358
-
359
296
  if (schema.length > 0) {
360
297
  _columns = processSchemaToColumns(schema[0].properties);
361
298
  }
362
-
363
299
  return _columns;
364
300
  }, [schema, processSchemaToColumns]);
365
-
366
301
  var onTableChange = function onTableChange(values) {
367
302
  if (typeof name === 'string') {
368
303
  var allVals = form.getFieldsValue();
@@ -378,9 +313,7 @@ var TableArray = function TableArray(props) {
378
313
  } else {
379
314
  var val = {};
380
315
  assignReplace(name, _toConsumableArray(values), val);
381
-
382
316
  var _allVals2 = form.getFieldsValue();
383
-
384
317
  assignReplace(name, _toConsumableArray(values), _allVals2);
385
318
  formContext.stream$.next({
386
319
  type: STREAM_EVENT_TYPE.ON_VALUES_CHANGE,
@@ -391,17 +324,14 @@ var TableArray = function TableArray(props) {
391
324
  });
392
325
  form.setFieldsValue(_objectSpread({}, val));
393
326
  }
394
-
395
327
  listRef.current = values;
396
328
  };
397
-
398
329
  var onButtonCellClick = function onButtonCellClick(record) {
399
330
  formContext.stream$.next({
400
331
  type: 'onButtonCellClick',
401
332
  payload: record
402
333
  });
403
334
  };
404
-
405
335
  var getCellHeight = React.useCallback(function (_readonly) {
406
336
  return _readonly ? 30 : 33;
407
337
  }, []);
@@ -440,5 +370,4 @@ var TableArray = function TableArray(props) {
440
370
  }
441
371
  })));
442
372
  };
443
-
444
373
  export default TableArray;
@@ -2,6 +2,11 @@ import "antd/es/col/style";
2
2
  import _Col from "antd/es/col";
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
+ /*
6
+ * @Author: wangxian
7
+ * @Date: 2021-09-18 14:15:04
8
+ * @LastEditTime: 2023-04-18 10:15:35
9
+ */
5
10
  import React from 'react';
6
11
  import { deepClone } from '../../../utils';
7
12
  import { useWatchDepend } from '../hooks';
@@ -10,43 +15,34 @@ import './index.less';
10
15
  export function withAddOnAfter(WrappedComponent) {
11
16
  return function (props) {
12
17
  var _fields$, _fields$$value, _fields$$value$common, _fields$4, _fields$4$value, _fields$4$value$commo, _fields$4$value$commo2, _fields$5, _fields$5$value, _fields$5$value$commo;
13
-
14
18
  var type = props.type,
15
- refId = props.refId,
16
- isShowTypeInfo = props.isShowTypeInfo,
17
- fields = props.fields,
18
- colSpan = props.colSpan,
19
- field = props.field,
20
- id = props.id,
21
- _props$name = props.name,
22
- name = _props$name === void 0 ? [] : _props$name,
23
- isObj = props.isObj;
19
+ refId = props.refId,
20
+ isShowTypeInfo = props.isShowTypeInfo,
21
+ fields = props.fields,
22
+ colSpan = props.colSpan,
23
+ field = props.field,
24
+ id = props.id,
25
+ _props$name = props.name,
26
+ name = _props$name === void 0 ? [] : _props$name,
27
+ isObj = props.isObj;
24
28
  var formContext = React.useContext(MetadataFormContext) || {};
25
29
  var depend = useWatchDepend(fields && ((_fields$ = fields[0]) === null || _fields$ === void 0 ? void 0 : (_fields$$value = _fields$.value) === null || _fields$$value === void 0 ? void 0 : (_fields$$value$common = _fields$$value.common) === null || _fields$$value$common === void 0 ? void 0 : _fields$$value$common.depend), formContext === null || formContext === void 0 ? void 0 : formContext.stream$, name);
26
-
27
30
  var _React$useState = React.useState(),
28
- _React$useState2 = _slicedToArray(_React$useState, 2),
29
- help = _React$useState2[0],
30
- setHelp = _React$useState2[1];
31
-
31
+ _React$useState2 = _slicedToArray(_React$useState, 2),
32
+ help = _React$useState2[0],
33
+ setHelp = _React$useState2[1];
32
34
  var _React$useState3 = React.useState(),
33
- _React$useState4 = _slicedToArray(_React$useState3, 2),
34
- cellColSpan = _React$useState4[0],
35
- setCellColSpan = _React$useState4[1];
36
-
35
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
36
+ cellColSpan = _React$useState4[0],
37
+ setCellColSpan = _React$useState4[1];
37
38
  var labelSpan = React.useMemo(function () {
38
39
  var _fields$0$value, _fields$0$value$commo;
39
-
40
40
  var _labelSpan = formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan;
41
-
42
41
  var _colSpan = fields && ((_fields$0$value = fields[0].value) === null || _fields$0$value === void 0 ? void 0 : (_fields$0$value$commo = _fields$0$value.common) === null || _fields$0$value$commo === void 0 ? void 0 : _fields$0$value$commo.colSpan);
43
-
44
42
  var _formLabelSpan = formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan;
45
-
46
43
  if (_colSpan && _formLabelSpan) {
47
44
  _labelSpan = _formLabelSpan / _colSpan;
48
45
  }
49
-
50
46
  return _labelSpan;
51
47
  }, [fields, formContext === null || formContext === void 0 ? void 0 : formContext.colSpan, formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan]);
52
48
  React.useEffect(function () {
@@ -54,52 +50,39 @@ export function withAddOnAfter(WrappedComponent) {
54
50
  var arr = refId.split(':');
55
51
  setHelp(arr[arr.length - 1]);
56
52
  }
57
-
58
53
  return function () {};
59
54
  }, [refId]);
60
55
  React.useEffect(function () {
61
56
  var _fields$2, _fields$2$value, _fields$2$value$commo, _fields$3, _fields$3$value;
62
-
63
57
  var _colSpan = colSpan;
64
58
  var compColSpan = fields && (((_fields$2 = fields[0]) === null || _fields$2 === void 0 ? void 0 : (_fields$2$value = _fields$2.value) === null || _fields$2$value === void 0 ? void 0 : (_fields$2$value$commo = _fields$2$value.common) === null || _fields$2$value$commo === void 0 ? void 0 : _fields$2$value$commo.colSpan) || ((_fields$3 = fields[0]) === null || _fields$3 === void 0 ? void 0 : (_fields$3$value = _fields$3.value) === null || _fields$3$value === void 0 ? void 0 : _fields$3$value.colSpan));
65
-
66
59
  if (compColSpan) {
67
60
  _colSpan = compColSpan * colSpan <= 24 ? compColSpan * colSpan : 24;
68
61
  }
69
-
70
62
  setCellColSpan(_colSpan);
71
63
  }, [fields, colSpan]);
72
-
73
64
  var _name = React.useMemo(function () {
74
65
  if (id && name.length > 0 && !field) {
75
66
  var res = deepClone(name);
76
67
  res.push(id);
77
68
  return res;
78
69
  }
79
-
80
70
  if (id && name.length > 0 && field) {
81
71
  var _res = deepClone(name);
82
-
83
72
  _res.push(id);
84
-
85
73
  if (type !== 'ref') {
86
74
  _res.shift();
87
75
  }
88
-
89
76
  return _res;
90
77
  }
91
-
92
78
  return [id];
93
79
  }, [id, name]);
94
-
95
80
  if (depend === null || depend === void 0 ? void 0 : depend.hidden) {
96
81
  return /*#__PURE__*/React.createElement(React.Fragment, null);
97
82
  }
98
-
99
83
  if (fields && ((_fields$4 = fields[0]) === null || _fields$4 === void 0 ? void 0 : (_fields$4$value = _fields$4.value) === null || _fields$4$value === void 0 ? void 0 : (_fields$4$value$commo = _fields$4$value.common) === null || _fields$4$value$commo === void 0 ? void 0 : (_fields$4$value$commo2 = _fields$4$value$commo.depend) === null || _fields$4$value$commo2 === void 0 ? void 0 : _fields$4$value$commo2.show) && !(depend === null || depend === void 0 ? void 0 : depend.show)) {
100
84
  return /*#__PURE__*/React.createElement(React.Fragment, null);
101
85
  }
102
-
103
86
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
104
87
  key: id,
105
88
  span: cellColSpan
@@ -1,41 +1,41 @@
1
- .with-add-on-after {
2
- --card-bg: #ffffff;
3
- position: relative;
4
- width: 100%;
5
-
6
- .ant-form-item-label {
7
- padding: 0 !important;
8
- }
9
-
10
- & > .ant-form-item {
11
- padding: 0 0 8px !important;
12
- flex: 1;
13
- }
14
- &-extra {
15
- position: absolute;
16
- right: 20px;
17
- top: 18px;
18
- padding: 0 6px;
19
- background-color: var(--card-bg);
20
- z-index: 1000;
21
- }
22
- &-ref {
23
- position: absolute;
24
- right: 20px;
25
- top: -10px;
26
- padding: 0 6px;
27
- background-color: var(--card-bg);
28
- z-index: 1000;
29
- }
30
- .ant-select-tree-indent {
31
- .ant-select-tree-indent-unit {
32
- width: 10px !important;
33
- }
34
- }
35
-
36
- /* .ant-col-2.7 {
37
- display: block;
38
- flex: 0 0 75%;
39
- max-width: 75%;
40
- } */
41
- }
1
+ .with-add-on-after {
2
+ --card-bg: #ffffff;
3
+ position: relative;
4
+ width: 100%;
5
+
6
+ .ant-form-item-label {
7
+ padding: 0 !important;
8
+ }
9
+
10
+ & > .ant-form-item {
11
+ padding: 0 0 8px !important;
12
+ flex: 1;
13
+ }
14
+ &-extra {
15
+ position: absolute;
16
+ right: 20px;
17
+ top: 18px;
18
+ padding: 0 6px;
19
+ background-color: var(--card-bg);
20
+ z-index: 1000;
21
+ }
22
+ &-ref {
23
+ position: absolute;
24
+ right: 20px;
25
+ top: -10px;
26
+ padding: 0 6px;
27
+ background-color: var(--card-bg);
28
+ z-index: 1000;
29
+ }
30
+ .ant-select-tree-indent {
31
+ .ant-select-tree-indent-unit {
32
+ width: 10px !important;
33
+ }
34
+ }
35
+
36
+ /* .ant-col-2.7 {
37
+ display: block;
38
+ flex: 0 0 75%;
39
+ max-width: 75%;
40
+ } */
41
+ }