ronds-metadata 1.0.78 → 1.0.79

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.
@@ -69,9 +69,13 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
69
69
  res = _context.sent;
70
70
  _schema = JSON.parse(res.schema);
71
71
  _properties = _schema[0].properties;
72
- _properties = _properties.filter(function (it) {
73
- return it.id === 'common' || it.id === type;
74
- });
72
+
73
+ if (_refId === 'com.ronds.schema.default.Rule.Form') {
74
+ _properties = _properties.filter(function (it) {
75
+ return it.id === 'common' || it.id === type;
76
+ });
77
+ }
78
+
75
79
  _schema[0].properties = _properties;
76
80
  _refSchema = refSchema;
77
81
  _refSchema[idx] = _schema;
@@ -92,7 +96,7 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
92
96
 
93
97
  var onRefSelectChange = React.useCallback( /*#__PURE__*/function () {
94
98
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(value, index) {
95
- var _refIds, newData;
99
+ var _refIds, _refSchema, newData;
96
100
 
97
101
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
98
102
  while (1) {
@@ -109,21 +113,24 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
109
113
  return processSpecialRuleData(value, index);
110
114
 
111
115
  case 4:
112
- _context2.next = 8;
116
+ _context2.next = 9;
113
117
  break;
114
118
 
115
119
  case 6:
120
+ _refSchema = refSchema;
121
+ _refSchema[index] = undefined;
122
+ setRefSchema(_objectSpread({}, _refSchema));
123
+
124
+ case 9:
116
125
  _refIds[index] = value;
117
126
  setRefIds(_objectSpread({}, _refIds));
118
-
119
- case 8:
120
127
  newData = form.getFieldValue('fields');
121
128
  newData[index].id = value;
122
129
  form.setFieldsValue({
123
130
  fields: newData
124
131
  });
125
132
 
126
- case 11:
133
+ case 14:
127
134
  case "end":
128
135
  return _context2.stop();
129
136
  }
@@ -152,7 +159,7 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
152
159
  _ruleTypes = ruleTypes;
153
160
 
154
161
  if (!(_defaultValues[0].refId.indexOf('Rule.Form') > -1)) {
155
- _context3.next = 8;
162
+ _context3.next = 6;
156
163
  break;
157
164
  }
158
165
 
@@ -160,21 +167,15 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
160
167
  return processSpecialRuleData(_defaultValues[0].refId, 0);
161
168
 
162
169
  case 6:
163
- _context3.next = 10;
164
- break;
165
-
166
- case 8:
167
170
  _refIds[0] = _defaultValues[0].refId;
168
171
  setRefIds(_objectSpread({}, _refIds));
169
-
170
- case 10:
171
172
  _ruleTypes[0] = 'ref';
172
173
  setRuleTypes(_objectSpread({}, _ruleTypes));
173
174
  form.setFieldsValue({
174
175
  fields: _defaultValues
175
176
  });
176
177
 
177
- case 13:
178
+ case 11:
178
179
  case "end":
179
180
  return _context3.stop();
180
181
  }
@@ -197,19 +198,19 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
197
198
 
198
199
  case 4:
199
200
  if (!(i < defaultValues.length)) {
200
- _context4.next = 16;
201
+ _context4.next = 14;
201
202
  break;
202
203
  }
203
204
 
204
205
  _ruleTypes[i] = defaultValues[i].type;
205
206
 
206
207
  if (!(defaultValues[i].type === 'ref')) {
207
- _context4.next = 13;
208
+ _context4.next = 11;
208
209
  break;
209
210
  }
210
211
 
211
212
  if (!(defaultValues[i].refId.indexOf('Rule.Form') > -1)) {
212
- _context4.next = 12;
213
+ _context4.next = 10;
213
214
  break;
214
215
  }
215
216
 
@@ -217,22 +218,18 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
217
218
  return processSpecialRuleData(defaultValues[i].refId, i);
218
219
 
219
220
  case 10:
220
- _context4.next = 13;
221
- break;
222
-
223
- case 12:
224
221
  _refIds[i] = defaultValues[i].refId;
225
222
 
226
- case 13:
223
+ case 11:
227
224
  i++;
228
225
  _context4.next = 4;
229
226
  break;
230
227
 
231
- case 16:
228
+ case 14:
232
229
  setRefIds(_objectSpread({}, _refIds));
233
230
  setRuleTypes(_objectSpread({}, _ruleTypes));
234
231
 
235
- case 18:
232
+ case 16:
236
233
  case "end":
237
234
  return _context4.stop();
238
235
  }
@@ -8,13 +8,13 @@ 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-05-06 10:49:34
11
+ * @LastEditTime: 2022-05-06 12:08:47
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
- import { renderForm } from '../utils';
17
+ import { getDataCell } from '../utils';
18
18
  import { deepClone } from '../../../utils';
19
19
 
20
20
  function Index(props) {
@@ -93,18 +93,16 @@ function Index(props) {
93
93
  width: '100%',
94
94
  marginBottom: '10px'
95
95
  }
96
- }, /*#__PURE__*/React.createElement(React.Fragment, null, renderForm([{
97
- properties: [_objectSpread(_objectSpread({}, items), {}, {
98
- idx: idx,
99
- id: id
100
- })]
101
- }], {
96
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, getDataCell(_objectSpread(_objectSpread({}, items), {}, {
97
+ idx: idx,
98
+ id: id
99
+ }), {
102
100
  disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
103
101
  initEnumValue: initEnumValue,
104
102
  isRefForm: isRefForm,
105
103
  isShowTypeInfo: formContext.isShowTypeInfo,
106
104
  field: field
107
- }, formContext.stream$), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
105
+ }), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
108
106
  style: {
109
107
  marginLeft: '10px'
110
108
  },
@@ -1,5 +1,5 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
3
  import "antd/es/form/style";
4
4
  import _Form from "antd/es/form";
5
5
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
@@ -48,13 +48,7 @@ var MetadataForm = function MetadataForm(props) {
48
48
  onSelectChange && onSelectChange(p.payload);
49
49
  }
50
50
 
51
- if ((p === null || p === void 0 ? void 0 : p.type) === 'onRenderAfter') {
52
- try {
53
- form.setFieldsValue(_objectSpread({}, initialValues));
54
- } catch (err) {
55
- console.error("error\uFF1A".concat(err));
56
- }
57
- }
51
+ if ((p === null || p === void 0 ? void 0 : p.type) === 'onRenderAfter') {}
58
52
  }, [stream$]);
