ronds-metadata 1.0.12 → 1.0.16
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.
- package/es/api/index.d.ts +1 -1
- package/es/api/index.js +1 -1
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +6 -2
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +24 -5
- package/es/comps/MetadataEdit/constant/index.d.ts +4 -0
- package/es/comps/MetadataEdit/constant/index.js +13 -0
- package/es/comps/MetadataEdit/index.js +19 -0
- package/es/comps/MetadataForm/DataCell/Ref.js +12 -8
- package/es/comps/MetadataForm/hooks/index.js +4 -5
- package/es/framework/metadata/MetadataService.d.ts +2 -0
- package/es/framework/metadata/MetadataService.js +26 -0
- package/es/framework/metadata/types.d.ts +1 -1
- package/package.json +1 -1
package/es/api/index.d.ts
CHANGED
@@ -14,5 +14,5 @@ export default class Api implements IAPI {
|
|
14
14
|
GetMetadataDetailById(metadataId: string): Promise<any>;
|
15
15
|
/** 添加元数据 */
|
16
16
|
SaveMetadata(data: any, metadataTag: string): Promise<any>;
|
17
|
-
GetMetadataObjList(
|
17
|
+
GetMetadataObjList(data: any): Promise<any[]>;
|
18
18
|
}
|
package/es/api/index.js
CHANGED
@@ -138,7 +138,7 @@ var Api = /*#__PURE__*/function () {
|
|
138
138
|
}, {
|
139
139
|
key: "GetMetadataObjList",
|
140
140
|
value: function () {
|
141
|
-
var _GetMetadataObjList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(
|
141
|
+
var _GetMetadataObjList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
|
142
142
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
143
143
|
while (1) {
|
144
144
|
switch (_context4.prev = _context4.next) {
|
@@ -179,9 +179,13 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
|
|
179
179
|
},
|
180
180
|
onChange: function onChange(value) {
|
181
181
|
var _refIds = refIds;
|
182
|
-
_refIds[index] = value;
|
183
|
-
|
182
|
+
_refIds[index] = value;
|
184
183
|
setRefIds(_objectSpread({}, _refIds));
|
184
|
+
var newData = form.getFieldValue('fields');
|
185
|
+
newData[index].id = value;
|
186
|
+
form.setFieldsValue({
|
187
|
+
fields: newData
|
188
|
+
});
|
185
189
|
},
|
186
190
|
options: metaType || []
|
187
191
|
})), /*#__PURE__*/React.createElement("div", {
|
@@ -14,7 +14,7 @@ import _Input from "antd/es/input";
|
|
14
14
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
15
15
|
import React from 'react';
|
16
16
|
import { MinusCircleOutlined, PlusOutlined, ReloadOutlined } from '@ant-design/icons';
|
17
|
-
import { BASIC_TYPES_OPTIONS, NUMBER_FORMAT_OPTIONS } from '../constant';
|
17
|
+
import { ARRAY_TYPES_OPTIONS, BASIC_TYPES_OPTIONS, NUMBER_FORMAT_OPTIONS } from '../constant';
|
18
18
|
import { useMetaType } from '../hooks';
|
19
19
|
|
20
20
|
var MetaPropsEdit = function MetaPropsEdit(props) {
|
@@ -114,7 +114,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
114
114
|
return (prevValues === null || prevValues === void 0 ? void 0 : (_prevValues$name$inde = prevValues[name][index]) === null || _prevValues$name$inde === void 0 ? void 0 : _prevValues$name$inde.type) !== (currentValues === null || currentValues === void 0 ? void 0 : (_currentValues$name$i = currentValues[name][index]) === null || _currentValues$name$i === void 0 ? void 0 : _currentValues$name$i.type) || (prevValues === null || prevValues === void 0 ? void 0 : (_prevValues$name$inde2 = prevValues[name][index]) === null || _prevValues$name$inde2 === void 0 ? void 0 : _prevValues$name$inde2.items) !== (currentValues === null || currentValues === void 0 ? void 0 : (_currentValues$name$i2 = currentValues[name][index]) === null || _currentValues$name$i2 === void 0 ? void 0 : _currentValues$name$i2.items);
|
115
115
|
}
|
116
116
|
}, function (_ref2) {
|
117
|
-
var _properties$index, _properties$index2, _properties$index2$it;
|
117
|
+
var _properties$index, _properties$index2, _properties$index2$it, _properties$index3, _properties$index3$it;
|
118
118
|
|
119
119
|
var getFieldValue = _ref2.getFieldValue;
|
120
120
|
|
@@ -216,7 +216,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
216
216
|
style: {
|
217
217
|
width: '180px'
|
218
218
|
},
|
219
|
-
options:
|
219
|
+
options: ARRAY_TYPES_OPTIONS
|
220
220
|
})), _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, {
|
221
221
|
label: "Ref",
|
222
222
|
name: [field.name, 'items', 'refId'],
|
@@ -258,7 +258,19 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
258
258
|
}, 100);
|
259
259
|
},
|
260
260
|
icon: /*#__PURE__*/React.createElement(ReloadOutlined, null)
|
261
|
-
})))))
|
261
|
+
})))), _properties && ((_properties$index3 = _properties[index]) === null || _properties$index3 === void 0 ? void 0 : (_properties$index3$it = _properties$index3.items) === null || _properties$index3$it === void 0 ? void 0 : _properties$index3$it.type) === 'number' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
262
|
+
label: "format",
|
263
|
+
name: [field.name, 'items', 'format'],
|
264
|
+
fieldKey: [field.fieldKey, 'items', 'format'],
|
265
|
+
rules: [{
|
266
|
+
required: true
|
267
|
+
}]
|
268
|
+
}), /*#__PURE__*/React.createElement(_Select, {
|
269
|
+
style: {
|
270
|
+
width: '180px'
|
271
|
+
},
|
272
|
+
options: NUMBER_FORMAT_OPTIONS
|
273
|
+
}))));
|
262
274
|
|
263
275
|
case 'enum':
|
264
276
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -307,7 +319,14 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
307
319
|
},
|
308
320
|
block: true,
|
309
321
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
310
|
-
}, "\u6DFB\u52A0".concat(name, "\u540D\u79F0")))
|
322
|
+
}, "\u6DFB\u52A0".concat(name, "\u540D\u79F0"))), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
|
323
|
+
type: "dashed",
|
324
|
+
onClick: function onClick() {
|
325
|
+
onAddFields(-1);
|
326
|
+
},
|
327
|
+
block: true,
|
328
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
329
|
+
}, "\u6DFB\u52A0\u6269\u5C55\u89C4\u5219")));
|
311
330
|
}));
|
312
331
|
};
|
313
332
|
|
@@ -17,6 +17,19 @@ export var BASIC_TYPES_OPTIONS = [{
|
|
17
17
|
label: '引用类型',
|
18
18
|
value: 'ref'
|
19
19
|
}];
|
20
|
+
export var ARRAY_TYPES_OPTIONS = [{
|
21
|
+
label: '数字',
|
22
|
+
value: 'number'
|
23
|
+
}, {
|
24
|
+
label: '文本',
|
25
|
+
value: 'text'
|
26
|
+
}, {
|
27
|
+
label: '布尔类型',
|
28
|
+
value: 'bool'
|
29
|
+
}, {
|
30
|
+
label: '引用类型',
|
31
|
+
value: 'ref'
|
32
|
+
}];
|
20
33
|
export var OUTERMOST_TYPES_OPTIONS = [{
|
21
34
|
label: '对象',
|
22
35
|
value: 'object'
|
@@ -87,11 +87,30 @@ var MetadataEdit = function MetadataEdit(props) {
|
|
87
87
|
}
|
88
88
|
}
|
89
89
|
|
90
|
+
if (fields[values.id]) {
|
91
|
+
_metaSchema.fields = fields[values.id];
|
92
|
+
}
|
93
|
+
|
90
94
|
setMetaSchema(_objectSpread({}, _metaSchema));
|
91
95
|
onFinish && onFinish(JSON.stringify(_metaSchema));
|
92
96
|
};
|
93
97
|
|
94
98
|
var onAddFields = function onAddFields(index) {
|
99
|
+
if (index === -1) {
|
100
|
+
var _id = form.getFieldValue('id');
|
101
|
+
|
102
|
+
if (_id) {
|
103
|
+
setIsFields(true);
|
104
|
+
setCurFields({
|
105
|
+
id: _id
|
106
|
+
});
|
107
|
+
} else {
|
108
|
+
_message.warn('请填写元数据名称');
|
109
|
+
}
|
110
|
+
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
|
95
114
|
var _properties = form.getFieldValue('properties');
|
96
115
|
|
97
116
|
var _curFields = _properties[index];
|
@@ -53,7 +53,7 @@ function Index(props) {
|
|
53
53
|
|
54
54
|
var onSearch = useDebounce( /*#__PURE__*/function () {
|
55
55
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
|
56
|
-
var param, res, _options, i, obj;
|
56
|
+
var param, server, res, _options, i, obj;
|
57
57
|
|
58
58
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
59
59
|
while (1) {
|
@@ -65,16 +65,20 @@ function Index(props) {
|
|
65
65
|
keywords: value
|
66
66
|
},
|
67
67
|
order: []
|
68
|
-
};
|
68
|
+
};
|
69
|
+
server = new MetadataService();
|
70
|
+
_context.next = 4;
|
71
|
+
return server.GetMetadataObjList(param);
|
69
72
|
|
70
|
-
|
73
|
+
case 4:
|
74
|
+
res = _context.sent;
|
71
75
|
_options = [];
|
72
76
|
|
73
|
-
if (res.
|
74
|
-
for (i = 0; i < res.
|
77
|
+
if (res.length > 0) {
|
78
|
+
for (i = 0; i < res.length; i++) {
|
75
79
|
obj = {
|
76
|
-
label: res
|
77
|
-
value: res
|
80
|
+
label: res[i].name,
|
81
|
+
value: res[i].namespace
|
78
82
|
};
|
79
83
|
|
80
84
|
_options.push(obj);
|
@@ -83,7 +87,7 @@ function Index(props) {
|
|
83
87
|
|
84
88
|
setOptions(!value ? [] : _options);
|
85
89
|
|
86
|
-
case
|
90
|
+
case 8:
|
87
91
|
case "end":
|
88
92
|
return _context.stop();
|
89
93
|
}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
3
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
3
|
import React from 'react';
|
5
4
|
export var useGetExtraInfo = function useGetExtraInfo(fields, id, form) {
|
@@ -18,11 +17,11 @@ export var useGetExtraInfo = function useGetExtraInfo(fields, id, form) {
|
|
18
17
|
|
19
18
|
for (var k in extraInfo) {
|
20
19
|
_extraInfo[k] = extraInfo[k];
|
21
|
-
}
|
20
|
+
} // 暂时注释加载默认值
|
21
|
+
// if (_extraInfo?.defaultValue) {
|
22
|
+
// form.setFieldsValue({ [id]: _extraInfo?.defaultValue });
|
23
|
+
// }
|
22
24
|
|
23
|
-
if (_extraInfo === null || _extraInfo === void 0 ? void 0 : _extraInfo.defaultValue) {
|
24
|
-
form.setFieldsValue(_defineProperty({}, id, _extraInfo === null || _extraInfo === void 0 ? void 0 : _extraInfo.defaultValue));
|
25
|
-
}
|
26
25
|
|
27
26
|
setExtra(_objectSpread({}, _extraInfo));
|
28
27
|
}
|
@@ -100,6 +100,32 @@ export var MetadataService = /*#__PURE__*/function () {
|
|
100
100
|
|
101
101
|
return SaveMetadata;
|
102
102
|
}()
|
103
|
+
/** 获取元数据的值 */
|
104
|
+
|
105
|
+
}, {
|
106
|
+
key: "GetMetadataObjList",
|
107
|
+
value: function () {
|
108
|
+
var _GetMetadataObjList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
|
109
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
110
|
+
while (1) {
|
111
|
+
switch (_context4.prev = _context4.next) {
|
112
|
+
case 0:
|
113
|
+
return _context4.abrupt("return", this.api.GetMetadataObjList(data));
|
114
|
+
|
115
|
+
case 1:
|
116
|
+
case "end":
|
117
|
+
return _context4.stop();
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}, _callee4, this);
|
121
|
+
}));
|
122
|
+
|
123
|
+
function GetMetadataObjList(_x5) {
|
124
|
+
return _GetMetadataObjList.apply(this, arguments);
|
125
|
+
}
|
126
|
+
|
127
|
+
return GetMetadataObjList;
|
128
|
+
}()
|
103
129
|
}]);
|
104
130
|
|
105
131
|
return MetadataService;
|