ronds-metadata 1.0.7 → 1.0.12
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 +2 -2
- package/es/api/index.js +21 -9
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +3 -2
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +32 -2
- package/es/comps/MetadataEdit/hooks/index.js +12 -7
- package/es/comps/MetadataEdit/index.d.ts +4 -0
- package/es/comps/MetadataEdit/index.js +4 -1
- package/es/comps/MetadataForm/DataCell/Array.js +3 -4
- package/es/comps/MetadataForm/DataCell/Input.js +4 -6
- package/es/comps/MetadataForm/DataCell/Number.js +3 -4
- package/es/comps/MetadataForm/DataCell/Ref.js +19 -17
- package/es/comps/MetadataForm/DataCell/Select.js +3 -4
- package/es/comps/MetadataForm/DataCell/Switch.js +3 -4
- package/es/comps/MetadataForm/HOC/index.js +3 -2
- package/es/comps/MetadataForm/index.d.ts +5 -1
- package/es/comps/MetadataForm/index.js +8 -5
- package/es/comps/MetadataForm/interface.d.ts +1 -0
- package/es/comps/MetadataForm/utils.d.ts +2 -2
- package/es/comps/MetadataForm/utils.js +4 -3
- package/es/framework/http/index.d.ts +1 -1
- package/es/framework/http/index.js +3 -2
- package/es/framework/metadata/MetadataService.d.ts +1 -1
- package/es/framework/metadata/MetadataService.js +1 -1
- package/es/framework/metadata/index.d.ts +1 -1
- package/es/framework/metadata/types.d.ts +87 -87
- package/package.json +1 -1
package/es/api/index.d.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import { IAPI } from '
|
1
|
+
import { IAPI } from '../framework/metadata/types';
|
2
2
|
export default class Api implements IAPI {
|
3
3
|
/**
|
4
4
|
* 获取元数据列表
|
5
5
|
* @param keyWords
|
6
6
|
* @returns
|
7
7
|
*/
|
8
|
-
GetMetadataList(keyWords?: string): Promise<any>;
|
8
|
+
GetMetadataList(keyWords?: string[]): Promise<any>;
|
9
9
|
/**
|
10
10
|
* 通过元数据Id获取元数据详情
|
11
11
|
* @param metadataId
|
package/es/api/index.js
CHANGED
@@ -2,7 +2,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
4
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
5
|
-
import { HttpHelper } from '
|
5
|
+
import { HttpHelper } from '../framework/http';
|
6
6
|
var http = new HttpHelper();
|
7
7
|
|
8
8
|
var Api = /*#__PURE__*/function () {
|
@@ -20,20 +20,31 @@ var Api = /*#__PURE__*/function () {
|
|
20
20
|
*/
|
21
21
|
function () {
|
22
22
|
var _GetMetadataList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(keyWords) {
|
23
|
-
var url, res;
|
23
|
+
var param, url, res;
|
24
24
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
25
25
|
while (1) {
|
26
26
|
switch (_context.prev = _context.next) {
|
27
27
|
case 0:
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
param = {
|
29
|
+
filter: {
|
30
|
+
name: '',
|
31
|
+
tags: keyWords
|
32
|
+
},
|
33
|
+
order: [],
|
34
|
+
pagination: {
|
35
|
+
page: 1,
|
36
|
+
size: 30
|
37
|
+
}
|
38
|
+
};
|
39
|
+
url = "/metadata/list";
|
40
|
+
_context.next = 4;
|
41
|
+
return http.post(url, param);
|
31
42
|
|
32
|
-
case
|
43
|
+
case 4:
|
33
44
|
res = _context.sent;
|
34
45
|
return _context.abrupt("return", res.data);
|
35
46
|
|
36
|
-
case
|
47
|
+
case 6:
|
37
48
|
case "end":
|
38
49
|
return _context.stop();
|
39
50
|
}
|
@@ -96,9 +107,10 @@ var Api = /*#__PURE__*/function () {
|
|
96
107
|
switch (_context3.prev = _context3.next) {
|
97
108
|
case 0:
|
98
109
|
param = {
|
99
|
-
|
110
|
+
schema: JSON.stringify([data]),
|
100
111
|
name: data.id,
|
101
|
-
|
112
|
+
tags: [metadataTag],
|
113
|
+
permission: 'public'
|
102
114
|
};
|
103
115
|
url = "/metadata";
|
104
116
|
_context3.next = 4;
|
@@ -13,11 +13,11 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
13
13
|
import "antd/es/form/style";
|
14
14
|
import _Form from "antd/es/form";
|
15
15
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
16
|
-
import MetadataForm from '@/comps/MetadataForm';
|
17
16
|
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
18
17
|
import React from 'react';
|
19
18
|
import { RULE_TYPES_OPTIONS } from '../constant';
|
20
19
|
import { useMetaType } from '../hooks';
|
20
|
+
import MetadataForm from '../../MetadataForm';
|
21
21
|
|
22
22
|
var MetaFieldsEdit = function MetaFieldsEdit(props) {
|
23
23
|
var defaultValues = props.defaultValues,
|
@@ -179,7 +179,8 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
|
|
179
179
|
},
|
180
180
|
onChange: function onChange(value) {
|
181
181
|
var _refIds = refIds;
|
182
|
-
_refIds[index] = value;
|
182
|
+
_refIds[index] = value; // form.setFieldsValue({ id: value });
|
183
|
+
|
183
184
|
setRefIds(_objectSpread({}, _refIds));
|
184
185
|
},
|
185
186
|
options: metaType || []
|
@@ -201,7 +201,8 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
201
201
|
borderRadius: '5px',
|
202
202
|
padding: '10px',
|
203
203
|
marginBottom: '10px',
|
204
|
-
display: 'flex'
|
204
|
+
display: 'flex',
|
205
|
+
alignItems: 'center'
|
205
206
|
}
|
206
207
|
}, /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
207
208
|
label: "Array",
|
@@ -228,7 +229,36 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
228
229
|
width: '180px'
|
229
230
|
},
|
230
231
|
options: metaType || []
|
231
|
-
}))
|
232
|
+
})), /*#__PURE__*/React.createElement("div", {
|
233
|
+
style: {
|
234
|
+
padding: '0 10px'
|
235
|
+
}
|
236
|
+
}, /*#__PURE__*/React.createElement(_Tooltip, {
|
237
|
+
title: "\u6DFB\u52A0\u5F15\u7528\u7C7B\u578B"
|
238
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
239
|
+
shape: "circle",
|
240
|
+
size: "small",
|
241
|
+
type: "primary",
|
242
|
+
onClick: function onClick() {
|
243
|
+
onNewRefClick && onNewRefClick();
|
244
|
+
},
|
245
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
246
|
+
})), /*#__PURE__*/React.createElement(_Tooltip, {
|
247
|
+
title: "\u5237\u65B0"
|
248
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
249
|
+
shape: "circle",
|
250
|
+
size: "small",
|
251
|
+
style: {
|
252
|
+
marginLeft: '10px'
|
253
|
+
},
|
254
|
+
onClick: function onClick() {
|
255
|
+
setRefresh(false);
|
256
|
+
setTimeout(function () {
|
257
|
+
setRefresh(true);
|
258
|
+
}, 100);
|
259
|
+
},
|
260
|
+
icon: /*#__PURE__*/React.createElement(ReloadOutlined, null)
|
261
|
+
})))));
|
232
262
|
|
233
263
|
case 'enum':
|
234
264
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -12,16 +12,21 @@ export var useMetaType = function useMetaType(tag) {
|
|
12
12
|
React.useEffect(function () {
|
13
13
|
if (isFresh) {
|
14
14
|
var service = new MetadataService();
|
15
|
-
|
15
|
+
|
16
|
+
var _tag = tag ? [tag] : [];
|
17
|
+
|
18
|
+
service.GetMetadataList(_tag).then(function (res) {
|
16
19
|
var _metaType = [];
|
17
20
|
|
18
|
-
|
19
|
-
var
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
if (res) {
|
22
|
+
for (var i = 0; i < res.length; i++) {
|
23
|
+
var obj = {
|
24
|
+
label: res[i].name,
|
25
|
+
value: res[i].id
|
26
|
+
};
|
23
27
|
|
24
|
-
|
28
|
+
_metaType.push(obj);
|
29
|
+
}
|
25
30
|
}
|
26
31
|
|
27
32
|
setMetaType([].concat(_metaType));
|
@@ -20,6 +20,7 @@ import { OUTERMOST_TYPES_OPTIONS } from './constant';
|
|
20
20
|
|
21
21
|
var MetadataEdit = function MetadataEdit(props) {
|
22
22
|
var initialValues = props.initialValues,
|
23
|
+
isNameDisabled = props.isNameDisabled,
|
23
24
|
metadataTag = props.metadataTag,
|
24
25
|
onFinish = props.onFinish,
|
25
26
|
onNewRefClick = props.onNewRefClick;
|
@@ -137,7 +138,9 @@ var MetadataEdit = function MetadataEdit(props) {
|
|
137
138
|
rules: [{
|
138
139
|
required: true
|
139
140
|
}]
|
140
|
-
}, /*#__PURE__*/React.createElement(_Input,
|
141
|
+
}, /*#__PURE__*/React.createElement(_Input, {
|
142
|
+
disabled: isNameDisabled
|
143
|
+
})), /*#__PURE__*/React.createElement(_Form.Item, {
|
141
144
|
label: "\u7C7B\u578B",
|
142
145
|
name: "type",
|
143
146
|
style: {
|
@@ -12,7 +12,6 @@ import { getDataCell } from '../utils';
|
|
12
12
|
|
13
13
|
function Index(props) {
|
14
14
|
var id = props.id,
|
15
|
-
require = props.require,
|
16
15
|
items = props.items,
|
17
16
|
isRefForm = props.isRefForm,
|
18
17
|
disabled = props.disabled;
|
@@ -38,8 +37,8 @@ function Index(props) {
|
|
38
37
|
}, /*#__PURE__*/React.createElement("div", {
|
39
38
|
className: "ant-form-item-label mt-1"
|
40
39
|
}, /*#__PURE__*/React.createElement("label", {
|
41
|
-
className: "".concat(require && 'ant-form-item-required')
|
42
|
-
}, extraInfo.label || id)), /*#__PURE__*/React.createElement("div", {
|
40
|
+
className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
|
41
|
+
}, extraInfo.label || id)), formContext.isShowTypeInfo && /*#__PURE__*/React.createElement("div", {
|
43
42
|
style: {
|
44
43
|
padding: '0 6px',
|
45
44
|
position: 'absolute',
|
@@ -72,7 +71,7 @@ function Index(props) {
|
|
72
71
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, getDataCell(_objectSpread(_objectSpread({}, items), {}, {
|
73
72
|
idx: idx,
|
74
73
|
id: id
|
75
|
-
}), (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled, isRefForm, field), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
|
74
|
+
}), (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled, isRefForm, formContext.isShowTypeInfo, field), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
|
76
75
|
style: {
|
77
76
|
marginLeft: '10px'
|
78
77
|
},
|
@@ -17,7 +17,6 @@ var TextArea = _Input.TextArea;
|
|
17
17
|
|
18
18
|
function Index(props) {
|
19
19
|
var id = props.id,
|
20
|
-
require = props.require,
|
21
20
|
isRefForm = props.isRefForm,
|
22
21
|
disabled = props.disabled,
|
23
22
|
field = props.field,
|
@@ -65,8 +64,7 @@ function Index(props) {
|
|
65
64
|
}, /*#__PURE__*/React.createElement(_Input, {
|
66
65
|
value: color,
|
67
66
|
disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
|
68
|
-
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
|
69
|
-
allowClear: true
|
67
|
+
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
|
70
68
|
}), /*#__PURE__*/React.createElement("div", {
|
71
69
|
style: {
|
72
70
|
position: 'absolute',
|
@@ -97,7 +95,7 @@ function Index(props) {
|
|
97
95
|
name: [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
|
98
96
|
fieldKey: [field === null || field === void 0 ? void 0 : field.fieldKey],
|
99
97
|
rules: [{
|
100
|
-
required: require
|
98
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
101
99
|
}],
|
102
100
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
103
101
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -108,7 +106,7 @@ function Index(props) {
|
|
108
106
|
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
109
107
|
name: name,
|
110
108
|
rules: [{
|
111
|
-
required: require
|
109
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
112
110
|
}],
|
113
111
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
114
112
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -120,7 +118,7 @@ function Index(props) {
|
|
120
118
|
name: [field === null || field === void 0 ? void 0 : field.name],
|
121
119
|
fieldKey: [field === null || field === void 0 ? void 0 : field.fieldKey],
|
122
120
|
rules: [{
|
123
|
-
required: require
|
121
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
124
122
|
}],
|
125
123
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
126
124
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -14,7 +14,6 @@ function Index(props) {
|
|
14
14
|
var id = props.id,
|
15
15
|
name = props.name,
|
16
16
|
isRefForm = props.isRefForm,
|
17
|
-
require = props.require,
|
18
17
|
disabled = props.disabled,
|
19
18
|
field = props.field,
|
20
19
|
isObj = props.isObj;
|
@@ -34,7 +33,7 @@ function Index(props) {
|
|
34
33
|
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
35
34
|
fieldKey: [field === null || field === void 0 ? void 0 : field.fieldKey],
|
36
35
|
rules: [{
|
37
|
-
required: require
|
36
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
38
37
|
}],
|
39
38
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
40
39
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -48,7 +47,7 @@ function Index(props) {
|
|
48
47
|
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
49
48
|
name: name,
|
50
49
|
rules: [{
|
51
|
-
required: require
|
50
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
52
51
|
}],
|
53
52
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
54
53
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -63,7 +62,7 @@ function Index(props) {
|
|
63
62
|
name: [field === null || field === void 0 ? void 0 : field.name],
|
64
63
|
fieldKey: [field === null || field === void 0 ? void 0 : field.fieldKey],
|
65
64
|
rules: [{
|
66
|
-
required: require
|
65
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
67
66
|
}],
|
68
67
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
69
68
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -9,12 +9,12 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
9
9
|
import "antd/es/select/style";
|
10
10
|
import _Select from "antd/es/select";
|
11
11
|
import React from 'react';
|
12
|
-
import { useDebounce } from '
|
13
|
-
import { MetadataService } from '
|
12
|
+
import { useDebounce } from '../../../utils';
|
13
|
+
import { MetadataService } from '../../../framework/metadata/MetadataService';
|
14
14
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
15
15
|
import { useGetExtraInfo } from '../hooks';
|
16
16
|
import { renderForm } from '../utils';
|
17
|
-
import { JsonMetadataProvider } from '
|
17
|
+
import { JsonMetadataProvider } from '../../../framework/metadata';
|
18
18
|
var Option = _Select.Option;
|
19
19
|
|
20
20
|
function Index(props) {
|
@@ -22,7 +22,6 @@ function Index(props) {
|
|
22
22
|
|
23
23
|
var id = props.id,
|
24
24
|
idx = props.idx,
|
25
|
-
require = props.require,
|
26
25
|
refId = props.refId,
|
27
26
|
disabled = props.disabled,
|
28
27
|
isRefForm = props.isRefForm,
|
@@ -101,14 +100,17 @@ function Index(props) {
|
|
101
100
|
var server = new MetadataService();
|
102
101
|
server.GetMetadataDetailById(refId).then(function (res) {
|
103
102
|
var provider = new JsonMetadataProvider();
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
103
|
+
|
104
|
+
if (res === null || res === void 0 ? void 0 : res.schema) {
|
105
|
+
var mySchema = JSON.parse(res.schema);
|
106
|
+
provider.add_types(mySchema);
|
107
|
+
var FormCls = provider.get_type(mySchema[0].id);
|
108
|
+
var formCls = new FormCls();
|
109
|
+
var _fields = formCls.__type__.__fields__;
|
110
|
+
refFieldsRef.current = _fields;
|
111
|
+
setRefFields(_objectSpread({}, _fields));
|
112
|
+
setSchema(_toConsumableArray(mySchema));
|
113
|
+
}
|
112
114
|
});
|
113
115
|
}
|
114
116
|
}, [refId]);
|
@@ -150,7 +152,7 @@ function Index(props) {
|
|
150
152
|
textAlign: 'left'
|
151
153
|
}
|
152
154
|
}, /*#__PURE__*/React.createElement("label", {
|
153
|
-
className: "".concat(require && 'ant-form-item-required')
|
155
|
+
className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
|
154
156
|
}, extraInfo.label || id)), /*#__PURE__*/React.createElement("div", {
|
155
157
|
style: {
|
156
158
|
padding: '10px',
|
@@ -162,7 +164,7 @@ function Index(props) {
|
|
162
164
|
value: {
|
163
165
|
fields: refFieldsRef.current
|
164
166
|
}
|
165
|
-
}, renderForm(schema, disabled, true, [id], undefined, true))));
|
167
|
+
}, renderForm(schema, disabled, true, formContext.isShowTypeInfo, [id], undefined, true))));
|
166
168
|
}
|
167
169
|
|
168
170
|
if (isRefForm && field && schema) {
|
@@ -177,14 +179,14 @@ function Index(props) {
|
|
177
179
|
value: {
|
178
180
|
fields: refFieldsRef.current
|
179
181
|
}
|
180
|
-
}, renderForm(schema, disabled, true, [id], field, true))));
|
182
|
+
}, renderForm(schema, disabled, true, formContext.isShowTypeInfo, [id], field, true))));
|
181
183
|
}
|
182
184
|
|
183
185
|
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
184
186
|
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
185
187
|
name: id,
|
186
188
|
rules: [{
|
187
|
-
required: require
|
189
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
188
190
|
}],
|
189
191
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
190
192
|
tooltip: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip) || help
|
@@ -212,7 +214,7 @@ function Index(props) {
|
|
212
214
|
name: [field === null || field === void 0 ? void 0 : field.name],
|
213
215
|
fieldKey: [field === null || field === void 0 ? void 0 : field.fieldKey],
|
214
216
|
rules: [{
|
215
|
-
required: require
|
217
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
216
218
|
}],
|
217
219
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
218
220
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -14,7 +14,6 @@ function Index(props) {
|
|
14
14
|
var id = props.id,
|
15
15
|
name = props.name,
|
16
16
|
isRefForm = props.isRefForm,
|
17
|
-
require = props.require,
|
18
17
|
disabled = props.disabled,
|
19
18
|
field = props.field,
|
20
19
|
isObj = props.isObj;
|
@@ -50,7 +49,7 @@ function Index(props) {
|
|
50
49
|
name: [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
|
51
50
|
fieldKey: [field === null || field === void 0 ? void 0 : field.fieldKey],
|
52
51
|
rules: [{
|
53
|
-
required: require
|
52
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
54
53
|
}],
|
55
54
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
56
55
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -67,7 +66,7 @@ function Index(props) {
|
|
67
66
|
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
68
67
|
name: name,
|
69
68
|
rules: [{
|
70
|
-
required: require
|
69
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
71
70
|
}],
|
72
71
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
73
72
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -85,7 +84,7 @@ function Index(props) {
|
|
85
84
|
name: [field === null || field === void 0 ? void 0 : field.name],
|
86
85
|
fieldKey: [field === null || field === void 0 ? void 0 : field.fieldKey],
|
87
86
|
rules: [{
|
88
|
-
required: require
|
87
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
89
88
|
}],
|
90
89
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
91
90
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -14,7 +14,6 @@ function Index(props) {
|
|
14
14
|
var id = props.id,
|
15
15
|
name = props.name,
|
16
16
|
isRefForm = props.isRefForm,
|
17
|
-
require = props.require,
|
18
17
|
disabled = props.disabled,
|
19
18
|
field = props.field,
|
20
19
|
isObj = props.isObj;
|
@@ -35,7 +34,7 @@ function Index(props) {
|
|
35
34
|
valuePropName: "checked",
|
36
35
|
fieldKey: [field === null || field === void 0 ? void 0 : field.fieldKey],
|
37
36
|
rules: [{
|
38
|
-
required: require
|
37
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
39
38
|
}],
|
40
39
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
41
40
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -51,7 +50,7 @@ function Index(props) {
|
|
51
50
|
name: name,
|
52
51
|
valuePropName: "checked",
|
53
52
|
rules: [{
|
54
|
-
required: require
|
53
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
55
54
|
}],
|
56
55
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
57
56
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -68,7 +67,7 @@ function Index(props) {
|
|
68
67
|
valuePropName: "checked",
|
69
68
|
fieldKey: [field === null || field === void 0 ? void 0 : field.fieldKey],
|
70
69
|
rules: [{
|
71
|
-
required: require
|
70
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
72
71
|
}],
|
73
72
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
74
73
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
-
import { deepClone } from '@/utils';
|
4
3
|
import React from 'react';
|
4
|
+
import { deepClone } from '../../../utils';
|
5
5
|
import "./index.css";
|
6
6
|
export function withAddOnAfter(WrappedComponent) {
|
7
7
|
return function (props) {
|
8
8
|
var type = props.type,
|
9
9
|
refId = props.refId,
|
10
|
+
isShowTypeInfo = props.isShowTypeInfo,
|
10
11
|
field = props.field,
|
11
12
|
id = props.id,
|
12
13
|
_props$name = props.name,
|
@@ -45,7 +46,7 @@ export function withAddOnAfter(WrappedComponent) {
|
|
45
46
|
}, props, {
|
46
47
|
name: _name,
|
47
48
|
isObj: isObj
|
48
|
-
})), !field && type !== 'number' && type !== 'bool' && /*#__PURE__*/React.createElement("div", {
|
49
|
+
})), isShowTypeInfo && !field && type !== 'number' && type !== 'bool' && /*#__PURE__*/React.createElement("div", {
|
49
50
|
className: "with-add-on-after-extra"
|
50
51
|
}, help !== null && help !== void 0 ? help : type));
|
51
52
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { FormInstance } from 'antd/lib/form/hooks/useForm';
|
2
2
|
import './index.less';
|
3
|
-
import { IMetaData } from '
|
3
|
+
import { IMetaData } from '../../framework/metadata/types';
|
4
4
|
interface IMetadataFormProps {
|
5
5
|
/**
|
6
6
|
* 通过元数据JsonShema渲染表单
|
@@ -10,6 +10,10 @@ interface IMetadataFormProps {
|
|
10
10
|
* 通过元数据Id渲染表单
|
11
11
|
*/
|
12
12
|
refId?: string;
|
13
|
+
/**
|
14
|
+
* 是否展示类型得提示信息
|
15
|
+
*/
|
16
|
+
isShowTypeInfo?: boolean;
|
13
17
|
/**
|
14
18
|
* 初始化值
|
15
19
|
*/
|
@@ -6,8 +6,8 @@ import React from 'react';
|
|
6
6
|
import { renderForm } from './utils';
|
7
7
|
import "./index.css";
|
8
8
|
import { MetadataFormContext } from './interface';
|
9
|
-
import { JsonMetadataProvider } from '
|
10
|
-
import { MetadataService } from '
|
9
|
+
import { JsonMetadataProvider } from '../../framework/metadata';
|
10
|
+
import { MetadataService } from '../../framework/metadata/MetadataService';
|
11
11
|
|
12
12
|
var MetadataForm = function MetadataForm(props) {
|
13
13
|
var _Form$useForm = _Form.useForm(),
|
@@ -21,6 +21,8 @@ var MetadataForm = function MetadataForm(props) {
|
|
21
21
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
22
22
|
_props$isRefForm = props.isRefForm,
|
23
23
|
isRefForm = _props$isRefForm === void 0 ? true : _props$isRefForm,
|
24
|
+
_props$isShowTypeInfo = props.isShowTypeInfo,
|
25
|
+
isShowTypeInfo = _props$isShowTypeInfo === void 0 ? false : _props$isShowTypeInfo,
|
24
26
|
onFinish = props.onFinish,
|
25
27
|
getFormInstance = props.getFormInstance,
|
26
28
|
onValuesChange = props.onValuesChange;
|
@@ -53,7 +55,7 @@ var MetadataForm = function MetadataForm(props) {
|
|
53
55
|
if (refId) {
|
54
56
|
var server = new MetadataService();
|
55
57
|
server.GetMetadataDetailById(refId).then(function (res) {
|
56
|
-
var _schema = JSON.parse(res.
|
58
|
+
var _schema = JSON.parse(res.schema);
|
57
59
|
|
58
60
|
setMySchema(_toConsumableArray(_schema));
|
59
61
|
});
|
@@ -73,7 +75,8 @@ var MetadataForm = function MetadataForm(props) {
|
|
73
75
|
value: {
|
74
76
|
fields: fields,
|
75
77
|
form: form,
|
76
|
-
initialValues: initialValues
|
78
|
+
initialValues: initialValues,
|
79
|
+
isShowTypeInfo: isShowTypeInfo
|
77
80
|
}
|
78
81
|
}, /*#__PURE__*/React.createElement(_Form, {
|
79
82
|
className: "metadata-form",
|
@@ -87,7 +90,7 @@ var MetadataForm = function MetadataForm(props) {
|
|
87
90
|
initialValues: initialValues,
|
88
91
|
onFinish: onFinish,
|
89
92
|
onValuesChange: onValuesChange
|
90
|
-
}, renderForm(mySchma, disabled, isRefForm, undefined))));
|
93
|
+
}, renderForm(mySchma, disabled, isRefForm, isShowTypeInfo, undefined))));
|
91
94
|
};
|
92
95
|
|
93
96
|
export default MetadataForm;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
export declare function getDataCell(item: any, disabled: boolean, isRefForm: boolean, field?: any, pName?: string[], isObj?: boolean): JSX.Element;
|
1
|
+
export declare function getDataCell(item: any, disabled: boolean, isRefForm: boolean, isShowTypeInfo: boolean, field?: any, pName?: string[], isObj?: boolean): JSX.Element;
|
2
2
|
/**
|
3
3
|
* 渲染表单
|
4
4
|
* @param schemaRef
|
5
5
|
* @returns
|
6
6
|
*/
|
7
|
-
export declare function renderForm(schemaRef: any[], disabled: boolean, isRefForm: boolean, pName: string[], field?: any, isObj?: boolean): JSX.Element;
|
7
|
+
export declare function renderForm(schemaRef: any[], disabled: boolean, isRefForm: boolean, isShowTypeInfo: boolean, pName: string[], field?: any, isObj?: boolean): JSX.Element;
|
@@ -17,12 +17,13 @@ var DataCellMap = {
|
|
17
17
|
array: Array,
|
18
18
|
ref: withAddOnAfter(Ref)
|
19
19
|
};
|
20
|
-
export function getDataCell(item, disabled, isRefForm, field, pName, isObj) {
|
20
|
+
export function getDataCell(item, disabled, isRefForm, isShowTypeInfo, field, pName, isObj) {
|
21
21
|
if (item.type && DataCellMap[item.type]) {
|
22
22
|
var Comm = DataCellMap[item.type];
|
23
23
|
return /*#__PURE__*/React.createElement(Comm, _extends({}, item, {
|
24
24
|
disabled: disabled,
|
25
25
|
isRefForm: isRefForm,
|
26
|
+
isShowTypeInfo: isShowTypeInfo,
|
26
27
|
field: field,
|
27
28
|
name: pName,
|
28
29
|
isObj: isObj
|
@@ -37,14 +38,14 @@ export function getDataCell(item, disabled, isRefForm, field, pName, isObj) {
|
|
37
38
|
* @returns
|
38
39
|
*/
|
39
40
|
|
40
|
-
export function renderForm(schemaRef, disabled, isRefForm, pName, field, isObj) {
|
41
|
+
export function renderForm(schemaRef, disabled, isRefForm, isShowTypeInfo, pName, field, isObj) {
|
41
42
|
if (schemaRef.length === 0) return /*#__PURE__*/React.createElement(_Spin, null);
|
42
43
|
var _schema = schemaRef[0];
|
43
44
|
var _properties = _schema.properties;
|
44
45
|
var _form = [];
|
45
46
|
|
46
47
|
for (var i = 0; i < _properties.length; i++) {
|
47
|
-
_form.push(getDataCell(_properties[i], disabled, isRefForm, field, pName, isObj));
|
48
|
+
_form.push(getDataCell(_properties[i], disabled, isRefForm, isShowTypeInfo, field, pName, isObj));
|
48
49
|
}
|
49
50
|
|
50
51
|
return /*#__PURE__*/React.createElement(React.Fragment, null, _form);
|
@@ -25,7 +25,7 @@ export declare class HttpHelper {
|
|
25
25
|
private interceptorInit;
|
26
26
|
private _http;
|
27
27
|
constructor(client?: AxiosInstance);
|
28
|
-
get<T = any>(url: string, params?: any, options?: HttpOption): Promise<BaseResData<T>>;
|
28
|
+
get<T = any>(url: string, data?: any, params?: any, options?: HttpOption): Promise<BaseResData<T>>;
|
29
29
|
post<T = any>(url: string, data?: any, params?: any, options?: HttpOption): Promise<BaseResData<T>>;
|
30
30
|
put<T = any>(url: string, data?: any, params?: any, options?: HttpOption): Promise<BaseResData<T>>;
|
31
31
|
delete<T = any>(url: string, params?: any, options?: HttpOption): Promise<BaseResData<T>>;
|
@@ -223,10 +223,11 @@ export var HttpHelper = /*#__PURE__*/function () {
|
|
223
223
|
|
224
224
|
_createClass(HttpHelper, [{
|
225
225
|
key: "get",
|
226
|
-
value: function get(url, params, options) {
|
226
|
+
value: function get(url, data, params, options) {
|
227
227
|
return this.fetch(url, _objectSpread({
|
228
228
|
params: params,
|
229
|
-
method: 'get'
|
229
|
+
method: 'get',
|
230
|
+
data: data
|
230
231
|
}, options));
|
231
232
|
}
|
232
233
|
}, {
|
@@ -2,7 +2,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
4
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
5
|
-
import Api from '
|
5
|
+
import Api from '../../api';
|
6
6
|
var globalAPI = new Api();
|
7
7
|
export var registerMetadataAPI = function registerMetadataAPI(api) {
|
8
8
|
globalAPI = api;
|
@@ -1,87 +1,87 @@
|
|
1
|
-
export type IMetaType = 'object' | 'ref' | 'bool' | 'number' | 'text' | 'enum' | 'array';
|
2
|
-
|
3
|
-
export type IMetaData = {
|
4
|
-
/**
|
5
|
-
* 类名称/属性名称
|
6
|
-
*/
|
7
|
-
id: string;
|
8
|
-
/**
|
9
|
-
* 类型
|
10
|
-
*/
|
11
|
-
type: IMetaType;
|
12
|
-
/**
|
13
|
-
* 属性
|
14
|
-
*/
|
15
|
-
properties?: IMetaProperties[];
|
16
|
-
|
17
|
-
/**
|
18
|
-
* 引用id
|
19
|
-
*/
|
20
|
-
refId?: string;
|
21
|
-
/**
|
22
|
-
* 静态的变量
|
23
|
-
*/
|
24
|
-
fields?: IMetaFileds[];
|
25
|
-
};
|
26
|
-
|
27
|
-
export type IMetaProperties = {
|
28
|
-
/**
|
29
|
-
* 类规则名称
|
30
|
-
*/
|
31
|
-
id: string;
|
32
|
-
|
33
|
-
/**
|
34
|
-
* 类型
|
35
|
-
*/
|
36
|
-
type: IMetaType;
|
37
|
-
|
38
|
-
/**
|
39
|
-
* 引用id
|
40
|
-
*/
|
41
|
-
refId?: string;
|
42
|
-
/**
|
43
|
-
* 静态的变量
|
44
|
-
*/
|
45
|
-
fields?: IMetaFileds[];
|
46
|
-
/**
|
47
|
-
* 枚举值
|
48
|
-
*/
|
49
|
-
enum?: { value: string }[];
|
50
|
-
/**
|
51
|
-
* 数组类型
|
52
|
-
*/
|
53
|
-
items?: { type:
|
54
|
-
};
|
55
|
-
|
56
|
-
export type IMetaFileds = {
|
57
|
-
/**
|
58
|
-
* 规则名称
|
59
|
-
*/
|
60
|
-
id: string;
|
61
|
-
|
62
|
-
/**
|
63
|
-
* 类型
|
64
|
-
*/
|
65
|
-
type: IMetaType;
|
66
|
-
|
67
|
-
/**
|
68
|
-
* 引用id
|
69
|
-
*/
|
70
|
-
refId?: string;
|
71
|
-
|
72
|
-
/**
|
73
|
-
* 规则值
|
74
|
-
*/
|
75
|
-
value: any;
|
76
|
-
};
|
77
|
-
|
78
|
-
export interface IAPI {
|
79
|
-
// 获取元数据列表
|
80
|
-
GetMetadataList(keyWords?: string): Promise<{ id: string; name: string; schema: string }[]>;
|
81
|
-
// 通过元数据Id获取元数据详情
|
82
|
-
GetMetadataDetailById(metadataId: string): Promise<any>;
|
83
|
-
// 新增元数据
|
84
|
-
SaveMetadata(data: any, metadataTag: string): Promise<any>;
|
85
|
-
// 获取元数据的值
|
86
|
-
GetMetadataObjList(metadataId): Promise<any[]>;
|
87
|
-
}
|
1
|
+
export type IMetaType = 'object' | 'ref' | 'bool' | 'number' | 'text' | 'enum' | 'array' | string;
|
2
|
+
|
3
|
+
export type IMetaData = {
|
4
|
+
/**
|
5
|
+
* 类名称/属性名称
|
6
|
+
*/
|
7
|
+
id: string;
|
8
|
+
/**
|
9
|
+
* 类型
|
10
|
+
*/
|
11
|
+
type: IMetaType;
|
12
|
+
/**
|
13
|
+
* 属性
|
14
|
+
*/
|
15
|
+
properties?: IMetaProperties[];
|
16
|
+
|
17
|
+
/**
|
18
|
+
* 引用id
|
19
|
+
*/
|
20
|
+
refId?: string;
|
21
|
+
/**
|
22
|
+
* 静态的变量
|
23
|
+
*/
|
24
|
+
fields?: IMetaFileds[];
|
25
|
+
};
|
26
|
+
|
27
|
+
export type IMetaProperties = {
|
28
|
+
/**
|
29
|
+
* 类规则名称
|
30
|
+
*/
|
31
|
+
id: string;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* 类型
|
35
|
+
*/
|
36
|
+
type: IMetaType;
|
37
|
+
|
38
|
+
/**
|
39
|
+
* 引用id
|
40
|
+
*/
|
41
|
+
refId?: string;
|
42
|
+
/**
|
43
|
+
* 静态的变量
|
44
|
+
*/
|
45
|
+
fields?: IMetaFileds[];
|
46
|
+
/**
|
47
|
+
* 枚举值
|
48
|
+
*/
|
49
|
+
enum?: { value: string }[];
|
50
|
+
/**
|
51
|
+
* 数组类型
|
52
|
+
*/
|
53
|
+
items?: { type: IMetaType; refId?: string };
|
54
|
+
};
|
55
|
+
|
56
|
+
export type IMetaFileds = {
|
57
|
+
/**
|
58
|
+
* 规则名称
|
59
|
+
*/
|
60
|
+
id: string;
|
61
|
+
|
62
|
+
/**
|
63
|
+
* 类型
|
64
|
+
*/
|
65
|
+
type: IMetaType;
|
66
|
+
|
67
|
+
/**
|
68
|
+
* 引用id
|
69
|
+
*/
|
70
|
+
refId?: string;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* 规则值
|
74
|
+
*/
|
75
|
+
value: any;
|
76
|
+
};
|
77
|
+
|
78
|
+
export interface IAPI {
|
79
|
+
// 获取元数据列表
|
80
|
+
GetMetadataList(keyWords?: string[]): Promise<{ id: string; name: string; schema: string }[]>;
|
81
|
+
// 通过元数据Id获取元数据详情
|
82
|
+
GetMetadataDetailById(metadataId: string): Promise<any>;
|
83
|
+
// 新增元数据
|
84
|
+
SaveMetadata(data: any, metadataTag: string): Promise<any>;
|
85
|
+
// 获取元数据的值
|
86
|
+
GetMetadataObjList(metadataId): Promise<any[]>;
|
87
|
+
}
|