ronds-metadata 1.2.38 → 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 +2 -7
- 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 +36 -72
- 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/core/index.less +23 -23
- 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/JsonView/index.less +41 -41
- package/es/comps/MdEdit/index.js +7 -10
- package/es/comps/MdEdit/index.less +6 -6
- 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/MdView/index.less +353 -353
- 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/MetadataEdit/index.less +10 -10
- package/es/comps/MetadataEdit/type.d.ts +20 -20
- 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 +12 -32
- 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 +127 -222
- package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +93 -164
- package/es/comps/MetadataForm/HOC/index.js +20 -37
- package/es/comps/MetadataForm/HOC/index.less +41 -41
- 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.js +0 -14
- package/es/comps/Split/index.js +20 -22
- 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/metadata/types.d.ts +98 -98
- 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/theme.less +79 -79
- package/es/utils.js +58 -97
- package/package.json +104 -102
@@ -17,57 +17,47 @@ import './index.less';
|
|
17
17
|
import MetaFieldsEdit from './components/MetaFieldsEdit';
|
18
18
|
import MetaPropsEdit from './components/MetaPropsEdit';
|
19
19
|
import { OUTERMOST_TYPES_OPTIONS } from './constant';
|
20
|
-
|
21
20
|
var MetadataEdit = function MetadataEdit(props) {
|
22
21
|
var initialValues = props.initialValues,
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
isNameDisabled = props.isNameDisabled,
|
23
|
+
metadataTag = props.metadataTag,
|
24
|
+
onFinish = props.onFinish,
|
25
|
+
onNewRefClick = props.onNewRefClick,
|
26
|
+
getFormInstance = props.getFormInstance;
|
29
27
|
var _Form$useForm = _Form.useForm(),
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
29
|
+
form = _Form$useForm2[0];
|
33
30
|
var _React$useState = React.useState('object'),
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
32
|
+
outerType = _React$useState2[0],
|
33
|
+
setOutType = _React$useState2[1];
|
38
34
|
var _React$useState3 = React.useState({
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
35
|
+
id: '',
|
36
|
+
type: 'object'
|
37
|
+
}),
|
38
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
39
|
+
metaSchema = _React$useState4[0],
|
40
|
+
setMetaSchema = _React$useState4[1];
|
46
41
|
var metaSchemaRef = React.useRef({
|
47
42
|
id: '',
|
48
43
|
type: 'object'
|
49
44
|
});
|
50
45
|
var firstLoadRef = React.useRef(true);
|
51
|
-
|
52
46
|
var _React$useState5 = React.useState(false),
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
47
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
48
|
+
isFields = _React$useState6[0],
|
49
|
+
setIsFields = _React$useState6[1];
|
57
50
|
var _React$useState7 = React.useState({}),
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
51
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
52
|
+
fields = _React$useState8[0],
|
53
|
+
setFields = _React$useState8[1];
|
62
54
|
var _React$useState9 = React.useState({}),
|
63
|
-
|
64
|
-
|
65
|
-
|
55
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
56
|
+
curFields = _React$useState10[0],
|
57
|
+
setCurFields = _React$useState10[1];
|
66
58
|
/**
|
67
59
|
* 获取form的实例
|
68
60
|
*/
|
69
|
-
|
70
|
-
|
71
61
|
React.useEffect(function () {
|
72
62
|
if (form) {
|
73
63
|
getFormInstance && getFormInstance(form);
|
@@ -90,37 +80,29 @@ var MetadataEdit = function MetadataEdit(props) {
|
|
90
80
|
firstLoadRef.current = false;
|
91
81
|
}
|
92
82
|
}, [form, initialValues]);
|
93
|
-
|
94
83
|
var onMyFinish = function onMyFinish(values) {
|
95
84
|
var _metaSchema = metaSchemaRef.current;
|
96
85
|
_metaSchema.id = values.id;
|
97
86
|
_metaSchema.type = values.type;
|
98
|
-
|
99
87
|
if (values === null || values === void 0 ? void 0 : values.properties) {
|
100
88
|
_metaSchema.properties = values.properties;
|
101
|
-
|
102
89
|
for (var i = 0; i < _metaSchema.properties.length; i++) {
|
103
90
|
if (fields[_metaSchema.properties[i].id]) {
|
104
91
|
_metaSchema.properties[i].fields = fields[_metaSchema.properties[i].id];
|
105
92
|
}
|
106
93
|
}
|
107
94
|
}
|
108
|
-
|
109
95
|
if (fields[values.id]) {
|
110
96
|
_metaSchema.fields = fields[values.id];
|
111
97
|
}
|
112
|
-
|
113
98
|
setMetaSchema(_objectSpread({}, _metaSchema));
|
114
99
|
metaSchemaRef.current = _metaSchema;
|
115
100
|
onFinish && onFinish(JSON.stringify(_metaSchema));
|
116
101
|
};
|
117
|
-
|
118
102
|
var onAddFields = function onAddFields(index) {
|
119
103
|
if (index === -1) {
|
120
104
|
var _id = form.getFieldValue('id');
|
121
|
-
|
122
105
|
var _type = form.getFieldValue('type');
|
123
|
-
|
124
106
|
if (_id) {
|
125
107
|
setIsFields(true);
|
126
108
|
setCurFields({
|
@@ -130,24 +112,17 @@ var MetadataEdit = function MetadataEdit(props) {
|
|
130
112
|
} else {
|
131
113
|
_message.warn('请填写元数据名称');
|
132
114
|
}
|
133
|
-
|
134
115
|
return;
|
135
116
|
}
|
136
|
-
|
137
117
|
var _properties_from = form.getFieldValue('properties') || [];
|
138
|
-
|
139
118
|
var _properties_ref = metaSchemaRef.current.properties || [];
|
140
|
-
|
141
119
|
var _properties = _properties_from.length >= _properties_ref.length ? _properties_from : _properties_ref;
|
142
|
-
|
143
120
|
var _curFields = _properties[index];
|
144
|
-
|
145
121
|
if (_curFields && _curFields.id) {
|
146
122
|
setIsFields(true);
|
147
123
|
var idx = ((metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields) || []).findIndex(function (v) {
|
148
124
|
return v.id === _curFields.id;
|
149
125
|
});
|
150
|
-
|
151
126
|
if ((metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields) && idx >= 0) {
|
152
127
|
setCurFields(_objectSpread({}, metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields[idx]));
|
153
128
|
} else {
|
@@ -157,22 +132,18 @@ var MetadataEdit = function MetadataEdit(props) {
|
|
157
132
|
_message.warn('请填写属性名称');
|
158
133
|
}
|
159
134
|
};
|
160
|
-
|
161
135
|
var onFieldsChange = function onFieldsChange(values) {
|
162
136
|
var _fields = fields;
|
163
137
|
_fields[curFields.id] = values;
|
164
138
|
setFields(_objectSpread({}, _fields));
|
165
139
|
setIsFields(false);
|
166
140
|
};
|
167
|
-
|
168
141
|
var onOuterTypeChange = function onOuterTypeChange(value) {
|
169
142
|
setOutType(value);
|
170
143
|
};
|
171
|
-
|
172
144
|
var processFileds = function processFileds(schema) {
|
173
145
|
var _properties = schema.properties;
|
174
146
|
var _fields = fields;
|
175
|
-
|
176
147
|
if (_properties) {
|
177
148
|
for (var i = 0; i < _properties.length; i++) {
|
178
149
|
if (_properties[i].fields) {
|
@@ -180,14 +151,11 @@ var MetadataEdit = function MetadataEdit(props) {
|
|
180
151
|
}
|
181
152
|
}
|
182
153
|
}
|
183
|
-
|
184
154
|
if (schema.fields) {
|
185
155
|
_fields[schema.id] = schema.fields;
|
186
156
|
}
|
187
|
-
|
188
157
|
setFields(_objectSpread({}, _fields));
|
189
158
|
};
|
190
|
-
|
191
159
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form, {
|
192
160
|
className: "metadata-edit",
|
193
161
|
initialValues: initialValues,
|
@@ -251,5 +219,4 @@ var MetadataEdit = function MetadataEdit(props) {
|
|
251
219
|
onChange: onFieldsChange
|
252
220
|
})));
|
253
221
|
};
|
254
|
-
|
255
222
|
export default MetadataEdit;
|
@@ -1,10 +1,10 @@
|
|
1
|
-
.metadata-edit {
|
2
|
-
height: 100%;
|
3
|
-
width: 100%;
|
4
|
-
.ant-row {
|
5
|
-
display: block;
|
6
|
-
}
|
7
|
-
.pr-10 {
|
8
|
-
padding-right: 10px;
|
9
|
-
}
|
10
|
-
}
|
1
|
+
.metadata-edit {
|
2
|
+
height: 100%;
|
3
|
+
width: 100%;
|
4
|
+
.ant-row {
|
5
|
+
display: block;
|
6
|
+
}
|
7
|
+
.pr-10 {
|
8
|
+
padding-right: 10px;
|
9
|
+
}
|
10
|
+
}
|
@@ -1,20 +1,20 @@
|
|
1
|
-
export interface IMetaFileds {
|
2
|
-
id: string;
|
3
|
-
type: 'object';
|
4
|
-
properties: any[];
|
5
|
-
value: any;
|
6
|
-
}
|
7
|
-
|
8
|
-
export type ITypeStatus = 'object' | 'ref' | 'bool' | 'number' | 'text' | 'enum' | 'array';
|
9
|
-
|
10
|
-
export type IMetaProperty = {
|
11
|
-
/**
|
12
|
-
* 属性的名称
|
13
|
-
*/
|
14
|
-
id: string;
|
15
|
-
/**
|
16
|
-
* 类型
|
17
|
-
*/
|
18
|
-
type: string;
|
19
|
-
enum?: any[];
|
20
|
-
};
|
1
|
+
export interface IMetaFileds {
|
2
|
+
id: string;
|
3
|
+
type: 'object';
|
4
|
+
properties: any[];
|
5
|
+
value: any;
|
6
|
+
}
|
7
|
+
|
8
|
+
export type ITypeStatus = 'object' | 'ref' | 'bool' | 'number' | 'text' | 'enum' | 'array';
|
9
|
+
|
10
|
+
export type IMetaProperty = {
|
11
|
+
/**
|
12
|
+
* 属性的名称
|
13
|
+
*/
|
14
|
+
id: string;
|
15
|
+
/**
|
16
|
+
* 类型
|
17
|
+
*/
|
18
|
+
type: string;
|
19
|
+
enum?: any[];
|
20
|
+
};
|
@@ -18,30 +18,24 @@ import React from 'react';
|
|
18
18
|
import { RULE_TYPES_OPTIONS } from '../constant';
|
19
19
|
import { useMetaType } from '../hooks';
|
20
20
|
import MetadataForm from '../../MetadataForm';
|
21
|
-
|
22
21
|
var MetaFieldsEdit = function MetaFieldsEdit(props) {
|
23
22
|
var defaultValues = props.defaultValues,
|
24
|
-
|
25
|
-
|
23
|
+
onChange = props.onChange;
|
26
24
|
var _Form$useForm = _Form.useForm(),
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
26
|
+
form = _Form$useForm2[0];
|
30
27
|
var _React$useState = React.useState({}),
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
28
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
29
|
+
ruleTypes = _React$useState2[0],
|
30
|
+
setRuleTypes = _React$useState2[1];
|
35
31
|
var _React$useState3 = React.useState({}),
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
33
|
+
refIds = _React$useState4[0],
|
34
|
+
setRefIds = _React$useState4[1];
|
40
35
|
var _React$useState5 = React.useState({}),
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
36
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
37
|
+
refValues = _React$useState6[0],
|
38
|
+
setRefValues = _React$useState6[1];
|
45
39
|
var metaType = useMetaType('扩展规则');
|
46
40
|
React.useEffect(function () {
|
47
41
|
if (defaultValues) {
|
@@ -51,40 +45,32 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
|
|
51
45
|
});
|
52
46
|
var _ruleTypes = ruleTypes;
|
53
47
|
var _refIds = refIds;
|
54
|
-
|
55
48
|
for (var i = 0; i < defaultValues.length; i++) {
|
56
49
|
_ruleTypes[i] = defaultValues[i].type;
|
57
|
-
|
58
50
|
if (defaultValues[i].type === 'ref') {
|
59
51
|
_refIds[i] = defaultValues[i].refId;
|
60
52
|
}
|
61
53
|
}
|
62
|
-
|
63
54
|
setRefIds(_objectSpread({}, _refIds));
|
64
55
|
setRuleTypes(_objectSpread({}, _ruleTypes));
|
65
56
|
}
|
66
57
|
}, [defaultValues, form]);
|
67
|
-
|
68
58
|
var onFinish = function onFinish(values) {
|
69
59
|
var _fields = values.fields;
|
70
|
-
|
71
60
|
for (var i = 0; i < _fields.length; i++) {
|
72
61
|
if (_fields[i].type === 'ref') {
|
73
62
|
_fields[i].value = refValues[i] || _fields[i].value;
|
74
63
|
}
|
75
|
-
}
|
76
|
-
|
77
|
-
|
64
|
+
}
|
65
|
+
// console.log('_fields', _fields);
|
78
66
|
onChange && onChange(_fields);
|
79
67
|
};
|
80
|
-
|
81
68
|
var onRefRulesValuesChange = function onRefRulesValuesChange(values, idx) {
|
82
69
|
// console.log('onRefRulesValuesChange', values, refValues);
|
83
70
|
var _refValues = refValues;
|
84
71
|
_refValues[idx] = _refValues[idx] ? _objectSpread(_objectSpread({}, _refValues[idx]), values) : _objectSpread({}, values);
|
85
72
|
setRefValues(_objectSpread({}, _refValues));
|
86
73
|
};
|
87
|
-
|
88
74
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form, {
|
89
75
|
className: "metadata-edit",
|
90
76
|
style: {
|
@@ -101,10 +87,9 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
|
|
101
87
|
name: "fields"
|
102
88
|
}, function (fields, _ref) {
|
103
89
|
var add = _ref.add,
|
104
|
-
|
90
|
+
remove = _ref.remove;
|
105
91
|
return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, index) {
|
106
92
|
var _defaultValues$index;
|
107
|
-
|
108
93
|
// console.log('fields=========', fields);
|
109
94
|
return /*#__PURE__*/React.createElement("div", {
|
110
95
|
key: field.key
|
@@ -189,8 +174,8 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
|
|
189
174
|
var _refIds = refIds;
|
190
175
|
_refIds[index] = value;
|
191
176
|
setRefIds(_objectSpread({}, _refIds));
|
192
|
-
var newData = form.getFieldValue('fields');
|
193
|
-
|
177
|
+
var newData = form.getFieldValue('fields');
|
178
|
+
// console.log('newData', newData);
|
194
179
|
newData[index].id = value;
|
195
180
|
form.setFieldsValue({
|
196
181
|
fields: newData
|
@@ -233,5 +218,4 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
|
|
233
218
|
htmlType: "submit"
|
234
219
|
}, "\u786E\u5B9A")))));
|
235
220
|
};
|
236
|
-
|
237
221
|
export default MetaFieldsEdit;
|
@@ -15,30 +15,26 @@ 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
17
|
import { ARRAY_TYPES_OPTIONS, BASIC_TYPES_OPTIONS, NUMBER_FORMAT_OPTIONS } from '../constant';
|
18
|
-
import { useMetaType } from '../hooks';
|
19
|
-
|
18
|
+
import { useMetaType } from '../hooks';
|
19
|
+
// import { guid } from '../../../utils';
|
20
20
|
import TextArea from "antd/es/input/TextArea";
|
21
|
-
|
22
21
|
var MetaPropsEdit = function MetaPropsEdit(props) {
|
23
22
|
var form = props.form,
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
id = props.id,
|
24
|
+
metadataTag = props.metadataTag,
|
25
|
+
name = props.name,
|
26
|
+
onAddFields = props.onAddFields,
|
27
|
+
onNewRefClick = props.onNewRefClick;
|
30
28
|
var _React$useState = React.useState(true),
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
30
|
+
refresh = _React$useState2[0],
|
31
|
+
setRefresh = _React$useState2[1];
|
32
|
+
var metaType = useMetaType(metadataTag, refresh);
|
33
|
+
// console.log('metaType', metaType, id);
|
36
34
|
// 赋值
|
37
|
-
|
38
35
|
var onTypeChange = function onTypeChange(idx) {
|
39
|
-
var _properties = form.getFieldValue('properties');
|
40
|
-
|
41
|
-
|
36
|
+
var _properties = form.getFieldValue('properties');
|
37
|
+
// console.log('_propertie=========', _properties, idx);
|
42
38
|
var __properties = {
|
43
39
|
id: _properties[idx].id,
|
44
40
|
type: _properties[idx].type,
|
@@ -51,12 +47,11 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
51
47
|
properties: _properties
|
52
48
|
});
|
53
49
|
};
|
54
|
-
|
55
50
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form.List, {
|
56
51
|
name: name
|
57
52
|
}, function (fields, _ref) {
|
58
53
|
var add = _ref.add,
|
59
|
-
|
54
|
+
remove = _ref.remove;
|
60
55
|
return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, index) {
|
61
56
|
// console.log('field=============', field);
|
62
57
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -144,16 +139,12 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
144
139
|
noStyle: true,
|
145
140
|
shouldUpdate: function shouldUpdate(prevValues, currentValues) {
|
146
141
|
var _prevValues$name$inde, _currentValues$name$i, _prevValues$name$inde2, _currentValues$name$i2;
|
147
|
-
|
148
142
|
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);
|
149
143
|
}
|
150
144
|
}, function (_ref2) {
|
151
145
|
var _properties$index, _properties$index2, _properties$index2$it, _properties$index3, _properties$index3$it;
|
152
|
-
|
153
146
|
var getFieldValue = _ref2.getFieldValue;
|
154
|
-
|
155
147
|
var _properties = getFieldValue(name);
|
156
|
-
|
157
148
|
switch ((_properties$index = _properties[index]) === null || _properties$index === void 0 ? void 0 : _properties$index.type) {
|
158
149
|
case 'number':
|
159
150
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -175,7 +166,6 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
175
166
|
},
|
176
167
|
options: NUMBER_FORMAT_OPTIONS
|
177
168
|
})));
|
178
|
-
|
179
169
|
case 'ref':
|
180
170
|
return /*#__PURE__*/React.createElement("div", {
|
181
171
|
style: {
|
@@ -227,7 +217,6 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
227
217
|
},
|
228
218
|
icon: /*#__PURE__*/React.createElement(ReloadOutlined, null)
|
229
219
|
}))));
|
230
|
-
|
231
220
|
case 'array':
|
232
221
|
return /*#__PURE__*/React.createElement("div", {
|
233
222
|
style: {
|
@@ -305,7 +294,6 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
305
294
|
},
|
306
295
|
options: NUMBER_FORMAT_OPTIONS
|
307
296
|
}))));
|
308
|
-
|
309
297
|
case 'enum':
|
310
298
|
return /*#__PURE__*/React.createElement("div", {
|
311
299
|
style: {
|
@@ -341,7 +329,6 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
341
329
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
342
330
|
}, "\u6DFB\u52A0Enum")));
|
343
331
|
}));
|
344
|
-
|
345
332
|
default:
|
346
333
|
return null;
|
347
334
|
}
|
@@ -363,5 +350,4 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
363
350
|
}, "\u6DFB\u52A0\u6269\u5C55\u89C4\u5219")));
|
364
351
|
}));
|
365
352
|
};
|
366
|
-
|
367
353
|
export default MetaPropsEdit;
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
|
3
2
|
/*
|
4
3
|
* @Author:wangxian
|
5
4
|
* @Date: 2022-03-03 16:12:34
|
@@ -9,32 +8,26 @@ import { MetadataService } from './../../../framework/metadata/MetadataService';
|
|
9
8
|
import React from 'react';
|
10
9
|
export var useMetaType = function useMetaType(tag) {
|
11
10
|
var isFresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
12
|
-
|
13
11
|
var _React$useState = React.useState([]),
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
13
|
+
metaType = _React$useState2[0],
|
14
|
+
setMetaType = _React$useState2[1];
|
18
15
|
React.useEffect(function () {
|
19
16
|
if (isFresh) {
|
20
17
|
var service = new MetadataService();
|
21
|
-
|
22
18
|
var _tag = tag ? [tag] : [];
|
23
|
-
|
24
19
|
service.GetMetadataList(_tag).then(function (res) {
|
25
|
-
var _metaType = [];
|
26
|
-
|
20
|
+
var _metaType = [];
|
21
|
+
// console.log('res', res);
|
27
22
|
if (res) {
|
28
23
|
for (var i = 0; i < res.length; i++) {
|
29
24
|
var obj = {
|
30
25
|
label: res[i].name,
|
31
26
|
value: res[i].id
|
32
27
|
};
|
33
|
-
|
34
28
|
_metaType.push(obj);
|
35
29
|
}
|
36
30
|
}
|
37
|
-
|
38
31
|
setMetaType([].concat(_metaType));
|
39
32
|
});
|
40
33
|
}
|