ronds-metadata 1.0.72 → 1.0.75

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.
@@ -70,7 +70,7 @@ declare class Texty extends React.PureComponent<ITextyProps, any> {
70
70
  componentDidUpdate(): void;
71
71
  componentWillUnmount(): void;
72
72
  render(): JSX.Element;
73
- renderTooltip: ({ ref, style, placement, arrowProps, }: any) => React.ReactPortal;
73
+ renderTooltip: ({ ref, style, placement, arrowProps }: any) => React.ReactPortal;
74
74
  setTargetRef: (ref: any) => void;
75
75
  handleMouseEvent: (e: any) => void;
76
76
  handleScroll: (e: any) => void;
@@ -209,8 +209,7 @@ var Editable = function Editable(props) {
209
209
  if (_columns.findIndex(function (v) {
210
210
  return v.key === data.key;
211
211
  }) > -1) {
212
- _message.warning('表格的key不可以重复');
213
-
212
+ // message.warning('表格的key不可以重复');
214
213
  return;
215
214
  }
216
215
 
@@ -236,8 +235,7 @@ var Editable = function Editable(props) {
236
235
  if (whiteColumn.findIndex(function (v) {
237
236
  return v === data.dataIndex;
238
237
  }) > -1) {
239
- _message.warning("".concat(data.dataIndex, "\u65E0\u6CD5\u5220\u9664"));
240
-
238
+ // message.warning(`${data.dataIndex}无法删除`);
241
239
  return;
242
240
  }
243
241
 
@@ -1,4 +1,5 @@
1
1
  interface IMetaFieldsEditProps {
2
+ type?: string;
2
3
  defaultValues?: any;
3
4
  onChange?: (values: any) => void;
4
5
  }
@@ -9,7 +9,9 @@ import _Select from "antd/es/select";
9
9
  import _extends from "@babel/runtime/helpers/esm/extends";
10
10
  import "antd/es/input/style";
11
11
  import _Input from "antd/es/input";
12
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
12
13
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
14
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
13
15
  import "antd/es/form/style";
14
16
  import _Form from "antd/es/form";
15
17
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
@@ -18,9 +20,11 @@ import React from 'react';
18
20
  import { RULE_TYPES_OPTIONS } from '../constant';
19
21
  import { useMetaType } from '../hooks';
20
22
  import MetadataForm from '../../MetadataForm';
23
+ import { MetadataService } from '../../../framework/metadata/MetadataService';
21
24
 
22
25
  var MetaFieldsEdit = function MetaFieldsEdit(props) {
23
- var defaultValues = props.defaultValues,
26
+ var type = props.type,
27
+ defaultValues = props.defaultValues,
24
28
  onChange = props.onChange;
25
29
 
26
30
  var _Form$useForm = _Form.useForm(),
@@ -39,10 +43,96 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
39
43
 
40
44
  var _React$useState5 = React.useState({}),
41
45
  _React$useState6 = _slicedToArray(_React$useState5, 2),
42
- refValues = _React$useState6[0],
43
- setRefValues = _React$useState6[1];
46
+ refSchema = _React$useState6[0],
47
+ setRefSchema = _React$useState6[1];
48
+
49
+ var _React$useState7 = React.useState({}),
50
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
51
+ refValues = _React$useState8[0],
52
+ setRefValues = _React$useState8[1];
44
53
 
45
54
  var metaType = useMetaType('扩展规则');
55
+
56
+ var processSpecialRuleData = /*#__PURE__*/function () {
57
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_refId, idx) {
58
+ var server, res, _schema, _properties, _refSchema;
59
+
60
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
61
+ while (1) {
62
+ switch (_context.prev = _context.next) {
63
+ case 0:
64
+ if (!(_refId.indexOf('Rule.Form') > -1)) {
65
+ _context.next = 12;
66
+ break;
67
+ }
68
+
69
+ server = new MetadataService();
70
+ _context.next = 4;
71
+ return server.GetMetadataDetailById(_refId);
72
+
73
+ case 4:
74
+ res = _context.sent;
75
+ _schema = JSON.parse(res.schema);
76
+ _properties = _schema[0].properties;
77
+ _properties = _properties.filter(function (it) {
78
+ return it.id === 'common' || it.id === type;
79
+ });
80
+ _schema[0].properties = _properties;
81
+ _refSchema = refSchema;
82
+ _refSchema[idx] = _schema;
83
+ setRefSchema(_objectSpread({}, _refSchema));
84
+
85
+ case 12:
86
+ case "end":
87
+ return _context.stop();
88
+ }
89
+ }
90
+ }, _callee);
91
+ }));
92
+
93
+ return function processSpecialRuleData(_x, _x2) {
94
+ return _ref.apply(this, arguments);
95
+ };
96
+ }();
97
+
98
+ var onRefSelectChange = React.useCallback( /*#__PURE__*/function () {
99
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(value, index) {
100
+ var _refIds, newData;
101
+
102
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
103
+ while (1) {
104
+ switch (_context2.prev = _context2.next) {
105
+ case 0:
106
+ if (!value) {
107
+ _context2.next = 3;
108
+ break;
109
+ }
110
+
111
+ _context2.next = 3;
112
+ return processSpecialRuleData(value, index);
113
+
114
+ case 3:
115
+ _refIds = refIds;
116
+ _refIds[index] = value;
117
+ setRefIds(_objectSpread({}, _refIds));
118
+ newData = form.getFieldValue('fields');
119
+ newData[index].id = value;
120
+ form.setFieldsValue({
121
+ fields: newData
122
+ });
123
+
124
+ case 9:
125
+ case "end":
126
+ return _context2.stop();
127
+ }
128
+ }
129
+ }, _callee2);
130
+ }));
131
+
132
+ return function (_x3, _x4) {
133
+ return _ref2.apply(this, arguments);
134
+ };
135
+ }(), [form]);
46
136
  React.useEffect(function () {
47
137
  if (defaultValues) {
48
138
  form.setFieldsValue({
@@ -96,9 +186,9 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
96
186
  }
97
187
  }, /*#__PURE__*/React.createElement(_Form.List, {
98
188
  name: "fields"
99
- }, function (fields, _ref) {
100
- var add = _ref.add,
101
- remove = _ref.remove;
189
+ }, function (fields, _ref3) {
190
+ var add = _ref3.add,
191
+ remove = _ref3.remove;
102
192
  return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, index) {
103
193
  var _defaultValues$index;
104
194
 
@@ -136,7 +226,10 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
136
226
  _ruleTypes[index] = value;
137
227
  setRuleTypes(_objectSpread({}, _ruleTypes));
138
228
  },
139
- options: RULE_TYPES_OPTIONS
229
+ options: RULE_TYPES_OPTIONS,
230
+ getPopupContainer: function getPopupContainer(triggerNode) {
231
+ return triggerNode.parentNode;
232
+ }
140
233
  })), ruleTypes[index] === 'text' && /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
141
234
  label: "\u89C4\u5219\u503C",
142
235
  name: [field.name, 'value'],
@@ -179,19 +272,15 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
179
272
  width: '120px'
180
273
  },
