ronds-metadata 1.2.37 → 1.2.39
Sign up to get free protection for your applications and to get access to all the features.
- package/es/api/index.js +83 -131
- package/es/comps/DynamicPorts/comps/ContextMenu.js +3 -11
- package/es/comps/DynamicPorts/comps/DragNode.js +3 -8
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +4 -5
- package/es/comps/DynamicPorts/comps/NodeElement.js +1 -4
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +3 -6
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +3 -7
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +18 -21
- package/es/comps/DynamicPorts/comps/shape/edge.js +5 -18
- package/es/comps/DynamicPorts/comps/shape/node.js +4 -17
- package/es/comps/DynamicPorts/constant/index.js +2 -5
- package/es/comps/DynamicPorts/graph.d.ts +2 -2
- package/es/comps/DynamicPorts/graph.js +228 -312
- package/es/comps/DynamicPorts/index.js +39 -58
- package/es/comps/DynamicPorts/utils.js +21 -25
- package/es/comps/Editable/DataCell/ButtonCell.js +4 -10
- package/es/comps/Editable/DataCell/ColorPicker.js +2 -7
- package/es/comps/Editable/DataCell/Input.js +5 -14
- package/es/comps/Editable/DataCell/Number.js +3 -10
- package/es/comps/Editable/DataCell/Select.js +7 -14
- package/es/comps/Editable/DataCell/Switch.js +2 -7
- package/es/comps/Editable/comps/EditableAction.js +8 -12
- package/es/comps/Editable/comps/EditableCell.js +16 -26
- package/es/comps/Editable/comps/EditableHeardCell.js +21 -34
- package/es/comps/Editable/comps/EditableRow.js +49 -59
- package/es/comps/Editable/comps/Texty.js +40 -73
- package/es/comps/Editable/index.js +67 -112
- package/es/comps/Editable/interface.d.ts +1 -1
- package/es/comps/Editable/utils.js +0 -1
- package/es/comps/FileView/index.js +65 -101
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +6 -3
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +2 -5
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +86 -109
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +3 -7
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +54 -91
- package/es/comps/FormGenerator/comps/Canvas/index.js +8 -15
- package/es/comps/FormGenerator/comps/Settings/index.js +16 -30
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +23 -22
- package/es/comps/FormGenerator/comps/Sidebar/index.js +6 -2
- package/es/comps/FormGenerator/index.js +3 -9
- package/es/comps/FormGenerator/interface.d.ts +1 -1
- package/es/comps/FormGenerator/settings/index.js +12 -11
- package/es/comps/FormGenerator/settings/ruleConfig.js +0 -1
- package/es/comps/FormGenerator/transformer.js +40 -105
- package/es/comps/Icons/index.js +4 -7
- package/es/comps/JsonEdit/index.js +25 -50
- package/es/comps/JsonView/index.js +7 -21
- package/es/comps/MdEdit/index.js +7 -10
- package/es/comps/MdEditPro/index.d.ts +10 -0
- package/es/comps/MdEditPro/index.js +22 -0
- package/es/comps/MdEditPro/index.less +74 -0
- package/es/comps/MdNavbar/index.js +17 -40
- package/es/comps/MdNavbar/utils.js +0 -4
- package/es/comps/MdView/index.js +7 -11
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +129 -183
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +11 -27
- package/es/comps/MetadataEdit/hooks/index.js +3 -11
- package/es/comps/MetadataEdit/index.js +25 -58
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +17 -33
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +15 -29
- package/es/comps/MetadataEditV2/hooks/index.js +5 -12
- package/es/comps/MetadataEditV2/index.js +30 -65
- package/es/comps/MetadataForm/DataCell/Array.js +12 -23
- package/es/comps/MetadataForm/DataCell/Input.js +23 -39
- package/es/comps/MetadataForm/DataCell/Number.js +10 -21
- package/es/comps/MetadataForm/DataCell/Ref.js +87 -121
- package/es/comps/MetadataForm/DataCell/Select.js +131 -226
- package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +98 -169
- package/es/comps/MetadataForm/HOC/index.js +20 -37
- package/es/comps/MetadataForm/hooks/index.js +12 -38
- package/es/comps/MetadataForm/index.js +37 -72
- package/es/comps/MetadataForm/interface.d.ts +3 -3
- package/es/comps/MetadataForm/utils.d.ts +1 -0
- package/es/comps/MetadataForm/utils.js +12 -14
- package/es/comps/Split/index.js +40 -38
- package/es/config.js +0 -4
- package/es/framework/RxStore/demo/index.js +9 -10
- package/es/framework/RxStore/hooks.d.ts +9 -9
- package/es/framework/RxStore/hooks.js +10 -35
- package/es/framework/RxStore/store.d.ts +4 -4
- package/es/framework/RxStore/store.js +0 -10
- package/es/framework/fg/index.js +18 -80
- package/es/framework/fg/interface.d.ts +2 -2
- package/es/framework/fg/utils.js +0 -10
- package/es/framework/graph/index.d.ts +2 -2
- package/es/framework/graph/index.js +55 -110
- package/es/framework/hooks/use-async-memo.js +3 -7
- package/es/framework/hooks/use-sync-scroll.js +2 -15
- package/es/framework/http/cache.js +25 -32
- package/es/framework/http/cancel.js +1 -7
- package/es/framework/http/index.js +22 -82
- package/es/framework/http/msgpack.js +0 -4
- package/es/framework/http/msgpack5/index.js +2 -12
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +1 -13
- package/es/framework/http/msgpack5/lib/decoder.js +10 -68
- package/es/framework/http/msgpack5/lib/encoder.js +8 -36
- package/es/framework/http/msgpack5/lib/helpers.js +3 -2
- package/es/framework/http/msgpack5/lib/streams.js +0 -18
- package/es/framework/libs/jquery.min.js +1009 -1696
- package/es/framework/locale/dil8/di18n.js +4 -15
- package/es/framework/locale/dil8/translate.js +0 -14
- package/es/framework/locale/dil8/util.js +0 -3
- package/es/framework/locale/index.js +2 -3
- package/es/framework/metadata/MetadataService.js +39 -78
- package/es/framework/metadata/index.js +4 -70
- package/es/framework/rxjs-hooks/useMemoSubject.js +0 -2
- package/es/framework/rxjs-hooks/useObservable.js +2 -4
- package/es/framework/rxjs-hooks/useObservableState.js +8 -14
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/utils.js +58 -97
- package/package.json +4 -2
- package/es/comps/MdEdit/plugin/EditContent.d.ts +0 -5
- package/es/comps/MdEdit/plugin/EditContent.js +0 -34
- package/es/comps/MdEdit/plugin/Mark.d.ts +0 -7
- package/es/comps/MdEdit/plugin/Mark.js +0 -60
- package/es/framework/libs/iconfont/iconfont.json +0 -401
@@ -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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
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,43 +13,36 @@ 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
|
20
|
-
* @LastEditTime: 2023-04-
|
19
|
+
* @LastEditTime: 2023-04-27 18:56:50
|
21
20
|
*/
|
22
21
|
import React from 'react';
|
23
22
|
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
47
|
-
|
48
|
-
|
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,28 +70,28 @@ 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
|
-
return
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
80
|
+
return (
|
81
|
+
/*#__PURE__*/
|
82
|
+
// @ts-ignore
|
83
|
+
React.createElement(_DatePicker, {
|
84
|
+
showTime: true,
|
85
|
+
format: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.format) || DEFAULT_DATE_FORMAT,
|
86
|
+
disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
|
87
|
+
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
|
88
|
+
})
|
89
|
+
);
|
101
90
|
case 'upload':
|
102
91
|
return /*#__PURE__*/React.createElement(_Upload, null, /*#__PURE__*/React.createElement(_Button, {
|
103
92
|
disabled: (_extraInfo$disabled5 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled5 !== void 0 ? _extraInfo$disabled5 : disabled,
|
104
93
|
icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
|
105
94
|
}, "\u4E0A\u4F20"));
|
106
|
-
|
107
95
|
default:
|
108
96
|
return /*#__PURE__*/React.createElement(_Input, {
|
109
97
|
addonAfter: ((_extraInfo$addonAfter = extraInfo.addonAfter) === null || _extraInfo$addonAfter === void 0 ? void 0 : _extraInfo$addonAfter.key) ? /*#__PURE__*/React.createElement(_Form.Item, {
|
@@ -124,12 +112,10 @@ function Index(props) {
|
|
124
112
|
onChange: onChange
|
125
113
|
});
|
126
114
|
}
|
127
|
-
};
|
128
|
-
|
129
|
-
|
115
|
+
};
|
116
|
+
// ref引用的 应用类型是否展示成表单
|
130
117
|
if (isObj && isRefForm && field) {
|
131
118
|
var _extraInfo$addonAfter5;
|
132
|
-
|
133
119
|
return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
134
120
|
style: {
|
135
121
|
flex: 1,
|
@@ -159,7 +145,6 @@ function Index(props) {
|
|
159
145
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
160
146
|
}), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
|
161
147
|
}
|
162
|
-
|
163
148
|
return !field ?
|
164
149
|
/*#__PURE__*/
|
165
150
|
// 不是引用的
|
@@ -204,6 +189,5 @@ function Index(props) {
|
|
204
189
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
205
190
|
}), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
|
206
191
|
}
|
207
|
-
|
208
192
|
export default /*#__PURE__*/React.memo(Index);
|
209
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
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
35
|
-
|
36
|
-
|
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);
|
@@ -11,9 +11,9 @@ import "antd/es/button/style";
|
|
11
11
|
import _Button from "antd/es/button";
|
12
12
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
13
13
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
14
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
15
14
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
16
15
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
16
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
17
17
|
import React from 'react';
|
18
18
|
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons';
|
19
19
|
import { MetadataService } from '../../../framework/metadata/MetadataService';
|
@@ -21,88 +21,72 @@ import { MetadataFormContext, MetadataRefContext } from '../interface';
|
|
21
21
|
import { useGetExtraInfo } from '../hooks';
|
22
22
|
import { renderForm } from '../utils';
|
23
23
|
import { JsonMetadataProvider } from '../../../framework/metadata';
|
24
|
-
|
25
24
|
function Index(props) {
|
26
25
|
var _extraInfo$disabled, _extraInfo$disabled2;
|
27
|
-
|
28
26
|
var id = props.id,
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
refId = props.refId,
|
28
|
+
disabled = props.disabled,
|
29
|
+
isRefForm = props.isRefForm,
|
30
|
+
fieldRule = props.fields,
|
31
|
+
labelSpan = props.labelSpan,
|
32
|
+
initEnumValue = props.initEnumValue,
|
33
|
+
field = props.field,
|
34
|
+
name = props.name;
|
37
35
|
var formContext = React.useContext(MetadataFormContext) || {};
|
38
|
-
var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form, props.type);
|
39
|
-
|
36
|
+
var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form, props.type);
|
37
|
+
// 是否折叠
|
40
38
|
var _React$useState = React.useState(true),
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
40
|
+
isFold = _React$useState2[0],
|
41
|
+
setIsFold = _React$useState2[1];
|
45
42
|
var _React$useState3 = React.useState([]),
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
43
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
44
|
+
schema = _React$useState4[0],
|
45
|
+
setSchema = _React$useState4[1];
|
50
46
|
var _React$useState5 = React.useState({}),
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
48
|
+
refFields = _React$useState6[0],
|
49
|
+
setRefFields = _React$useState6[1];
|
55
50
|
var refFieldsRef = React.useRef(refFields);
|
56
|
-
|
57
51
|
var _React$useState7 = React.useState([]),
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
52
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
53
|
+
options = _React$useState8[0],
|
54
|
+
setOptions = _React$useState8[1];
|
62
55
|
var _React$useState9 = React.useState(''),
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
56
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
57
|
+
help = _React$useState10[0],
|
58
|
+
setHelp = _React$useState10[1];
|
67
59
|
var onSearch = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
68
60
|
var param, server, res, _options, i, obj;
|
69
|
-
|
70
61
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
71
|
-
while (1) {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
value: res[i].namespace
|
94
|
-
};
|
95
|
-
|
96
|
-
_options.push(obj);
|
97
|
-
}
|
62
|
+
while (1) switch (_context.prev = _context.next) {
|
63
|
+
case 0:
|
64
|
+
param = {
|
65
|
+
id: refId,
|
66
|
+
filter: {
|
67
|
+
keywords: ''
|
68
|
+
},
|
69
|
+
order: []
|
70
|
+
};
|
71
|
+
server = new MetadataService();
|
72
|
+
_context.next = 4;
|
73
|
+
return server.GetMetadataObjList(param);
|
74
|
+
case 4:
|
75
|
+
res = _context.sent;
|
76
|
+
_options = [];
|
77
|
+
if (res.length > 0) {
|
78
|
+
for (i = 0; i < res.length; i++) {
|
79
|
+
obj = {
|
80
|
+
label: res[i].name,
|
81
|
+
value: res[i].namespace
|
82
|
+
};
|
83
|
+
_options.push(obj);
|
98
84
|
}
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
return _context.stop();
|
105
|
-
}
|
85
|
+
}
|
86
|
+
setOptions(_options);
|
87
|
+
case 8:
|
88
|
+
case "end":
|
89
|
+
return _context.stop();
|
106
90
|
}
|
107
91
|
}, _callee);
|
108
92
|
})), []);
|
@@ -125,56 +109,44 @@ function Index(props) {
|
|
125
109
|
var getSchemaByRefId = React.useCallback( /*#__PURE__*/function () {
|
126
110
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(server, __TYPE__) {
|
127
111
|
var _schema, res, provider, FormCls, formCls, _fields;
|
128
|
-
|
129
112
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
130
|
-
while (1) {
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
_fields = formCls.__type__.__fields__;
|
165
|
-
refFieldsRef.current = _fields;
|
166
|
-
setRefFields(_objectSpread({}, _fields));
|
167
|
-
setSchema(_toConsumableArray(_schema));
|
168
|
-
}
|
169
|
-
|
170
|
-
case 9:
|
171
|
-
case "end":
|
172
|
-
return _context2.stop();
|
173
|
-
}
|
113
|
+
while (1) switch (_context2.prev = _context2.next) {
|
114
|
+
case 0:
|
115
|
+
_schema = []; // 如果有内部类,优先在内部类里面找
|
116
|
+
if (__TYPE__.length > 0) {
|
117
|
+
_schema = __TYPE__.filter(function (it) {
|
118
|
+
return it.id === refId;
|
119
|
+
});
|
120
|
+
}
|
121
|
+
// 内部类找不到 从接口里面拿
|
122
|
+
if (!(_schema.length === 0)) {
|
123
|
+
_context2.next = 7;
|
124
|
+
break;
|
125
|
+
}
|
126
|
+
_context2.next = 5;
|
127
|
+
return server.GetMetadataDetailById(refId);
|
128
|
+
case 5:
|
129
|
+
res = _context2.sent;
|
130
|
+
if (res === null || res === void 0 ? void 0 : res.schema) {
|
131
|
+
_schema = JSON.parse(res === null || res === void 0 ? void 0 : res.schema);
|
132
|
+
}
|
133
|
+
case 7:
|
134
|
+
provider = new JsonMetadataProvider();
|
135
|
+
if (_schema.length > 0) {
|
136
|
+
provider.add_types(_schema);
|
137
|
+
FormCls = provider.get_type(_schema[0].id);
|
138
|
+
formCls = new FormCls();
|
139
|
+
_fields = formCls.__type__.__fields__;
|
140
|
+
refFieldsRef.current = _fields;
|
141
|
+
setRefFields(_objectSpread({}, _fields));
|
142
|
+
setSchema(_toConsumableArray(_schema));
|
143
|
+
}
|
144
|
+
case 9:
|
145
|
+
case "end":
|
146
|
+
return _context2.stop();
|
174
147
|
}
|
175
148
|
}, _callee2);
|
176
149
|
}));
|
177
|
-
|
178
150
|
return function (_x, _x2) {
|
179
151
|
return _ref2.apply(this, arguments);
|
180
152
|
};
|
@@ -187,7 +159,6 @@ function Index(props) {
|
|
187
159
|
server = null;
|
188
160
|
};
|
189
161
|
}
|
190
|
-
|
191
162
|
return function () {};
|
192
163
|
}, [getSchemaByRefId, formContext.__TYPE__]);
|
193
164
|
React.useEffect(function () {
|
@@ -196,10 +167,8 @@ function Index(props) {
|
|
196
167
|
setHelp(arr[arr.length - 1]);
|
197
168
|
}
|
198
169
|
}, [refId]);
|
199
|
-
|
200
170
|
if (isRefForm && !field && schema.length > 0) {
|
201
171
|
var _fieldRule$, _fieldRule$$value, _fieldRule$2, _fieldRule$2$value, _fieldRule$2$value$co;
|
202
|
-
|
203
172
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|
204
173
|
className: "ant-form-item"
|
205
174
|
}, !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && /*#__PURE__*/React.createElement(_Col, {
|
@@ -247,7 +216,6 @@ function Index(props) {
|
|
247
216
|
}
|
248
217
|
}, renderForm(schema, formOptions, formContext.colSpan))))));
|
249
218
|
}
|
250
|
-
|
251
219
|
if (isRefForm && field && schema.length > 0) {
|
252
220
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
253
221
|
style: {
|
@@ -263,7 +231,6 @@ function Index(props) {
|
|
263
231
|
}
|
264
232
|
}, renderForm(schema, formOptions, formContext.colSpan))));
|
265
233
|
}
|
266
|
-
|
267
234
|
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
268
235
|
key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
269
236
|
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
@@ -322,5 +289,4 @@ function Index(props) {
|
|
322
289
|
allowClear: true
|
323
290
|
}));
|
324
291
|
}
|
325
|
-
|
326
292
|
export default /*#__PURE__*/React.memo(Index);
|