ronds-metadata 1.2.37 → 1.2.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) 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 +3 -8
  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 +40 -73
  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/index.js +8 -15
  50. package/es/comps/FormGenerator/comps/Settings/index.js +16 -30
  51. package/es/comps/FormGenerator/comps/Sidebar/Elements.js +23 -22
  52. package/es/comps/FormGenerator/comps/Sidebar/index.js +6 -2
  53. package/es/comps/FormGenerator/index.js +3 -9
  54. package/es/comps/FormGenerator/interface.d.ts +1 -1
  55. package/es/comps/FormGenerator/settings/index.js +12 -11
  56. package/es/comps/FormGenerator/settings/ruleConfig.js +0 -1
  57. package/es/comps/FormGenerator/transformer.js +40 -105
  58. package/es/comps/Icons/index.js +4 -7
  59. package/es/comps/JsonEdit/index.js +25 -50
  60. package/es/comps/JsonView/index.js +7 -21
  61. package/es/comps/MdEdit/index.js +7 -10
  62. package/es/comps/MdEditPro/index.d.ts +10 -0
  63. package/es/comps/MdEditPro/index.js +22 -0
  64. package/es/comps/MdEditPro/index.less +74 -0
  65. package/es/comps/MdNavbar/index.js +17 -40
  66. package/es/comps/MdNavbar/utils.js +0 -4
  67. package/es/comps/MdView/index.js +7 -11
  68. package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +129 -183
  69. package/es/comps/MetadataEdit/components/MetaPropsEdit.js +11 -27
  70. package/es/comps/MetadataEdit/hooks/index.js +3 -11
  71. package/es/comps/MetadataEdit/index.js +25 -58
  72. package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +17 -33
  73. package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +15 -29
  74. package/es/comps/MetadataEditV2/hooks/index.js +5 -12
  75. package/es/comps/MetadataEditV2/index.js +30 -65
  76. package/es/comps/MetadataForm/DataCell/Array.js +12 -23
  77. package/es/comps/MetadataForm/DataCell/Input.js +23 -39
  78. package/es/comps/MetadataForm/DataCell/Number.js +10 -21
  79. package/es/comps/MetadataForm/DataCell/Ref.js +87 -121
  80. package/es/comps/MetadataForm/DataCell/Select.js +131 -226
  81. package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
  82. package/es/comps/MetadataForm/DataCell/layout/TableArray.js +98 -169
  83. package/es/comps/MetadataForm/HOC/index.js +20 -37
  84. package/es/comps/MetadataForm/hooks/index.js +12 -38
  85. package/es/comps/MetadataForm/index.js +37 -72
  86. package/es/comps/MetadataForm/interface.d.ts +3 -3
  87. package/es/comps/MetadataForm/utils.d.ts +1 -0
  88. package/es/comps/MetadataForm/utils.js +12 -14
  89. package/es/comps/Split/index.js +40 -38
  90. package/es/config.js +0 -4
  91. package/es/framework/RxStore/demo/index.js +9 -10
  92. package/es/framework/RxStore/hooks.d.ts +9 -9
  93. package/es/framework/RxStore/hooks.js +10 -35
  94. package/es/framework/RxStore/store.d.ts +4 -4
  95. package/es/framework/RxStore/store.js +0 -10
  96. package/es/framework/fg/index.js +18 -80
  97. package/es/framework/fg/interface.d.ts +2 -2
  98. package/es/framework/fg/utils.js +0 -10
  99. package/es/framework/graph/index.d.ts +2 -2
  100. package/es/framework/graph/index.js +55 -110
  101. package/es/framework/hooks/use-async-memo.js +3 -7
  102. package/es/framework/hooks/use-sync-scroll.js +2 -15
  103. package/es/framework/http/cache.js +25 -32
  104. package/es/framework/http/cancel.js +1 -7
  105. package/es/framework/http/index.js +22 -82
  106. package/es/framework/http/msgpack.js +0 -4
  107. package/es/framework/http/msgpack5/index.js +2 -12
  108. package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +1 -13
  109. package/es/framework/http/msgpack5/lib/decoder.js +10 -68
  110. package/es/framework/http/msgpack5/lib/encoder.js +8 -36
  111. package/es/framework/http/msgpack5/lib/helpers.js +3 -2
  112. package/es/framework/http/msgpack5/lib/streams.js +0 -18
  113. package/es/framework/libs/jquery.min.js +1009 -1696
  114. package/es/framework/locale/dil8/di18n.js +4 -15
  115. package/es/framework/locale/dil8/translate.js +0 -14
  116. package/es/framework/locale/dil8/util.js +0 -3
  117. package/es/framework/locale/index.js +2 -3
  118. package/es/framework/metadata/MetadataService.js +39 -78
  119. package/es/framework/metadata/index.js +4 -70
  120. package/es/framework/rxjs-hooks/useMemoSubject.js +0 -2
  121. package/es/framework/rxjs-hooks/useObservable.js +2 -4
  122. package/es/framework/rxjs-hooks/useObservableState.js +8 -14
  123. package/es/index.d.ts +1 -0
  124. package/es/index.js +2 -1
  125. package/es/utils.js +58 -97
  126. package/package.json +4 -2
  127. package/es/comps/MdEdit/plugin/EditContent.d.ts +0 -5
  128. package/es/comps/MdEdit/plugin/EditContent.js +0 -34
  129. package/es/comps/MdEdit/plugin/Mark.d.ts +0 -7
  130. package/es/comps/MdEdit/plugin/Mark.js +0 -60
  131. package/es/framework/libs/iconfont/iconfont.json +0 -401
