ronds-metadata 1.2.8 → 1.2.10
Sign up to get free protection for your applications and to get access to all the features.
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/index.less +23 -23
- package/es/comps/FormGenerator/index.d.ts +4 -0
- package/es/comps/FormGenerator/settings/index.d.ts +668 -49
- package/es/comps/JsonEdit/index.d.ts +5 -1
- package/es/comps/MetadataForm/index.less +1 -1
- package/es/comps/MetadataForm/utils.d.ts +1 -1
- package/package.json +1 -1
- package/es/api/index.js +0 -249
- package/es/comps/DynamicPorts/comps/ContextMenu.js +0 -44
- package/es/comps/DynamicPorts/comps/DragNode.js +0 -55
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +0 -51
- package/es/comps/DynamicPorts/comps/NodeElement.js +0 -30
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +0 -42
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +0 -40
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +0 -55
- package/es/comps/DynamicPorts/comps/shape/connector.js +0 -19
- package/es/comps/DynamicPorts/comps/shape/edge.js +0 -91
- package/es/comps/DynamicPorts/comps/shape/node.js +0 -190
- package/es/comps/DynamicPorts/constant/index.js +0 -19
- package/es/comps/DynamicPorts/graph.js +0 -697
- package/es/comps/DynamicPorts/index.js +0 -143
- package/es/comps/DynamicPorts/interface.js +0 -6
- package/es/comps/DynamicPorts/utils.js +0 -127
- package/es/comps/Editable/DataCell/ButtonCell.js +0 -45
- package/es/comps/Editable/DataCell/ColorPicker.js +0 -33
- package/es/comps/Editable/DataCell/Input.js +0 -54
- package/es/comps/Editable/DataCell/Number.js +0 -44
- package/es/comps/Editable/DataCell/Select.js +0 -48
- package/es/comps/Editable/DataCell/Switch.js +0 -33
- package/es/comps/Editable/comps/EditableAction.js +0 -110
- package/es/comps/Editable/comps/EditableCell.js +0 -108
- package/es/comps/Editable/comps/EditableHeardCell.js +0 -172
- package/es/comps/Editable/comps/EditableRow.js +0 -118
- package/es/comps/Editable/comps/Texty.js +0 -277
- package/es/comps/Editable/index.js +0 -385
- package/es/comps/Editable/interface.js +0 -8
- package/es/comps/Editable/utils.js +0 -46
- package/es/comps/FileView/index.js +0 -198
- package/es/comps/FormGenerator/Provider.js +0 -8
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +0 -16
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +0 -55
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +0 -14
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +0 -50
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +0 -55
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +0 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +0 -14
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +0 -250
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +0 -60
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +0 -313
- package/es/comps/FormGenerator/comps/Canvas/index.js +0 -216
- package/es/comps/FormGenerator/comps/Settings/index.js +0 -150
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +0 -48
- package/es/comps/FormGenerator/comps/Sidebar/index.js +0 -37
- package/es/comps/FormGenerator/index.js +0 -56
- package/es/comps/FormGenerator/settings/index.js +0 -303
- package/es/comps/FormGenerator/settings/ruleConfig.js +0 -557
- package/es/comps/FormGenerator/transformer.js +0 -214
- package/es/comps/Icons/index.js +0 -23
- package/es/comps/JsonEdit/constant/index.js +0 -87
- package/es/comps/JsonEdit/index.js +0 -217
- package/es/comps/JsonView/index.js +0 -109
- package/es/comps/MdEdit/index.js +0 -41
- package/es/comps/MdNavbar/index.js +0 -180
- package/es/comps/MdNavbar/utils.js +0 -34
- package/es/comps/MdView/index.js +0 -70
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +0 -419
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +0 -368
- package/es/comps/MetadataEdit/constant/index.js +0 -69
- package/es/comps/MetadataEdit/hooks/index.js +0 -43
- package/es/comps/MetadataEdit/index.js +0 -255
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +0 -237
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +0 -367
- package/es/comps/MetadataEditV2/constant/index.js +0 -69
- package/es/comps/MetadataEditV2/hooks/index.js +0 -43
- package/es/comps/MetadataEditV2/index.js +0 -298
- package/es/comps/MetadataForm/DataCell/Array.js +0 -157
- package/es/comps/MetadataForm/DataCell/Input.js +0 -197
- package/es/comps/MetadataForm/DataCell/Number.js +0 -130
- package/es/comps/MetadataForm/DataCell/Ref.js +0 -323
- package/es/comps/MetadataForm/DataCell/Select.js +0 -517
- package/es/comps/MetadataForm/DataCell/Switch.js +0 -115
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +0 -359
- package/es/comps/MetadataForm/HOC/index.js +0 -111
- package/es/comps/MetadataForm/constants.js +0 -11
- package/es/comps/MetadataForm/hooks/index.js +0 -128
- package/es/comps/MetadataForm/index.js +0 -268
- package/es/comps/MetadataForm/interface.js +0 -8
- package/es/comps/MetadataForm/utils.js +0 -108
- package/es/comps/locales/en-US.js +0 -24
- package/es/comps/locales/index.js +0 -8
- package/es/comps/locales/zh-CN.js +0 -24
- package/es/config.js +0 -50
- package/es/framework/graph/index.js +0 -515
- package/es/framework/hooks/use-async-memo.js +0 -32
- package/es/framework/hooks/use-sync-scroll.js +0 -106
- package/es/framework/http/cache.js +0 -137
- package/es/framework/http/cancel.js +0 -44
- package/es/framework/http/index.js +0 -392
- package/es/framework/http/msgpack.js +0 -34
- package/es/framework/http/msgpack5/index.js +0 -84
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +0 -71
- package/es/framework/http/msgpack5/lib/decoder.js +0 -287
- package/es/framework/http/msgpack5/lib/encoder.js +0 -252
- package/es/framework/http/msgpack5/lib/helpers.js +0 -23
- package/es/framework/http/msgpack5/lib/streams.js +0 -93
- package/es/framework/http/types.js +0 -1
- package/es/framework/libs/jquery.min.js +0 -4022
- package/es/framework/locale/dil8/di18n.js +0 -132
- package/es/framework/locale/dil8/index.js +0 -3
- package/es/framework/locale/dil8/translate.js +0 -76
- package/es/framework/locale/dil8/util.js +0 -17
- package/es/framework/locale/index.js +0 -26
- package/es/framework/metadata/MetadataService.js +0 -169
- package/es/framework/metadata/index.js +0 -384
- package/es/framework/rxjs-hooks/useMemoSubject.js +0 -16
- package/es/framework/rxjs-hooks/useObservable.js +0 -22
- package/es/framework/rxjs-hooks/useObservableState.js +0 -45
- package/es/index.js +0 -27
- package/es/utils.js +0 -138
@@ -1,255 +0,0 @@
|
|
1
|
-
import "antd/es/drawer/style";
|
2
|
-
import _Drawer from "antd/es/drawer";
|
3
|
-
import "antd/es/button/style";
|
4
|
-
import _Button from "antd/es/button";
|
5
|
-
import "antd/es/select/style";
|
6
|
-
import _Select from "antd/es/select";
|
7
|
-
import "antd/es/input/style";
|
8
|
-
import _Input from "antd/es/input";
|
9
|
-
import "antd/es/message/style";
|
10
|
-
import _message from "antd/es/message";
|
11
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
12
|
-
import "antd/es/form/style";
|
13
|
-
import _Form from "antd/es/form";
|
14
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
15
|
-
import React from 'react';
|
16
|
-
import './index.less';
|
17
|
-
import MetaFieldsEdit from './components/MetaFieldsEdit';
|
18
|
-
import MetaPropsEdit from './components/MetaPropsEdit';
|
19
|
-
import { OUTERMOST_TYPES_OPTIONS } from './constant';
|
20
|
-
|
21
|
-
var MetadataEdit = function MetadataEdit(props) {
|
22
|
-
var initialValues = props.initialValues,
|
23
|
-
isNameDisabled = props.isNameDisabled,
|
24
|
-
metadataTag = props.metadataTag,
|
25
|
-
onFinish = props.onFinish,
|
26
|
-
onNewRefClick = props.onNewRefClick,
|
27
|
-
getFormInstance = props.getFormInstance;
|
28
|
-
|
29
|
-
var _Form$useForm = _Form.useForm(),
|
30
|
-
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
31
|
-
form = _Form$useForm2[0];
|
32
|
-
|
33
|
-
var _React$useState = React.useState('object'),
|
34
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
35
|
-
outerType = _React$useState2[0],
|
36
|
-
setOutType = _React$useState2[1];
|
37
|
-
|
38
|
-
var _React$useState3 = React.useState({
|
39
|
-
id: '',
|
40
|
-
type: 'object'
|
41
|
-
}),
|
42
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
43
|
-
metaSchema = _React$useState4[0],
|
44
|
-
setMetaSchema = _React$useState4[1];
|
45
|
-
|
46
|
-
var metaSchemaRef = React.useRef({
|
47
|
-
id: '',
|
48
|
-
type: 'object'
|
49
|
-
});
|
50
|
-
var firstLoadRef = React.useRef(true);
|
51
|
-
|
52
|
-
var _React$useState5 = React.useState(false),
|
53
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
54
|
-
isFields = _React$useState6[0],
|
55
|
-
setIsFields = _React$useState6[1];
|
56
|
-
|
57
|
-
var _React$useState7 = React.useState({}),
|
58
|
-
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
59
|
-
fields = _React$useState8[0],
|
60
|
-
setFields = _React$useState8[1];
|
61
|
-
|
62
|
-
var _React$useState9 = React.useState({}),
|
63
|
-
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
64
|
-
curFields = _React$useState10[0],
|
65
|
-
setCurFields = _React$useState10[1];
|
66
|
-
/**
|
67
|
-
* 获取form的实例
|
68
|
-
*/
|
69
|
-
|
70
|
-
|
71
|
-
React.useEffect(function () {
|
72
|
-
if (form) {
|
73
|
-
getFormInstance && getFormInstance(form);
|
74
|
-
}
|
75
|
-
}, [form]);
|
76
|
-
React.useEffect(function () {
|
77
|
-
form.setFieldsValue({
|
78
|
-
id: 'Test'
|
79
|
-
});
|
80
|
-
form.setFieldsValue({
|
81
|
-
type: 'object'
|
82
|
-
});
|
83
|
-
}, [form]);
|
84
|
-
React.useEffect(function () {
|
85
|
-
if (initialValues && firstLoadRef.current) {
|
86
|
-
form.setFieldsValue(_objectSpread({}, initialValues));
|
87
|
-
setMetaSchema(_objectSpread({}, initialValues));
|
88
|
-
metaSchemaRef.current = initialValues;
|
89
|
-
processFileds(initialValues);
|
90
|
-
firstLoadRef.current = false;
|
91
|
-
}
|
92
|
-
}, [form, initialValues]);
|
93
|
-
|
94
|
-
var onMyFinish = function onMyFinish(values) {
|
95
|
-
var _metaSchema = metaSchemaRef.current;
|
96
|
-
_metaSchema.id = values.id;
|
97
|
-
_metaSchema.type = values.type;
|
98
|
-
|
99
|
-
if (values === null || values === void 0 ? void 0 : values.properties) {
|
100
|
-
_metaSchema.properties = values.properties;
|
101
|
-
|
102
|
-
for (var i = 0; i < _metaSchema.properties.length; i++) {
|
103
|
-
if (fields[_metaSchema.properties[i].id]) {
|
104
|
-
_metaSchema.properties[i].fields = fields[_metaSchema.properties[i].id];
|
105
|
-
}
|
106
|
-
}
|
107
|
-
}
|
108
|
-
|
109
|
-
if (fields[values.id]) {
|
110
|
-
_metaSchema.fields = fields[values.id];
|
111
|
-
}
|
112
|
-
|
113
|
-
setMetaSchema(_objectSpread({}, _metaSchema));
|
114
|
-
metaSchemaRef.current = _metaSchema;
|
115
|
-
onFinish && onFinish(JSON.stringify(_metaSchema));
|
116
|
-
};
|
117
|
-
|
118
|
-
var onAddFields = function onAddFields(index) {
|
119
|
-
if (index === -1) {
|
120
|
-
var _id = form.getFieldValue('id');
|
121
|
-
|
122
|
-
var _type = form.getFieldValue('type');
|
123
|
-
|
124
|
-
if (_id) {
|
125
|
-
setIsFields(true);
|
126
|
-
setCurFields({
|
127
|
-
id: _id,
|
128
|
-
type: _type
|
129
|
-
});
|
130
|
-
} else {
|
131
|
-
_message.warn('请填写元数据名称');
|
132
|
-
}
|
133
|
-
|
134
|
-
return;
|
135
|
-
}
|
136
|
-
|
137
|
-
var _properties_from = form.getFieldValue('properties') || [];
|
138
|
-
|
139
|
-
var _properties_ref = metaSchemaRef.current.properties || [];
|
140
|
-
|
141
|
-
var _properties = _properties_from.length >= _properties_ref.length ? _properties_from : _properties_ref;
|
142
|
-
|
143
|
-
var _curFields = _properties[index];
|
144
|
-
|
145
|
-
if (_curFields && _curFields.id) {
|
146
|
-
setIsFields(true);
|
147
|
-
var idx = ((metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields) || []).findIndex(function (v) {
|
148
|
-
return v.id === _curFields.id;
|
149
|
-
});
|
150
|
-
|
151
|
-
if ((metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields) && idx >= 0) {
|
152
|
-
setCurFields(_objectSpread({}, metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields[idx]));
|
153
|
-
} else {
|
154
|
-
setCurFields(_objectSpread({}, _curFields));
|
155
|
-
}
|
156
|
-
} else {
|
157
|
-
_message.warn('请填写属性名称');
|
158
|
-
}
|
159
|
-
};
|
160
|
-
|
161
|
-
var onFieldsChange = function onFieldsChange(values) {
|
162
|
-
var _fields = fields;
|
163
|
-
_fields[curFields.id] = values;
|
164
|
-
setFields(_objectSpread({}, _fields));
|
165
|
-
setIsFields(false);
|
166
|
-
};
|
167
|
-
|
168
|
-
var onOuterTypeChange = function onOuterTypeChange(value) {
|
169
|
-
setOutType(value);
|
170
|
-
};
|
171
|
-
|
172
|
-
var processFileds = function processFileds(schema) {
|
173
|
-
var _properties = schema.properties;
|
174
|
-
var _fields = fields;
|
175
|
-
|
176
|
-
if (_properties) {
|
177
|
-
for (var i = 0; i < _properties.length; i++) {
|
178
|
-
if (_properties[i].fields) {
|
179
|
-
_fields[_properties[i].id] = _properties[i].fields;
|
180
|
-
}
|
181
|
-
}
|
182
|
-
}
|
183
|
-
|
184
|
-
if (schema.fields) {
|
185
|
-
_fields[schema.id] = schema.fields;
|
186
|
-
}
|
187
|
-
|
188
|
-
setFields(_objectSpread({}, _fields));
|
189
|
-
};
|
190
|
-
|
191
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form, {
|
192
|
-
className: "metadata-edit",
|
193
|
-
initialValues: initialValues,
|
194
|
-
form: form,
|
195
|
-
name: "control-hooks",
|
196
|
-
onFinish: onMyFinish
|
197
|
-
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
198
|
-
label: "\u540D\u79F0",
|
199
|
-
name: "id",
|
200
|
-
style: {
|
201
|
-
marginBottom: '15px'
|
202
|
-
},
|
203
|
-
rules: [{
|
204
|
-
required: true
|
205
|
-
}]
|
206
|
-
}, /*#__PURE__*/React.createElement(_Input, {
|
207
|
-
disabled: isNameDisabled
|
208
|
-
})), /*#__PURE__*/React.createElement(_Form.Item, {
|
209
|
-
label: "\u7C7B\u578B",
|
210
|
-
name: "type",
|
211
|
-
style: {
|
212
|
-
marginBottom: '15px'
|
213
|
-
},
|
214
|
-
rules: [{
|
215
|
-
required: true
|
216
|
-
}]
|
217
|
-
}, /*#__PURE__*/React.createElement(_Select, {
|
218
|
-
options: OUTERMOST_TYPES_OPTIONS,
|
219
|
-
onChange: onOuterTypeChange,
|
220
|
-
getPopupContainer: function getPopupContainer(triggerNode) {
|
221
|
-
return triggerNode.parentNode;
|
222
|
-
}
|
223
|
-
})), outerType === 'object' && /*#__PURE__*/React.createElement(MetaPropsEdit, {
|
224
|
-
form: form,
|
225
|
-
metadataTag: metadataTag,
|
226
|
-
name: "properties",
|
227
|
-
onAddFields: onAddFields,
|
228
|
-
onNewRefClick: onNewRefClick
|
229
|
-
}), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
|
230
|
-
type: "primary",
|
231
|
-
block: true,
|
232
|
-
htmlType: "submit"
|
233
|
-
}, "\u786E\u5B9A"))), /*#__PURE__*/React.createElement(_Drawer, {
|
234
|
-
title: (curFields === null || curFields === void 0 ? void 0 : curFields.id) || 'fields',
|
235
|
-
width: 450,
|
236
|
-
bodyStyle: {
|
237
|
-
padding: 0
|
238
|
-
},
|
239
|
-
placement: "right",
|
240
|
-
onClose: function onClose() {
|
241
|
-
setIsFields(false);
|
242
|
-
},
|
243
|
-
mask: false,
|
244
|
-
push: false,
|
245
|
-
visible: isFields,
|
246
|
-
destroyOnClose: true
|
247
|
-
}, /*#__PURE__*/React.createElement(MetaFieldsEdit, {
|
248
|
-
key: curFields === null || curFields === void 0 ? void 0 : curFields.id,
|
249
|
-
type: curFields === null || curFields === void 0 ? void 0 : curFields.type,
|
250
|
-
defaultValues: fields[curFields.id],
|
251
|
-
onChange: onFieldsChange
|
252
|
-
})));
|
253
|
-
};
|
254
|
-
|
255
|
-
export default MetadataEdit;
|
@@ -1,237 +0,0 @@
|
|
1
|
-
import "antd/es/button/style";
|
2
|
-
import _Button from "antd/es/button";
|
3
|
-
import "antd/es/switch/style";
|
4
|
-
import _Switch from "antd/es/switch";
|
5
|
-
import "antd/es/input-number/style";
|
6
|
-
import _InputNumber from "antd/es/input-number";
|
7
|
-
import "antd/es/select/style";
|
8
|
-
import _Select from "antd/es/select";
|
9
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
10
|
-
import "antd/es/input/style";
|
11
|
-
import _Input from "antd/es/input";
|
12
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
13
|
-
import "antd/es/form/style";
|
14
|
-
import _Form from "antd/es/form";
|
15
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
16
|
-
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
17
|
-
import React from 'react';
|
18
|
-
import { RULE_TYPES_OPTIONS } from '../constant';
|
19
|
-
import { useMetaType } from '../hooks';
|
20
|
-
import MetadataForm from '../../MetadataForm';
|
21
|
-
|
22
|
-
var MetaFieldsEdit = function MetaFieldsEdit(props) {
|
23
|
-
var defaultValues = props.defaultValues,
|
24
|
-
onChange = props.onChange;
|
25
|
-
|
26
|
-
var _Form$useForm = _Form.useForm(),
|
27
|
-
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
28
|
-
form = _Form$useForm2[0];
|
29
|
-
|
30
|
-
var _React$useState = React.useState({}),
|
31
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
32
|
-
ruleTypes = _React$useState2[0],
|
33
|
-
setRuleTypes = _React$useState2[1];
|
34
|
-
|
35
|
-
var _React$useState3 = React.useState({}),
|
36
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
37
|
-
refIds = _React$useState4[0],
|
38
|
-
setRefIds = _React$useState4[1];
|
39
|
-
|
40
|
-
var _React$useState5 = React.useState({}),
|
41
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
42
|
-
refValues = _React$useState6[0],
|
43
|
-
setRefValues = _React$useState6[1];
|
44
|
-
|
45
|
-
var metaType = useMetaType('扩展规则');
|
46
|
-
React.useEffect(function () {
|
47
|
-
if (defaultValues) {
|
48
|
-
// console.log('defaultValues', defaultValues);
|
49
|
-
form.setFieldsValue({
|
50
|
-
fields: defaultValues
|
51
|
-
});
|
52
|
-
var _ruleTypes = ruleTypes;
|
53
|
-
var _refIds = refIds;
|
54
|
-
|
55
|
-
for (var i = 0; i < defaultValues.length; i++) {
|
56
|
-
_ruleTypes[i] = defaultValues[i].type;
|
57
|
-
|
58
|
-
if (defaultValues[i].type === 'ref') {
|
59
|
-
_refIds[i] = defaultValues[i].refId;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
|
63
|
-
setRefIds(_objectSpread({}, _refIds));
|
64
|
-
setRuleTypes(_objectSpread({}, _ruleTypes));
|
65
|
-
}
|
66
|
-
}, [defaultValues, form]);
|
67
|
-
|
68
|
-
var onFinish = function onFinish(values) {
|
69
|
-
var _fields = values.fields;
|
70
|
-
|
71
|
-
for (var i = 0; i < _fields.length; i++) {
|
72
|
-
if (_fields[i].type === 'ref') {
|
73
|
-
_fields[i].value = refValues[i] || _fields[i].value;
|
74
|
-
}
|
75
|
-
} // console.log('_fields', _fields);
|
76
|
-
|
77
|
-
|
78
|
-
onChange && onChange(_fields);
|
79
|
-
};
|
80
|
-
|
81
|
-
var onRefRulesValuesChange = function onRefRulesValuesChange(values, idx) {
|
82
|
-
// console.log('onRefRulesValuesChange', values, refValues);
|
83
|
-
var _refValues = refValues;
|
84
|
-
_refValues[idx] = _refValues[idx] ? _objectSpread(_objectSpread({}, _refValues[idx]), values) : _objectSpread({}, values);
|
85
|
-
setRefValues(_objectSpread({}, _refValues));
|
86
|
-
};
|
87
|
-
|
88
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form, {
|
89
|
-
className: "metadata-edit",
|
90
|
-
style: {
|
91
|
-
position: 'relative'
|
92
|
-
},
|
93
|
-
form: form,
|
94
|
-
name: "control-hooks",
|
95
|
-
onFinish: onFinish
|
96
|
-
}, /*#__PURE__*/React.createElement("div", {
|
97
|
-
style: {
|
98
|
-
padding: '10px'
|
99
|
-
}
|
100
|
-
}, /*#__PURE__*/React.createElement(_Form.List, {
|
101
|
-
name: "fields"
|
102
|
-
}, function (fields, _ref) {
|
103
|
-
var add = _ref.add,
|
104
|
-
remove = _ref.remove;
|
105
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, index) {
|
106
|
-
var _defaultValues$index;
|
107
|
-
|
108
|
-
// console.log('fields=========', fields);
|
109
|
-
return /*#__PURE__*/React.createElement("div", {
|
110
|
-
key: field.key
|
111
|
-
}, /*#__PURE__*/React.createElement("div", {
|
112
|
-
style: {
|
113
|
-
display: 'flex',
|
114
|
-
alignItems: 'flex-start'
|
115
|
-
}
|
116
|
-
}, /*#__PURE__*/React.createElement(_Form.Item, _extends({
|
117
|
-
className: "pr-10"
|
118
|
-
}, field, {
|
119
|
-
label: "\u89C4\u5219\u540D\u79F0",
|
120
|
-
name: [field.name, 'id'],
|
121
|
-
fieldKey: [field.fieldKey, 'id'],
|
122
|
-
rules: [{
|
123
|
-
required: true
|
124
|
-
}]
|
125
|
-
}), /*#__PURE__*/React.createElement(_Input, {
|
126
|
-
style: {
|
127
|
-
width: '120px'
|
128
|
-
}
|
129
|
-
})), /*#__PURE__*/React.createElement(_Form.Item, _extends({
|
130
|
-
className: "pr-10"
|
131
|
-
}, field, {
|
132
|
-
label: "\u89C4\u5219\u7C7B\u578B",
|
133
|
-
name: [field.name, 'type'],
|
134
|
-
fieldKey: [field.fieldKey, 'type'],
|
135
|
-
rules: [{
|
136
|
-
required: true
|
137
|
-
}]
|
138
|
-
}), /*#__PURE__*/React.createElement(_Select, {
|
139
|
-
style: {
|
140
|
-
width: '120px'
|
141
|
-
},
|
142
|
-
onChange: function onChange(value) {
|
143
|
-
var _ruleTypes = ruleTypes;
|
144
|
-
_ruleTypes[index] = value;
|
145
|
-
setRuleTypes(_objectSpread({}, _ruleTypes));
|
146
|
-
},
|
147
|
-
options: RULE_TYPES_OPTIONS
|
148
|
-
})), ruleTypes[index] === 'text' && /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
149
|
-
label: "\u89C4\u5219\u503C",
|
150
|
-
name: [field.name, 'value'],
|
151
|
-
fieldKey: [field.fieldKey, 'value'],
|
152
|
-
rules: [{
|
153
|
-
required: true
|
154
|
-
}]
|
155
|
-
}), /*#__PURE__*/React.createElement(_Input, {
|
156
|
-
style: {
|
157
|
-
width: '120px'
|
158
|
-
}
|
159
|
-
})), ruleTypes[index] === 'number' && /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
160
|
-
label: "\u89C4\u5219\u503C",
|
161
|
-
name: [field.name, 'value'],
|
162
|
-
fieldKey: [field.fieldKey, 'value'],
|
163
|
-
rules: [{
|
164
|
-
required: true
|
165
|
-
}]
|
166
|
-
}), /*#__PURE__*/React.createElement(_InputNumber, {
|
167
|
-
style: {
|
168
|
-
width: '120px'
|
169
|
-
}
|
170
|
-
})), ruleTypes[index] === 'bool' && /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
171
|
-
label: "\u89C4\u5219\u503C",
|
172
|
-
name: [field.name, 'value'],
|
173
|
-
fieldKey: [field.fieldKey, 'value'],
|
174
|
-
rules: [{
|
175
|
-
required: true
|
176
|
-
}]
|
177
|
-
}), /*#__PURE__*/React.createElement(_Switch, null)), ruleTypes[index] === 'ref' && /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
178
|
-
label: "Ref",
|
179
|
-
name: [field.name, 'refId'],
|
180
|
-
fieldKey: [field.fieldKey, 'refId'],
|
181
|
-
rules: [{
|
182
|
-
required: true
|
183
|
-
}]
|
184
|
-
}), /*#__PURE__*/React.createElement(_Select, {
|
185
|
-
style: {
|
186
|
-
width: '120px'
|
187
|
-
},
|
188
|
-
onChange: function onChange(value) {
|
189
|
-
var _refIds = refIds;
|
190
|
-
_refIds[index] = value;
|
191
|
-
setRefIds(_objectSpread({}, _refIds));
|
192
|
-
var newData = form.getFieldValue('fields'); // console.log('newData', newData);
|
193
|
-
|
194
|
-
newData[index].id = value;
|
195
|
-
form.setFieldsValue({
|
196
|
-
fields: newData
|
197
|
-
});
|
198
|
-
},
|
199
|
-
options: metaType || []
|
200
|
-
})), /*#__PURE__*/React.createElement("div", {
|
201
|
-
style: {
|
202
|
-
lineHeight: '88px',
|
203
|
-
paddingLeft: '15px'
|
204
|
-
}
|
205
|
-
}, /*#__PURE__*/React.createElement(MinusCircleOutlined, {
|
206
|
-
onClick: function onClick() {
|
207
|
-
return remove(field.name);
|
208
|
-
}
|
209
|
-
}))), refIds[index] && /*#__PURE__*/React.createElement("div", {
|
210
|
-
style: {
|
211
|
-
border: '1px solid var(--ronds-metadata-color-border-1)',
|
212
|
-
padding: '10px',
|
213
|
-
marginBottom: '10px'
|
214
|
-
}
|
215
|
-
}, /*#__PURE__*/React.createElement(MetadataForm, {
|
216
|
-
initialValues: defaultValues && defaultValues.length > 0 && ((_defaultValues$index = defaultValues[index]) === null || _defaultValues$index === void 0 ? void 0 : _defaultValues$index.value),
|
217
|
-
refId: refIds[index],
|
218
|
-
onValuesChange: function onValuesChange(values, allValues) {
|
219
|
-
onRefRulesValuesChange(allValues, index);
|
220
|
-
}
|
221
|
-
})));
|
222
|
-
}), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
|
223
|
-
type: "dashed",
|
224
|
-
onClick: function onClick() {
|
225
|
-
return add();
|
226
|
-
},
|
227
|
-
block: true,
|
228
|
-
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
229
|
-
}, "\u6DFB\u52A0\u6269\u5C55\u89C4\u5219")));
|
230
|
-
}), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
|
231
|
-
type: "primary",
|
232
|
-
block: true,
|
233
|
-
htmlType: "submit"
|
234
|
-
}, "\u786E\u5B9A")))));
|
235
|
-
};
|
236
|
-
|
237
|
-
export default MetaFieldsEdit;
|