181
274
  onChange: function onChange(value) {
182
- var _refIds = refIds;
183
- _refIds[index] = value;
184
- setRefIds(_objectSpread({}, _refIds));
185
- var newData = form.getFieldValue('fields');
186
- newData[index].id = value;
187
- form.setFieldsValue({
188
- fields: newData
189
- });
275
+ onRefSelectChange(value, index);
190
276
  },
191
277
  options: metaType || [],
192
278
  filterOption: function filterOption(input, option) {
193
279
  return (option === null || option === void 0 ? void 0 : option.label.indexOf(input)) >= 0;
194
280
  },
281
+ getPopupContainer: function getPopupContainer(triggerNode) {
282
+ return triggerNode.parentNode;
283
+ },
195
284
  allowClear: true
196
285
  })), /*#__PURE__*/React.createElement("div", {
197
286
  style: {
@@ -211,6 +300,7 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
211
300
  }, /*#__PURE__*/React.createElement(MetadataForm, {
212
301
  initialValues: defaultValues && defaultValues.length > 0 && ((_defaultValues$index = defaultValues[index]) === null || _defaultValues$index === void 0 ? void 0 : _defaultValues$index.value),
213
302
  refId: refIds[index],
303
+ schema: refSchema[index],
214
304
  onValuesChange: function onValuesChange(values, allValues) {
215
305
  onRefRulesValuesChange(allValues, index);
216
306
  }
@@ -84,6 +84,9 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
84
84
  options: BASIC_TYPES_OPTIONS,
85
85
  onChange: function onChange() {
86
86
  onTypeChange(index);
87
+ },
88
+ getPopupContainer: function getPopupContainer(triggerNode) {
89
+ return triggerNode.parentNode;
87
90
  }
88
91
  })), /*#__PURE__*/React.createElement("div", {
89
92
  style: {
@@ -142,7 +145,10 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
142
145
  style: {
143
146
  width: '180px'
144
147
  },
145
- options: NUMBER_FORMAT_OPTIONS
148
+ options: NUMBER_FORMAT_OPTIONS,
149
+ getPopupContainer: function getPopupContainer(triggerNode) {
150
+ return triggerNode.parentNode;
151
+ }
146
152
  })));
