ronds-metadata 1.2.38 → 1.2.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -17,52 +17,43 @@ import './index.less';
17
17
  import MetaFieldsEdit from './components/MetaFieldsEdit';
18
18
  import MetaPropsEdit from './components/MetaPropsEdit';
19
19
  import { OUTERMOST_TYPES_OPTIONS } from './constant';
20
-
21
20
  var MetadataEditV2 = function MetadataEditV2(props) {
22
21
  var initialValues = props.initialValues,
23
- isNameDisabled = props.isNameDisabled,
24
- metadataTag = props.metadataTag,
25
- onFinish = props.onFinish,
26
- onNewRefClick = props.onNewRefClick;
27
-
22
+ isNameDisabled = props.isNameDisabled,
23
+ metadataTag = props.metadataTag,
24
+ onFinish = props.onFinish,
25
+ onNewRefClick = props.onNewRefClick;
28
26
  var _Form$useForm = _Form.useForm(),
29
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
30
- form = _Form$useForm2[0];
31
-
27
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
28
+ form = _Form$useForm2[0];
32
29
  var _React$useState = React.useState('object'),
33
- _React$useState2 = _slicedToArray(_React$useState, 2),
34
- outerType = _React$useState2[0],
35
- setOutType = _React$useState2[1];
36
-
30
+ _React$useState2 = _slicedToArray(_React$useState, 2),
31
+ outerType = _React$useState2[0],
32
+ setOutType = _React$useState2[1];
37
33
  var _React$useState3 = React.useState({
38
- id: '',
39
- type: 'object'
40
- }),
41
- _React$useState4 = _slicedToArray(_React$useState3, 2),
42
- metaSchema = _React$useState4[0],
43
- setMetaSchema = _React$useState4[1];
44
-
34
+ id: '',
35
+ type: 'object'
36
+ }),
37
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
38
+ metaSchema = _React$useState4[0],
39
+ setMetaSchema = _React$useState4[1];
45
40
  var metaSchemaRef = React.useRef({
46
41
  id: '',
47
42
  type: 'object'
48
43
  });
49
44
  var firstLoadRef = React.useRef(true);
50
-
51
45
  var _React$useState5 = React.useState(false),
52
- _React$useState6 = _slicedToArray(_React$useState5, 2),
53
- isFields = _React$useState6[0],
54
- setIsFields = _React$useState6[1];
55
-
46
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
47
+ isFields = _React$useState6[0],
48
+ setIsFields = _React$useState6[1];
56
49
  var _React$useState7 = React.useState({}),
57
- _React$useState8 = _slicedToArray(_React$useState7, 2),
58
- fields = _React$useState8[0],
59
- setFields = _React$useState8[1];
60
-
50
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
51
+ fields = _React$useState8[0],
52
+ setFields = _React$useState8[1];
61
53
  var _React$useState9 = React.useState({}),
