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
@@ -11,9 +11,9 @@ import "antd/es/button/style";
11
11
  import _Button from "antd/es/button";
12
12
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
13
13
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
14
- import _regeneratorRuntime from "@babel/runtime/regenerator";
15
14
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
16
15
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
16
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
17
17
  import React from 'react';
18
18
  import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons';
19
19
  import { MetadataService } from '../../../framework/metadata/MetadataService';
@@ -21,88 +21,72 @@ import { MetadataFormContext, MetadataRefContext } from '../interface';
21
21
  import { useGetExtraInfo } from '../hooks';
22
22
  import { renderForm } from '../utils';
23
23
  import { JsonMetadataProvider } from '../../../framework/metadata';
24
-
25
24
  function Index(props) {
26
25
  var _extraInfo$disabled, _extraInfo$disabled2;
27
-
28
26
  var id = props.id,
29
- refId = props.refId,
30
- disabled = props.disabled,
31
- isRefForm = props.isRefForm,
32
- fieldRule = props.fields,
33
- labelSpan = props.labelSpan,
34
- initEnumValue = props.initEnumValue,
35
- field = props.field,
36
- name = props.name;
27
+ refId = props.refId,
28
+ disabled = props.disabled,
29
+ isRefForm = props.isRefForm,
30
+ fieldRule = props.fields,
31
+ labelSpan = props.labelSpan,
32
+ initEnumValue = props.initEnumValue,
33
+ field = props.field,
34
+ name = props.name;
37
35
  var formContext = React.useContext(MetadataFormContext) || {};
38
- var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form, props.type); // 是否折叠
39
-
36
+ var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form, props.type);
37
+ // 是否折叠
40
38
  var _React$useState = React.useState(true),
41
- _React$useState2 = _slicedToArray(_React$useState, 2),
42
- isFold = _React$useState2[0],
43
- setIsFold = _React$useState2[1];
44
-
39
+ _React$useState2 = _slicedToArray(_React$useState, 2),
40
+ isFold = _React$useState2[0],
41
+ setIsFold = _React$useState2[1];
45
42
  var _React$useState3 = React.useState([]),
46
- _React$useState4 = _slicedToArray(_React$useState3, 2),
47
- schema = _React$useState4[0],
48
- setSchema = _React$useState4[1];
49
-
43
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
44
+ schema = _React$useState4[0],
45
+ setSchema = _React$useState4[1];
50
46
  var _React$useState5 = React.useState({}),
51
- _React$useState6 = _slicedToArray(_React$useState5, 2),
52
- refFields = _React$useState6[0],
53
- setRefFields = _React$useState6[1];
54
-
47
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
48
+ refFields = _React$useState6[0],
49
+ setRefFields = _React$useState6[1];
55
50
  var refFieldsRef = React.useRef(refFields);
56
-
57
51
  var _React$useState7 = React.useState([]),
58
- _React$useState8 = _slicedToArray(_React$useState7, 2),
59
- options = _React$useState8[0],
60
- setOptions = _React$useState8[1];
61
-
52
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
53
+ options = _React$useState8[0],
54
+ setOptions = _React$useState8[1];
62
55
  var _React$useState9 = React.useState(''),
63
- _React$useState10 = _slicedToArray(_React$useState9, 2),
64
- help = _React$useState10[0],
65
- setHelp = _React$useState10[1];
66
-
56
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
57
+ help = _React$useState10[0],
58
+ setHelp = _React$useState10[1];
67
59
  var onSearch = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
68
60
  var param, server, res, _options, i, obj;
69
-
70
61
  return _regeneratorRuntime.wrap(function _callee$(_context) {
71
- while (1) {
72
- switch (_context.prev = _context.next) {
73
- case 0:
74
- param = {
75
- id: refId,
76
- filter: {
77
- keywords: ''
78
- },
79
- order: []
80
- };
81
- server = new MetadataService();
82
- _context.next = 4;
83
- return server.GetMetadataObjList(param);
84
-
85
- case 4:
86
- res = _context.sent;
87
- _options = [];
88
-
89
- if (res.length > 0) {
90
- for (i = 0; i < res.length; i++) {
91
- obj = {
92
- label: res[i].name,
93
- value: res[i].namespace
94
- };
95
-
96
- _options.push(obj);
97
- }
62
+ while (1) switch (_context.prev = _context.next) {
63
+ case 0:
64
+ param = {
65
+ id: refId,
66
+ filter: {
67
+ keywords: ''
68
+ },
69
+ order: []
70
+ };
71
+ server = new MetadataService();
72
+ _context.next = 4;
73
+ return server.GetMetadataObjList(param);
74
+ case 4:
75
+ res = _context.sent;
76
+ _options = [];
77
+ if (res.length > 0) {
78
+ for (i = 0; i < res.length; i++) {
79
+ obj = {
80
+ label: res[i].name,
81
+ value: res[i].namespace
82
+ };
83
+ _options.push(obj);
98
84
  }
99
-
100
- setOptions(_options);
101
-
102
- case 8:
103
- case "end":
104
- return _context.stop();
105
- }
85
+ }
86
+ setOptions(_options);
87
+ case 8:
88
+ case "end":
89
+ return _context.stop();
106
90
  }
107
91
  }, _callee);
108
92
  })), []);