147
153
 
148
154
  case 'ref':
@@ -170,6 +176,9 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
170
176
  filterOption: function filterOption(input, option) {
171
177
  return (option === null || option === void 0 ? void 0 : option.label.indexOf(input)) >= 0;
172
178
  },
179
+ getPopupContainer: function getPopupContainer(triggerNode) {
180
+ return triggerNode.parentNode;
181
+ },
173
182
  allowClear: true
174
183
  })), /*#__PURE__*/React.createElement("div", {
175
184
  style: {
@@ -224,7 +233,10 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
224
233
  style: {
225
234
  width: '180px'
226
235
  },
227
- options: ARRAY_TYPES_OPTIONS
236
+ options: ARRAY_TYPES_OPTIONS,
237
+ getPopupContainer: function getPopupContainer(triggerNode) {
238
+ return triggerNode.parentNode;
239
+ }
228
240
  })), _properties && ((_properties$index2 = _properties[index]) === null || _properties$index2 === void 0 ? void 0 : (_properties$index2$it = _properties$index2.items) === null || _properties$index2$it === void 0 ? void 0 : _properties$index2$it.type) === 'ref' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
229
241
  label: "Ref",
230
242
  name: [field.name, 'items', 'refId'],
@@ -236,7 +248,10 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
236
248
  style: {
237
249
  width: '180px'
238
250
  },
239
- options: metaType || []
251
+ options: metaType || [],
252
+ getPopupContainer: function getPopupContainer(triggerNode) {
253
+ return triggerNode.parentNode;
254
+ }
240
255
  })), /*#__PURE__*/React.createElement("div", {
241
256
  style: {
242
257
  padding: '0 10px'
@@ -277,7 +292,10 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
277
292
  style: {
278
293
  width: '180px'
279
294
  },
280
- options: NUMBER_FORMAT_OPTIONS
295
+ options: NUMBER_FORMAT_OPTIONS,
296
+ getPopupContainer: function getPopupContainer(triggerNode) {
297
+ return triggerNode.parentNode;
298
+ }
281
299
  }))));
282
300
 
283
301
  case 'enum':
@@ -109,10 +109,13 @@ var MetadataEdit = function MetadataEdit(props) {
109
109
  if (index === -1) {
110
110
  var _id = form.getFieldValue('id');
111
111
 
112
+ var _type = form.getFieldValue('type');
113
+
112
114
  if (_id) {
113
115
  setIsFields(true);
114
116
  setCurFields({
115
- id: _id
117
+ id: _id,
118
+ type: _type
116
119
  });
117
120
  } else {
118
121
  _message.warn('请填写元数据名称');
@@ -203,7 +206,10 @@ var MetadataEdit = function MetadataEdit(props) {
203
206
  }]
204
207
  }, /*#__PURE__*/React.createElement(_Select, {
205
208
  options: OUTERMOST_TYPES_OPTIONS,
206
- onChange: onOuterTypeChange
209
+ onChange: onOuterTypeChange,
210
+ getPopupContainer: function getPopupContainer(triggerNode) {
211
+ return triggerNode.parentNode;
212
+ }
207
213
  })), outerType === 'object' && /*#__PURE__*/React.createElement(MetaPropsEdit, {
208
214
  form: form,
209
215
  metadataTag: metadataTag,
@@ -230,6 +236,7 @@ var MetadataEdit = function MetadataEdit(props) {
230
236
  destroyOnClose: true
231
237
  }, /*#__PURE__*/React.createElement(MetaFieldsEdit, {
232
238
  key: curFields === null || curFields === void 0 ? void 0 : curFields.id,
239
+ type: curFields === null || curFields === void 0 ? void 0 : curFields.type,
233
240
  defaultValues: fields[curFields.id],
234
241
  onChange: onFieldsChange
235
242
  })));