@@ -8,7 +8,6 @@ import _Form from "antd/es/form";
8
8
  import "antd/es/col/style";
9
9
  import _Col from "antd/es/col";
10
10
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
11
-
12
11
  /*
13
12
  * @Author: wangxian
14
13
  * @Date: 2021-09-18 14:15:04
@@ -21,41 +20,33 @@ import { useGetExtraInfo } from '../hooks';
21
20
  import { getDataCell } from '../utils';
22
21
  import { tr } from '../../../framework/locale';
23
22
  import TableArray from './layout/TableArray';
24
-
25
23
  function Index(props) {
26
24
  var _fieldRule$, _fieldRule$$value, _fieldRule$2, _fieldRule$2$value, _extraInfo$disabled;
27
-
28
25
  var id = props.id,
29
- items = props.items,
30
- isRefForm = props.isRefForm,
31
- fieldRule = props.fields,
32
- colSpan = props.colSpan,
33
- labelSpan = props.labelSpan,
34
- initEnumValue = props.initEnumValue,
35
- name = props.name,
36
- disabled = props.disabled;
26
+ items = props.items,
27
+ isRefForm = props.isRefForm,
28
+ fieldRule = props.fields,
29
+ colSpan = props.colSpan,
30
+ labelSpan = props.labelSpan,
31
+ initEnumValue = props.initEnumValue,
32
+ name = props.name,
33
+ disabled = props.disabled;
37
34
  var formContext = React.useContext(MetadataFormContext) || {};
38
35
  var refContext = React.useContext(MetadataRefContext) || {};
39
-
40
36
  var _fileds = React.useMemo(function () {
41
37
  var ff = formContext === null || formContext === void 0 ? void 0 : formContext.fields;
42
-
43
38
  if (refContext === null || refContext === void 0 ? void 0 : refContext.fields) {
44
39
  refContext === null || refContext === void 0 ? void 0 : refContext.fields.forEach(function (v, k) {
45
40
  ff.set(k, v);
46
41
  });
47
42
  }
48
-
49
43
  return ff;
50
44
  }, [formContext === null || formContext === void 0 ? void 0 : formContext.fields, refContext === null || refContext === void 0 ? void 0 : refContext.fields]);
51
-
52
45
  var extraInfo = useGetExtraInfo(formContext === null || formContext === void 0 ? void 0 : formContext.fields, id, formContext.form, props.type);
53
-
54
46
  var _React$useState = React.useState(),
55
- _React$useState2 = _slicedToArray(_React$useState, 2),
56
- help = _React$useState2[0],
57
- setHelp = _React$useState2[1];
58
-
47
+ _React$useState2 = _slicedToArray(_React$useState, 2),
48
+ help = _React$useState2[0],
49
+ setHelp = _React$useState2[1];
59
50
  React.useEffect(function () {
60
51
  if (items && items.refId) {
61
52
  var arr = items.refId.split('.');
@@ -116,10 +107,9 @@ function Index(props) {
116
107
  initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue
117
108
  }, function (fields, _ref) {
118
109
  var add = _ref.add,
119
- remove = _ref.remove;
110
+ remove = _ref.remove;
120
111
  return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, idx) {
121
112
  var _extraInfo$disabled2;
122
-
123
113
  return /*#__PURE__*/React.createElement("div", {
124
114
  key: field.key,
125
115
  style: {
@@ -153,5 +143,4 @@ function Index(props) {
153
143
  }, tr('添加'))));