62
- _React$useState10 = _slicedToArray(_React$useState9, 2),
63
- curFields = _React$useState10[0],
64
- setCurFields = _React$useState10[1];
65
-
54
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
55
+ curFields = _React$useState10[0],
56
+ setCurFields = _React$useState10[1];
66
57
  React.useEffect(function () {
67
58
  form.setFieldsValue({
68
59
  id: 'Test'
@@ -80,28 +71,22 @@ var MetadataEditV2 = function MetadataEditV2(props) {
80
71
  firstLoadRef.current = false;
81
72
  }
82
73
  }, [form, initialValues]);
83
-
84
74
  var onMyFinish = function onMyFinish(values) {
85
75
  // console.log('values:', values, JSON.stringify(values));
86
76
  // console.log('values:', values);
87
77
  var _metaSchema = metaSchemaRef.current;
88
78
  _metaSchema.id = values.id;
89
79
  _metaSchema.type = values.type;
90
-
91
80
  if (values === null || values === void 0 ? void 0 : values.properties) {
92
81
  _metaSchema.properties = values.properties;
93
-
94
- var _loop = function _loop(i) {
82
+ var _loop = function _loop() {
95
83
  var ele = _metaSchema.properties[i];
96
84
  var curFields = fields[_metaSchema.properties[i].id];
97
-
98
85
  if (curFields) {
99
86
  _metaSchema.properties[i].fields = curFields;
100
87
  }
101
-
102
88
  var propKeys = Object.keys(ele);
103
89
  var needOptKeys = ['name', 'code', 'desc'];
104
-
105
90
  if (ele.fields) {
106
91
  propKeys.forEach(function (propKey) {
107
92
  if (needOptKeys.indexOf(propKey) > -1) {
@@ -147,25 +132,20 @@ var MetadataEditV2 = function MetadataEditV2(props) {
147
132
  });
148
133
  }
149
134
  };
150
-
151
135
  for (var i = 0; i < _metaSchema.properties.length; i++) {
152
- _loop(i);
136
+ _loop();
153
137
  }
154
138
  }
155
-
156
139
  if (fields[values.id]) {
157
140
  _metaSchema.fields = fields[values.id];
158
141
  }
159
-
160
142
  setMetaSchema(_objectSpread({}, _metaSchema));
161
143
  metaSchemaRef.current = _metaSchema;
162
144
  onFinish && onFinish(JSON.stringify(_metaSchema));
163
145
  };
164
-
165
146
  var onAddFields = function onAddFields(index) {
166
147
  if (index === -1) {
167
148
  var _id = form.getFieldValue('id');
168
-
169
149
  if (_id) {
170
150
  setIsFields(true);
171
151
  setCurFields({
@@ -174,26 +154,19 @@ var MetadataEditV2 = function MetadataEditV2(props) {
174
154
  } else {
175
155
  _message.warn('请填写元数据名称');
176
156
  }
177
-
178
157
  return;
179
- } // console.log('========1========', form.getFieldValue('properties'));
180
-
181
-
158
+ }
159
+ // console.log('========1========', form.getFieldValue('properties'));
182
160
  var _properties_from = form.getFieldValue('properties') || [];
183
-
184
161
  var _properties_ref = metaSchemaRef.current.properties || [];
185
-
186
- var _properties = _properties_from.length <= _properties_ref.length ? _properties_ref : _properties_from; // console.log('properties', _properties);
187
-
188
-
162
+ var _properties = _properties_from.length <= _properties_ref.length ? _properties_ref : _properties_from;
163
+ // console.log('properties', _properties);
189
164
  var _curFields = _properties[index];
190
-
191
165
  if (_curFields && _curFields.id) {
192
166
  setIsFields(true);
193
167
  var idx = ((metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields) || []).findIndex(function (v) {
194
168
  return v.id === _curFields.id;
195
169
  });
196
-
197
170
  if ((metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields) && idx >= 0) {
198
171
  setCurFields(_objectSpread({}, metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields[idx]));
199
172
  } else {
@@ -204,22 +177,18 @@ var MetadataEditV2 = function MetadataEditV2(props) {
204
177
  _message.warn('请填写属性名称');
205
178
  }
206
179
  };
207
-
208
180
  var onFieldsChange = function onFieldsChange(values) {
209
181
  var _fields = fields;
210
182
  _fields[curFields.id] = values;
211
183
  setFields(_objectSpread({}, _fields));
212
184
  setIsFields(false);
213
185
  };
214
-
215
186
  var onOuterTypeChange = function onOuterTypeChange(value) {
216
187
  setOutType(value);
217
188
  };
218
-
219
189
  var processFileds = function processFileds(schema) {
220
190
  var _properties = schema.properties;
221
191
  var _fields = fields;
222
-
223
192
  if (_properties) {
224
193
  for (var i = 0; i < _properties.length; i++) {
225
194
  if (_properties[i].fields) {
@@ -227,14 +196,11 @@ var MetadataEditV2 = function MetadataEditV2(props) {
227
196
  }
228
197
  }
229
198
  }
230
-
231
199
  if (schema.fields) {
232
200
  _fields[schema.id] = schema.fields;
233
201
  }
234
-
235
202
  setFields(_objectSpread({}, _fields));
236
203
  };
237
-
238
204
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form, {
239
205
  className: "metadata-edit",
240
206
  initialValues: initialValues,
@@ -294,5 +260,4 @@ var MetadataEditV2 = function MetadataEditV2(props) {
294
260
  onChange: onFieldsChange
295
261
  })));
296
262
  };
297
-
298
263
  export default MetadataEditV2;
@@ -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,7 +13,6 @@ 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
@@ -24,32 +23,26 @@ 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,14 +70,12 @@ 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
80
  return (
95
81
  /*#__PURE__*/
@@ -101,13 +87,11 @@ function Index(props) {
101
87
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
102
88
  })
103
89
  );
104
-
105
90
  case 'upload':
106
91
  return /*#__PURE__*/React.createElement(_Upload, null, /*#__PURE__*/React.createElement(_Button, {
107
92
  disabled: (_extraInfo$disabled5 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled5 !== void 0 ? _extraInfo$disabled5 : disabled,
108
93
  icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
109
94
  }, "\u4E0A\u4F20"));
110
-
111
95
  default:
112
96
  return /*#__PURE__*/React.createElement(_Input, {
113
97
  addonAfter: ((_extraInfo$addonAfter = extraInfo.addonAfter) === null || _extraInfo$addonAfter === void 0 ? void 0 : _extraInfo$addonAfter.key) ? /*#__PURE__*/React.createElement(_Form.Item, {
@@ -128,12 +112,10 @@ function Index(props) {
128
112
  onChange: onChange
129
113
  });
130
114
  }
131
- }; // ref引用的 应用类型是否展示成表单
132
-
133
-
115
+ };
116
+ // ref引用的 应用类型是否展示成表单
134
117
  if (isObj && isRefForm && field) {
135
118
  var _extraInfo$addonAfter5;
136
-
137
119
  return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
138
120
  style: {
139
121
  flex: 1,
@@ -163,7 +145,6 @@ function Index(props) {
163
145
  tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
164
146
  }), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
165
147
  }
166
-
167
148
  return !field ?
168
149
  /*#__PURE__*/
169
150
  // 不是引用的
@@ -208,6 +189,5 @@ function Index(props) {
208
189
  tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
209
190
  }), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
210
191
  }
211
-
212
192
  export default /*#__PURE__*/React.memo(Index);
213
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);