@@ -8,13 +8,14 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
8
8
  /*
9
9
  * @Author: wangxian
10
10
  * @Date: 2021-09-18 14:15:04
11
- * @LastEditTime: 2022-04-11 10:20:33
11
+ * @LastEditTime: 2022-05-05 08:54:59
12
12
  */
13
13
  import React from 'react';
14
14
  import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
15
15
  import { MetadataFormContext } from '../interface';
16
16
  import { useGetExtraInfo } from '../hooks';
17
17
  import { getDataCell } from '../utils';
18
+ import { deepClone } from '@/utils';
18
19
 
19
20
  function Index(props) {
20
21
  var _fieldRule$, _fieldRule$$value;
@@ -24,15 +25,28 @@ function Index(props) {
24
25
  isRefForm = props.isRefForm,
25
26
  fieldRule = props.fields,
26
27
  initEnumValue = props.initEnumValue,
28
+ name = props.name,
27
29
  disabled = props.disabled;
28
30
  var formContext = React.useContext(MetadataFormContext) || {};
29
- var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form);
31
+ var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form, props.type);
30
32
 
31
33
  var _React$useState = React.useState(),
32
34
  _React$useState2 = _slicedToArray(_React$useState, 2),
33
35
  help = _React$useState2[0],
34
36
  setHelp = _React$useState2[1];
35
37
 