59
53
  var options = React.useMemo(function () {
60
54
  return {
@@ -103,6 +97,13 @@ var MetadataForm = function MetadataForm(props) {
103
97
 
104
98
  return function () {};
105
99
  }, [mySchma]);
100
+ React.useEffect(function () {
101
+ if (initialValues) {
102
+ setTimeout(function () {
103
+ form.setFieldsValue(_objectSpread({}, initialValues));
104
+ }, 500);
105
+ }
106
+ }, [initialValues]);
106
107
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MetadataFormContext.Provider, {
107
108
  value: {
108
109
  fields: fields,
@@ -5,7 +5,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
5
5
  /*
6
6
  * @Author: wangxian
7
7
  * @Date: 2021-09-18 14:15:04
8
- * @LastEditTime: 2022-05-06 11:18:09
8
+ * @LastEditTime: 2022-05-06 11:24:37
9
9
  */
10
10
  import React from 'react';
11
11
  import Input from './DataCell/Input';
@@ -97,7 +97,7 @@ function hasRenderAfter(_form, stream$) {
97
97
  if (idx === -1) {
98
98
  __count__ = __count__ + 1;
99
99
 
100
- if (__count__ === __ref__.length) {
100
+ if (__count__ === __ref__.length && __ref__.length !== 0) {
101
101
  stream$ && stream$.next({
102
102
  type: 'onRenderAfter',
103
103
  payload: ''
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.0.78",
4
+ "version": "1.0.79",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",