154
144
  })))));
155
145
  }
156
-
157
146
  export default /*#__PURE__*/React.memo(Index);
@@ -13,43 +13,36 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
13
13
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
14
14
  import "antd/es/input/style";
15
15
  import _Input from "antd/es/input";
16
-
17
16
  /*
18
17
  * @Author: wangxian
19
18
  * @Date: 2021-09-18 14:15:04
20
- * @LastEditTime: 2023-04-04 09:20:39
19
+ * @LastEditTime: 2023-04-27 18:56:50
21
20
  */
22
21
  import React from 'react';
23
22
  import { UploadOutlined } from '@ant-design/icons';
24
23
  import { MetadataFormContext, MetadataRefContext } from '../interface';
25
24
  import { useGetExtraInfo } from '../hooks';
26
25
  var TextArea = _Input.TextArea;
27
-
28
26
  function Index(props) {
29
27
  var _extraInfo$addonAfter6;
30
-
31
28
  var id = props.id,
32
- isRefForm = props.isRefForm,
33
- disabled = props.disabled,
34
- notRequire = props.notRequire,
35
- field = props.field,
36
- labelSpan = props.labelSpan,
37
- name = props.name,
38
- isObj = props.isObj;
29
+ isRefForm = props.isRefForm,
30
+ disabled = props.disabled,
31
+ notRequire = props.notRequire,
32
+ field = props.field,
33
+ labelSpan = props.labelSpan,
34
+ name = props.name,
35
+ isObj = props.isObj;
39
36
  var formContext = React.useContext(MetadataFormContext) || {};
40
37
  var formRefContext = React.useContext(MetadataRefContext);
41
38
  var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
42
-
43
39
  if (id === 'p' || id === 'user') {}
44
-
45
40
  var _React$useState = React.useState([]),
46
- _React$useState2 = _slicedToArray(_React$useState, 2),
47
- rules = _React$useState2[0],
48
- setRules = _React$useState2[1];
49
-
41
+ _React$useState2 = _slicedToArray(_React$useState, 2),
42
+ rules = _React$useState2[0],
43
+ setRules = _React$useState2[1];
50
44
  React.useEffect(function () {
51
45
  var _rules = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.rules;
52
-
53
46
  if (_rules) {
54
47
  var _ = _rules.map(function (it) {
55
48
  return {
@@ -57,23 +50,18 @@ function Index(props) {
57
50
  message: it === null || it === void 0 ? void 0 : it.message
58
51
  };
59
52
  });
60
-
61
53
  setRules(_toConsumableArray(_));
62
54
  }
63
55
  }, [extraInfo]);
64
-
65
56
  var onChange = function onChange(e) {};
66
-
67
57
  var processInputType = function processInputType(_type) {
68
58
  var _extraInfo$disabled, _extraInfo$disabled2, _extraInfo$disabled3, _extraInfo$disabled4, _extraInfo$disabled5, _extraInfo$addonAfter, _extraInfo$addonAfter2, _extraInfo$addonAfter3, _extraInfo$addonAfter4, _extraInfo$disabled6;
69
-
70
59
  switch (_type) {
71
60
  case 'password':
72
61
  return /*#__PURE__*/React.createElement(_Input.Password, {
73
62
  disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
74
63
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
75
64
  });
76
-
77
65
  case 'textarea':
78
66
  return /*#__PURE__*/React.createElement(TextArea, {
79
67
  showCount: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.showCount,
@@ -82,28 +70,28 @@ function Index(props) {
82
70
  disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
83
71
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
84
72
  });
85
-
86
73
  case 'colorPicker':
87
74
  return /*#__PURE__*/React.createElement(_Input, {
88
75
  type: "color",
89
76
  disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
90
77
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
91
78
  });
92
-
93
79
  case 'datePicker':
94
- return /*#__PURE__*/React.createElement(_DatePicker, {
95
- showTime: true,
96
- format: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.format) || DEFAULT_DATE_FORMAT,
97
- disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
98
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
99
- });
100
-
80
+ return (
81
+ /*#__PURE__*/
82
+ // @ts-ignore
83
+ React.createElement(_DatePicker, {
84
+ showTime: true,
85
+ format: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.format) || DEFAULT_DATE_FORMAT,
86
+ disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
87
+ placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
88
+ })
89
+ );
101
90
  case 'upload':
102
91
  return /*#__PURE__*/React.createElement(_Upload, null, /*#__PURE__*/React.createElement(_Button, {
103
92
  disabled: (_extraInfo$disabled5 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled5 !== void 0 ? _extraInfo$disabled5 : disabled,
104
93
  icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
105
94
  }, "\u4E0A\u4F20"));
106
-
107
95
  default:
108
96
  return /*#__PURE__*/React.createElement(_Input, {
109
97
  addonAfter: ((_extraInfo$addonAfter = extraInfo.addonAfter) === null || _extraInfo$addonAfter === void 0 ? void 0 : _extraInfo$addonAfter.key) ? /*#__PURE__*/React.createElement(_Form.Item, {
@@ -124,12 +112,10 @@ function Index(props) {
124
112
  onChange: onChange
125
113
  });
126
114
  }
127
- }; // ref引用的 应用类型是否展示成表单
128
-
129
-
115
+ };
116
+ // ref引用的 应用类型是否展示成表单
130
117
  if (isObj && isRefForm && field) {
131
118
  var _extraInfo$addonAfter5;
132
-
133
119
  return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
134
120
  style: {
135
121
  flex: 1,
@@ -159,7 +145,6 @@ function Index(props) {
159
145
  tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
160
146
  }), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
161
147
  }
162
-
163
148
  return !field ?
164
149
  /*#__PURE__*/
165
150
  // 不是引用的
@@ -204,6 +189,5 @@ function Index(props) {
204
189
  tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
205
190
  }), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
206
191
  }
207
-
208
192
  export default /*#__PURE__*/React.memo(Index);
209
193
  export var DEFAULT_DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss';
@@ -5,7 +5,6 @@ import "antd/es/input-number/style";
5
5
  import _InputNumber from "antd/es/input-number";
6
6
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
7
7
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
8
-
9
8
  /*
10
9
  * @Author: wangxian
11
10
  * @Date: 2021-09-18 14:15:04
@@ -14,30 +13,25 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
14
13
  import React from 'react';
15
14
  import { MetadataFormContext, MetadataRefContext } from '../interface';
16
15
  import { useGetExtraInfo } from '../hooks';
17
-
18
16
  function Index(props) {
19
17
  var _extraInfo$disabled2, _extraInfo$disabled3;
20
-
21
18
  var id = props.id,
22
- name = props.name,
23
- isRefForm = props.isRefForm,
24
- disabled = props.disabled,
25
- notRequire = props.notRequire,
26
- labelSpan = props.labelSpan,
27
- field = props.field,
28
- isObj = props.isObj;
19
+ name = props.name,
20
+ isRefForm = props.isRefForm,
21
+ disabled = props.disabled,
22
+ notRequire = props.notRequire,
23
+ labelSpan = props.labelSpan,
24
+ field = props.field,
25
+ isObj = props.isObj;
29
26
  var formContext = React.useContext(MetadataFormContext) || {};
30
27
  var formRefContext = React.useContext(MetadataRefContext);
31
28
  var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
32
-
33
29
  var _React$useState = React.useState([]),
34
- _React$useState2 = _slicedToArray(_React$useState, 2),
35
- rules = _React$useState2[0],
36
- setRules = _React$useState2[1];
37
-
30
+ _React$useState2 = _slicedToArray(_React$useState, 2),
31
+ rules = _React$useState2[0],
32
+ setRules = _React$useState2[1];
38
33
  React.useEffect(function () {
39
34
  var _rules = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.rules;
40
-
41
35
  if (_rules) {
42
36
  var _ = _rules.map(function (it) {
43
37
  return {
@@ -45,14 +39,11 @@ function Index(props) {
45
39
  message: it.message
46
40
  };
47
41
  });
48
-
49
42
  setRules(_toConsumableArray(_));
50
43
  }
51
44
  }, [extraInfo]);
52
-
53
45
  if (isObj && isRefForm && field) {
54
46
  var _extraInfo$disabled;
55
-
56
47
  return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
57
48
  style: {
58
49
  flex: 1,
@@ -85,7 +76,6 @@ function Index(props) {
85
76
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
86
77
  }));
87
78
  }
88
-
89
79
  return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
90
80
  key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
91
81
  initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
@@ -133,5 +123,4 @@ function Index(props) {
133
123
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
134
124
  }));
135
125
  }
136
-
137
126
  export default /*#__PURE__*/React.memo(Index);
@@ -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);