38
+ var myName = React.useMemo(function () {
39
+ var res = [];
40
+
41
+ if (name && name.length > 0) {
42
+ res = deepClone(name);
43
+ res.push(id);
44
+ } else {
45
+ return id;
46
+ }
47
+
48
+ return res;
49
+ }, [name, id]);
36
50
  React.useEffect(function () {
37
51
  if (items && items.refId) {
38
52
  var arr = items.refId.split(':');
@@ -64,7 +78,7 @@ function Index(props) {
64
78
  borderRadius: '4px'
65
79
  }
66
80
  }, /*#__PURE__*/React.createElement(_Form.List, {
67
- name: id,
81
+ name: myName,
68
82
  key: id
69
83
  }, function (fields, _ref) {
70
84
  var add = _ref.add,
@@ -2,6 +2,10 @@ import "antd/es/form/style";
2
2
  import _Form from "antd/es/form";
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
5
+ import "antd/es/upload/style";
6
+ import _Upload from "antd/es/upload";
7
+ import "antd/es/button/style";
8
+ import _Button from "antd/es/button";
5
9
  import "antd/es/date-picker/style";
6
10
  import _DatePicker from "antd/es/date-picker";
7
11
  import "antd/es/popover/style";
@@ -14,11 +18,12 @@ import _Input from "antd/es/input";
14
18
  /*
15
19
  * @Author: wangxian
16
20
  * @Date: 2021-09-18 14:15:04
17
- * @LastEditTime: 2022-04-02 17:18:27
21
+ * @LastEditTime: 2022-05-05 09:34:40
18
22
  */
19
23
  import React from 'react';
20
24
  import { BgColorsOutlined } from '@ant-design/icons';
21
25
  import { SketchPicker } from 'react-color';
26
+ import { UploadOutlined } from '@ant-design/icons';
22
27
  import { MetadataFormContext, MetadataRefContext } from '../interface';
23
28
  import { useGetExtraInfo } from '../hooks';
24
29
  var TextArea = _Input.TextArea;
@@ -32,7 +37,7 @@ function Index(props) {
32
37
  isObj = props.isObj;
33
38
  var formContext = React.useContext(MetadataFormContext) || {};
34
39
  var formRefContext = React.useContext(MetadataRefContext);
35
- var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form);
40
+ var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
36
41
 
37
42
  var _React$useState = React.useState(''),
38
43
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -97,6 +102,13 @@ function Index(props) {
97
102
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
98
103
  });
99
104
 
105
+ case 'upload':
106
+ return /*#__PURE__*/React.createElement(_Upload, {
107
+ name: "logo"
108
+ }, /*#__PURE__*/React.createElement(_Button, {
109
+ icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
110
+ }, "\u4E0A\u4F20"));
111
+
100
112
  default:
101
113
  return /*#__PURE__*/React.createElement(_Input, {
102
114
  disabled: (_extraInfo$disabled5 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled5 !== void 0 ? _extraInfo$disabled5 : disabled,
@@ -19,7 +19,7 @@ function Index(props) {
19
19
  isObj = props.isObj;
20
20
  var formContext = React.useContext(MetadataFormContext) || {};
21
21
  var formRefContext = React.useContext(MetadataRefContext);
22
- var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form);
22
+ var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
23
23
 
24
24
  if (isObj && isRefForm && field) {
25
25
  var _extraInfo$disabled;
@@ -26,7 +26,7 @@ function Index(props) {
26
26
  field = props.field,
27
27
  name = props.name;
28
28
  var formContext = React.useContext(MetadataFormContext) || {};
29
- var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form);
29
+ var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form, props.type);
30
30
 
31
31
  var _React$useState = React.useState([]),
32
32
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -48,7 +48,10 @@ function Index(props) {
48
48
  var _React$useState7 = React.useState(''),
49
49
  _React$useState8 = _slicedToArray(_React$useState7, 2),
50
50
  help = _React$useState8[0],
51
- setHelp = _React$useState8[1];
51
+ setHelp = _React$useState8[1]; // if (id === 'enum') {
52
+ // debugger;
53
+ // }
54
+
52
55
 
53
56
  var onSearch = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
54
57
  var param, server, res, _options, i, obj;
@@ -146,7 +149,7 @@ function Index(props) {
146
149
  }
147
150
  }, [refId]);
148
151
 
149
- if (isRefForm && !field && schema) {
152
+ if (isRefForm && !field && schema.length > 0) {
150
153
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
151
154
  className: "ant-form-item-label",
152
155
  style: {
@@ -169,7 +172,7 @@ function Index(props) {
169
172
  }, renderForm(schema, formOptions))));
170
173
  }
171
174
 
172
- if (isRefForm && field && schema) {
175
+ if (isRefForm && field && schema.length > 0) {
173
176
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
174
177
  style: {
175
178
  padding: '10px',
@@ -9,7 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
9
  /*
10
10
  * @Author:wangxian
11
11
  * @Date: 2021-09-18 14:15:04
12
- * @LastEditTime: 2022-04-01 17:07:41
12
+ * @LastEditTime: 2022-05-05 09:26:37
13
13
  */
14
14
  import React from 'react';
15
15
  import { MetadataFormContext, MetadataRefContext } from '../interface';
@@ -28,7 +28,7 @@ function Index(props) {
28
28
  isObj = props.isObj;
29
29
  var formContext = React.useContext(MetadataFormContext) || {};
30
30
  var formRefContext = React.useContext(MetadataRefContext);
31
- var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form);
31
+ var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
32
32
 
33
33
  var onSelect = function onSelect(value) {
34
34
  formContext.stream$ && formContext.stream$.next({
@@ -38,31 +38,32 @@ function Index(props) {
38
38
  };
39
39
 
40
40
  var options = React.useMemo(function () {
41
+ var _extraInfo$enum;
42
+
41
43
  var _options = [];
42
44
 
43
- if (!initEnumValue[id] && props.enum && props.enum.length > 0) {
44
- props.enum.forEach(function (_enum) {
45
- var obj = {
46
- label: _enum.value,
47
- value: _enum.value
48
- };
45
+ var _enum = props.enum || [];
46
+
47
+ if ((extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$enum = extraInfo.enum) === null || _extraInfo$enum === void 0 ? void 0 : _extraInfo$enum.value) || (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.value)) {
48
+ var _extraInfo$enum2;
49
49
 
50
- _options.push(obj);
51
- });
50
+ _enum = (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$enum2 = extraInfo.enum) === null || _extraInfo$enum2 === void 0 ? void 0 : _extraInfo$enum2.value) || (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.value);
52
51
  } // 目前是更具那么的id判断的,暂未考虑重名问题
53
52
 
54
53
 
55
54
  if (initEnumValue[id]) {
56
- initEnumValue[id].forEach(function (_enum) {
57
- var obj = {
58
- label: _enum.value,
59
- value: _enum.key
60
- };
61
-
62
- _options.push(obj);
63
- });
55
+ _enum = initEnumValue[id];
64
56
  }
65
57
 
58
+ _enum.forEach(function (it) {
59
+ var obj = {
60
+ label: it.value,
61
+ value: (it === null || it === void 0 ? void 0 : it.key) || (it === null || it === void 0 ? void 0 : it.value)
62
+ };
63
+
64
+ _options.push(obj);
65
+ });
66
+
66
67
  return _options;
67
68
  }, [props.enum, initEnumValue, name]);
68
69
 
@@ -88,6 +89,9 @@ function Index(props) {
88
89
  disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
89
90
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
90
91
  options: options,
92
+ getPopupContainer: function getPopupContainer(triggerNode) {
93
+ return triggerNode.parentNode;
94
+ },
91
95
  allowClear: true
92
96
  }));
93
97
  }
@@ -106,6 +110,9 @@ function Index(props) {
106
110
  disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
107
111
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
108
112
  options: options,
113
+ getPopupContainer: function getPopupContainer(triggerNode) {
114
+ return triggerNode.parentNode;
115
+ },
109
116
  allowClear: true
110
117
  })) : /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
111
118
  style: {
@@ -125,6 +132,9 @@ function Index(props) {
125
132
  disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
126
133
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
127
134
  options: options,
135
+ getPopupContainer: function getPopupContainer(triggerNode) {
136
+ return triggerNode.parentNode;
137
+ },
128
138
  allowClear: true
129
139
  }));
130
140
  }
@@ -4,6 +4,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import "antd/es/switch/style";
5
5
  import _Switch from "antd/es/switch";
6
6
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
7
+
8
+ /*
9
+ * @Author: wangxian
10
+ * @Date: 2021-09-18 14:15:04
11
+ * @LastEditTime: 2022-05-05 09:37:53
12
+ */
7
13
  import React from 'react';
8
14
  import { MetadataFormContext, MetadataRefContext } from '../interface';
9
15
  import { useGetExtraInfo } from '../hooks';
@@ -19,7 +25,7 @@ function Index(props) {
19
25
  isObj = props.isObj;
20
26
  var formContext = React.useContext(MetadataFormContext) || {};
21
27
  var formRefContext = React.useContext(MetadataRefContext);
22
- var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form);
28
+ var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
23
29
 
24
30
  if (isObj && isRefForm && field) {
25
31
  var _extraInfo$disabled;
@@ -1 +1 @@
1
- export declare const useGetExtraInfo: (fields: any, id: string, form: any) => any;
1
+ export declare const useGetExtraInfo: (fields: any, id: string, form: any, type: string) => any;
@@ -1,18 +1,18 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
4
 
5
5
  /*
6
6
  * @Author: your name
7
7
  * @Date: 2021-09-18 14:15:04
8
- * @LastEditTime: 2022-04-02 16:44:45
8
+ * @LastEditTime: 2022-05-05 09:37:02
9
9
  * @LastEditors: Please set LastEditors
10
10
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
11
11
  * @FilePath: \ronds.metadata\src\comps\MetadataForm\hooks\index.tsx
12
12
  */
13
13
  import moment from 'moment';
14
14
  import React from 'react';
15
- export var useGetExtraInfo = function useGetExtraInfo(fields, id, form) {
15
+ export var useGetExtraInfo = function useGetExtraInfo(fields, id, form, type) {
16
16
  var _React$useState = React.useState({}),
17
17
  _React$useState2 = _slicedToArray(_React$useState, 2),
18
18
  extra = _React$useState2[0],
@@ -28,7 +28,12 @@ export var useGetExtraInfo = function useGetExtraInfo(fields, id, form) {
28
28
 
29
29
  for (var k in extraInfo) {
30
30
  _extraInfo[k] = extraInfo[k];
31
- }
31
+ } // 兼容 common公共的属性
32
+
33
+
34
+ _extraInfo = _objectSpread(_objectSpread(_objectSpread({}, _extraInfo), _extraInfo['common']), _extraInfo[type]);
35
+ delete _extraInfo.common;
36
+ delete _extraInfo[type];
32
37
 
33
38
  // 时间格式转化
34
39
  if (_extraInfo.type === 'datePicker' && form.getFieldValue(id)) {
@@ -70,7 +70,7 @@ var MetadataForm = function MetadataForm(props) {
70
70
  }
71
71
  }, [schema]);
72
72
  React.useEffect(function () {
73
- if (refId) {
73
+ if (refId && !schema) {
74
74
  var server = new MetadataService();
75
75
  server.GetMetadataDetailById(refId).then(function (res) {
76
76
  var _schema = JSON.parse(res.schema);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.0.72",
4
+ "version": "1.0.75",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",