@@ -125,56 +109,44 @@ function Index(props) {
125
109
  var getSchemaByRefId = React.useCallback( /*#__PURE__*/function () {
126
110
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(server, __TYPE__) {
127
111
  var _schema, res, provider, FormCls, formCls, _fields;
128
-
129
112
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
130
- while (1) {
131
- switch (_context2.prev = _context2.next) {
132
- case 0:
133
- _schema = []; // 如果有内部类,优先在内部类里面找
134
-
135
- if (__TYPE__.length > 0) {
136
- _schema = __TYPE__.filter(function (it) {
137
- return it.id === refId;
138
- });
139
- } // 内部类找不到 从接口里面拿
140
-
141
-
142
- if (!(_schema.length === 0)) {
143
- _context2.next = 7;
144
- break;
145
- }
146
-
147
- _context2.next = 5;
148
- return server.GetMetadataDetailById(refId);
149
-
150
- case 5:
151
- res = _context2.sent;
152
-
153
- if (res === null || res === void 0 ? void 0 : res.schema) {
154
- _schema = JSON.parse(res === null || res === void 0 ? void 0 : res.schema);
155
- }
156
-
157
- case 7:
158
- provider = new JsonMetadataProvider();
159
-
160
- if (_schema.length > 0) {
161
- provider.add_types(_schema);
162
- FormCls = provider.get_type(_schema[0].id);
163
- formCls = new FormCls();
164
- _fields = formCls.__type__.__fields__;
165
- refFieldsRef.current = _fields;
166
- setRefFields(_objectSpread({}, _fields));
167
- setSchema(_toConsumableArray(_schema));
168
- }
169
-
170
- case 9:
171
- case "end":
172
- return _context2.stop();
173
- }
113
+ while (1) switch (_context2.prev = _context2.next) {
114
+ case 0:
115
+ _schema = []; // 如果有内部类,优先在内部类里面找
116
+ if (__TYPE__.length > 0) {
117
+ _schema = __TYPE__.filter(function (it) {
118
+ return it.id === refId;
119
+ });
120
+ }
121
+ // 内部类找不到 从接口里面拿
122
+ if (!(_schema.length === 0)) {
123
+ _context2.next = 7;
124
+ break;
125
+ }
126
+ _context2.next = 5;
127
+ return server.GetMetadataDetailById(refId);
128
+ case 5:
129
+ res = _context2.sent;
130
+ if (res === null || res === void 0 ? void 0 : res.schema) {
131
+ _schema = JSON.parse(res === null || res === void 0 ? void 0 : res.schema);
132
+ }
133
+ case 7:
134
+ provider = new JsonMetadataProvider();
135
+ if (_schema.length > 0) {
136
+ provider.add_types(_schema);
137
+ FormCls = provider.get_type(_schema[0].id);
138
+ formCls = new FormCls();
139
+ _fields = formCls.__type__.__fields__;
140
+ refFieldsRef.current = _fields;
141
+ setRefFields(_objectSpread({}, _fields));
142
+ setSchema(_toConsumableArray(_schema));
143
+ }
144
+ case 9:
145
+ case "end":
146
+ return _context2.stop();
174
147
  }
175
148
  }, _callee2);
176
149
  }));
177
-
178
150
  return function (_x, _x2) {
179
151
  return _ref2.apply(this, arguments);
180
152
  };
@@ -187,7 +159,6 @@ function Index(props) {
187
159
  server = null;
188
160
  };
189
161
  }
190
-
191
162
  return function () {};
192
163
  }, [getSchemaByRefId, formContext.__TYPE__]);
193
164
  React.useEffect(function () {
@@ -196,10 +167,8 @@ function Index(props) {
196
167
  setHelp(arr[arr.length - 1]);
197
168
  }
198
169
  }, [refId]);
199
-
200
170
  if (isRefForm && !field && schema.length > 0) {
201
171
  var _fieldRule$, _fieldRule$$value, _fieldRule$2, _fieldRule$2$value, _fieldRule$2$value$co;
202
-
203
172
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
204
173
  className: "ant-form-item"
205
174
  }, !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && /*#__PURE__*/React.createElement(_Col, {
@@ -247,7 +216,6 @@ function Index(props) {
247
216
  }
248
217
  }, renderForm(schema, formOptions, formContext.colSpan))))));
249
218
  }
250
-
251
219
  if (isRefForm && field && schema.length > 0) {
252
220
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
253
221
  style: {
@@ -263,7 +231,6 @@ function Index(props) {
263
231
  }
264
232
  }, renderForm(schema, formOptions, formContext.colSpan))));
265
233
  }
266
-
267
234
  return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
268
235
  key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
269
236
  label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
@@ -322,5 +289,4 @@ function Index(props) {
322
289
  allowClear: true
323
290
  }));
324
291
  }
325
-
326
292
  export default /*#__PURE__*/React.memo(Index);