ronds-metadata 1.2.10 → 1.2.11
Sign up to get free protection for your applications and to get access to all the features.
- package/es/api/index.js +249 -0
- package/es/comps/DynamicPorts/comps/ContextMenu.js +44 -0
- package/es/comps/DynamicPorts/comps/DragNode.js +55 -0
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +51 -0
- package/es/comps/DynamicPorts/comps/NodeElement.js +30 -0
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +42 -0
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +40 -0
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +55 -0
- package/es/comps/DynamicPorts/comps/shape/connector.js +19 -0
- package/es/comps/DynamicPorts/comps/shape/edge.js +91 -0
- package/es/comps/DynamicPorts/comps/shape/node.js +190 -0
- package/es/comps/DynamicPorts/constant/index.js +19 -0
- package/es/comps/DynamicPorts/graph.js +697 -0
- package/es/comps/DynamicPorts/index.js +143 -0
- package/es/comps/DynamicPorts/interface.js +6 -0
- package/es/comps/DynamicPorts/utils.js +127 -0
- package/es/comps/Editable/DataCell/ButtonCell.js +45 -0
- package/es/comps/Editable/DataCell/ColorPicker.js +33 -0
- package/es/comps/Editable/DataCell/Input.js +54 -0
- package/es/comps/Editable/DataCell/Number.js +44 -0
- package/es/comps/Editable/DataCell/Select.js +48 -0
- package/es/comps/Editable/DataCell/Switch.js +33 -0
- package/es/comps/Editable/comps/EditableAction.js +110 -0
- package/es/comps/Editable/comps/EditableCell.js +108 -0
- package/es/comps/Editable/comps/EditableHeardCell.js +172 -0
- package/es/comps/Editable/comps/EditableRow.js +118 -0
- package/es/comps/Editable/comps/Texty.js +277 -0
- package/es/comps/Editable/index.js +386 -0
- package/es/comps/Editable/interface.js +8 -0
- package/es/comps/Editable/utils.js +46 -0
- package/es/comps/FileView/index.js +198 -0
- package/es/comps/FormGenerator/Provider.js +8 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +69 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +16 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +50 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +55 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +14 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +50 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +69 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +55 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +13 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +50 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +14 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +27 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +261 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +62 -0
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +315 -0
- package/es/comps/FormGenerator/comps/Canvas/index.js +120 -0
- package/es/comps/FormGenerator/comps/Settings/index.js +150 -0
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +48 -0
- package/es/comps/FormGenerator/comps/Sidebar/index.js +37 -0
- package/es/comps/FormGenerator/index.js +68 -0
- package/es/comps/FormGenerator/settings/index.js +367 -0
- package/es/comps/FormGenerator/settings/ruleConfig.js +557 -0
- package/es/comps/FormGenerator/transformer.js +300 -0
- package/es/comps/Icons/index.js +23 -0
- package/es/comps/JsonEdit/constant/index.js +87 -0
- package/es/comps/JsonEdit/index.js +221 -0
- package/es/comps/JsonView/index.js +109 -0
- package/es/comps/MdEdit/index.js +41 -0
- package/es/comps/MdNavbar/index.js +180 -0
- package/es/comps/MdNavbar/utils.js +34 -0
- package/es/comps/MdView/index.js +70 -0
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +419 -0
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +368 -0
- package/es/comps/MetadataEdit/constant/index.js +69 -0
- package/es/comps/MetadataEdit/hooks/index.js +43 -0
- package/es/comps/MetadataEdit/index.js +255 -0
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +237 -0
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +367 -0
- package/es/comps/MetadataEditV2/constant/index.js +69 -0
- package/es/comps/MetadataEditV2/hooks/index.js +43 -0
- package/es/comps/MetadataEditV2/index.js +298 -0
- package/es/comps/MetadataForm/DataCell/Array.js +148 -0
- package/es/comps/MetadataForm/DataCell/Input.js +198 -0
- package/es/comps/MetadataForm/DataCell/Number.js +130 -0
- package/es/comps/MetadataForm/DataCell/Ref.js +326 -0
- package/es/comps/MetadataForm/DataCell/Select.js +557 -0
- package/es/comps/MetadataForm/DataCell/Switch.js +115 -0
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +359 -0
- package/es/comps/MetadataForm/HOC/index.js +125 -0
- package/es/comps/MetadataForm/constants.js +11 -0
- package/es/comps/MetadataForm/hooks/index.js +128 -0
- package/es/comps/MetadataForm/index.js +268 -0
- package/es/comps/MetadataForm/interface.js +8 -0
- package/es/comps/MetadataForm/utils.js +112 -0
- package/es/comps/locales/en-US.js +24 -0
- package/es/comps/locales/index.js +8 -0
- package/es/comps/locales/zh-CN.js +24 -0
- package/es/config.js +50 -0
- package/es/framework/graph/index.js +515 -0
- package/es/framework/hooks/use-async-memo.js +32 -0
- package/es/framework/hooks/use-sync-scroll.js +106 -0
- package/es/framework/http/cache.js +137 -0
- package/es/framework/http/cancel.js +44 -0
- package/es/framework/http/index.js +392 -0
- package/es/framework/http/msgpack.js +34 -0
- package/es/framework/http/msgpack5/index.js +84 -0
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +71 -0
- package/es/framework/http/msgpack5/lib/decoder.js +287 -0
- package/es/framework/http/msgpack5/lib/encoder.js +252 -0
- package/es/framework/http/msgpack5/lib/helpers.js +23 -0
- package/es/framework/http/msgpack5/lib/streams.js +93 -0
- package/es/framework/http/types.js +1 -0
- package/es/framework/libs/jquery.min.js +4022 -0
- package/es/framework/locale/dil8/di18n.js +132 -0
- package/es/framework/locale/dil8/index.js +3 -0
- package/es/framework/locale/dil8/translate.js +76 -0
- package/es/framework/locale/dil8/util.js +17 -0
- package/es/framework/locale/index.js +26 -0
- package/es/framework/metadata/MetadataService.js +169 -0
- package/es/framework/metadata/index.js +384 -0
- package/es/framework/rxjs-hooks/useMemoSubject.js +16 -0
- package/es/framework/rxjs-hooks/useObservable.js +22 -0
- package/es/framework/rxjs-hooks/useObservableState.js +45 -0
- package/es/index.js +27 -0
- package/es/utils.js +138 -0
- package/package.json +1 -1
@@ -0,0 +1,368 @@
|
|
1
|
+
import "antd/es/space/style";
|
2
|
+
import _Space from "antd/es/space";
|
3
|
+
import "antd/es/tooltip/style";
|
4
|
+
import _Tooltip from "antd/es/tooltip";
|
5
|
+
import "antd/es/button/style";
|
6
|
+
import _Button from "antd/es/button";
|
7
|
+
import "antd/es/select/style";
|
8
|
+
import _Select from "antd/es/select";
|
9
|
+
import "antd/es/form/style";
|
10
|
+
import _Form from "antd/es/form";
|
11
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
12
|
+
import "antd/es/input/style";
|
13
|
+
import _Input from "antd/es/input";
|
14
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
15
|
+
import React from 'react';
|
16
|
+
import { MinusCircleOutlined, PlusOutlined, ReloadOutlined } from '@ant-design/icons';
|
17
|
+
import { ARRAY_TYPES_OPTIONS, BASIC_TYPES_OPTIONS, NUMBER_FORMAT_OPTIONS } from '../constant';
|
18
|
+
import { useMetaType } from '../hooks';
|
19
|
+
import { guid } from '../../../utils';
|
20
|
+
|
21
|
+
var MetaPropsEdit = function MetaPropsEdit(props) {
|
22
|
+
var form = props.form,
|
23
|
+
id = props.id,
|
24
|
+
metadataTag = props.metadataTag,
|
25
|
+
name = props.name,
|
26
|
+
_props$isAddFields = props.isAddFields,
|
27
|
+
isAddFields = _props$isAddFields === void 0 ? true : _props$isAddFields,
|
28
|
+
onAddFields = props.onAddFields,
|
29
|
+
onNewRefClick = props.onNewRefClick;
|
30
|
+
|
31
|
+
var _React$useState = React.useState(true),
|
32
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
33
|
+
refresh = _React$useState2[0],
|
34
|
+
setRefresh = _React$useState2[1];
|
35
|
+
|
36
|
+
var metaType = useMetaType(metadataTag, refresh);
|
37
|
+
|
38
|
+
var onTypeChange = function onTypeChange(idx) {
|
39
|
+
var _properties$idx, _properties$idx2;
|
40
|
+
|
41
|
+
var _properties = form.getFieldValue('properties') || [];
|
42
|
+
|
43
|
+
var __properties = {
|
44
|
+
id: (_properties$idx = _properties[idx]) === null || _properties$idx === void 0 ? void 0 : _properties$idx.id,
|
45
|
+
type: (_properties$idx2 = _properties[idx]) === null || _properties$idx2 === void 0 ? void 0 : _properties$idx2.type
|
46
|
+
};
|
47
|
+
_properties[idx] = __properties;
|
48
|
+
form.setFieldsValue({
|
49
|
+
properties: _properties
|
50
|
+
});
|
51
|
+
};
|
52
|
+
|
53
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form.List, {
|
54
|
+
name: name
|
55
|
+
}, function (fields, _ref) {
|
56
|
+
var add = _ref.add,
|
57
|
+
remove = _ref.remove;
|
58
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, index) {
|
59
|
+
return /*#__PURE__*/React.createElement("div", {
|
60
|
+
key: guid()
|
61
|
+
}, /*#__PURE__*/React.createElement("div", {
|
62
|
+
style: {
|
63
|
+
display: 'flex',
|
64
|
+
alignItems: 'flex-end'
|
65
|
+
}
|
66
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, _extends({
|
67
|
+
key: field.key,
|
68
|
+
className: "pr-10"
|
69
|
+
}, field, {
|
70
|
+
label: "\u5C5E\u6027\u540D\u79F0",
|
71
|
+
name: [field.name, 'id'],
|
72
|
+
fieldKey: [field.fieldKey, 'id'],
|
73
|
+
rules: [{
|
74
|
+
required: true
|
75
|
+
}]
|
76
|
+
}), /*#__PURE__*/React.createElement(_Input, null)), /*#__PURE__*/React.createElement(_Form.Item, _extends({
|
77
|
+
key: field.key
|
78
|
+
}, field, {
|
79
|
+
label: "\u5C5E\u6027\u7C7B\u578B",
|
80
|
+
name: [field.name, 'type'],
|
81
|
+
fieldKey: [field.fieldKey, 'type'],
|
82
|
+
rules: [{
|
83
|
+
required: true
|
84
|
+
}]
|
85
|
+
}), /*#__PURE__*/React.createElement(_Select, {
|
86
|
+
style: {
|
87
|
+
width: '120px'
|
88
|
+
},
|
89
|
+
options: BASIC_TYPES_OPTIONS,
|
90
|
+
onChange: function onChange() {
|
91
|
+
onTypeChange(index);
|
92
|
+
},
|
93
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
94
|
+
return triggerNode.parentNode;
|
95
|
+
}
|
96
|
+
})), /*#__PURE__*/React.createElement("div", {
|
97
|
+
style: {
|
98
|
+
lineHeight: '88px',
|
99
|
+
paddingLeft: '15px'
|
100
|
+
}
|
101
|
+
}, /*#__PURE__*/React.createElement(MinusCircleOutlined, {
|
102
|
+
onClick: function onClick() {
|
103
|
+
return remove(field.name);
|
104
|
+
}
|
105
|
+
})), onAddFields && /*#__PURE__*/React.createElement(_Form.Item, {
|
106
|
+
style: {
|
107
|
+
flex: 1,
|
108
|
+
textAlign: 'right'
|
109
|
+
}
|
110
|
+
}, /*#__PURE__*/React.createElement(_Tooltip, {
|
111
|
+
title: "\u6DFB\u52A0\u6269\u5C55\u89C4\u5219"
|
112
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
113
|
+
shape: "circle",
|
114
|
+
size: "small",
|
115
|
+
type: "primary",
|
116
|
+
onClick: function onClick() {
|
117
|
+
onAddFields(index);
|
118
|
+
},
|
119
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
120
|
+
})))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Form.Item, {
|
121
|
+
noStyle: true,
|
122
|
+
shouldUpdate: function shouldUpdate(prevValues, currentValues) {
|
123
|
+
var _prevValues$name$inde, _currentValues$name$i, _prevValues$name$inde2, _currentValues$name$i2;
|
124
|
+
|
125
|
+
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);
|
126
|
+
}
|
127
|
+
}, function (_ref2) {
|
128
|
+
var _properties$index, _properties$index2, _properties$index2$it, _properties$index3, _properties$index3$it;
|
129
|
+
|
130
|
+
var getFieldValue = _ref2.getFieldValue;
|
131
|
+
|
132
|
+
var _properties = getFieldValue(name);
|
133
|
+
|
134
|
+
switch ((_properties$index = _properties[index]) === null || _properties$index === void 0 ? void 0 : _properties$index.type) {
|
135
|
+
case 'number':
|
136
|
+
return /*#__PURE__*/React.createElement("div", {
|
137
|
+
style: {
|
138
|
+
border: 'var(--ronds-metadata-color-border-1)',
|
139
|
+
padding: '10px',
|
140
|
+
marginBottom: '10px'
|
141
|
+
}
|
142
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
143
|
+
label: "format",
|
144
|
+
name: [field.name, 'format'],
|
145
|
+
fieldKey: [field.fieldKey, 'format'],
|
146
|
+
rules: [{
|
147
|
+
required: true
|
148
|
+
}]
|
149
|
+
}), /*#__PURE__*/React.createElement(_Select, {
|
150
|
+
style: {
|
151
|
+
width: '180px'
|
152
|
+
},
|
153
|
+
options: NUMBER_FORMAT_OPTIONS,
|
154
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
155
|
+
return triggerNode.parentNode;
|
156
|
+
}
|
157
|
+
})));
|
158
|
+
|
159
|
+
case 'ref':
|
160
|
+
return /*#__PURE__*/React.createElement("div", {
|
161
|
+
style: {
|
162
|
+
border: '1px solid var(--ronds-metadata-color-border-1)',
|
163
|
+
padding: '10px',
|
164
|
+
display: 'flex',
|
165
|
+
alignItems: 'center',
|
166
|
+
marginBottom: '10px'
|
167
|
+
}
|
168
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
169
|
+
label: "Ref",
|
170
|
+
name: [field.name, 'refId'],
|
171
|
+
fieldKey: [field.fieldKey, 'refId'],
|
172
|
+
rules: [{
|
173
|
+
required: true
|
174
|
+
}]
|
175
|
+
}), /*#__PURE__*/React.createElement(_Select, {
|
176
|
+
style: {
|
177
|
+
width: '180px'
|
178
|
+
},
|
179
|
+
options: metaType || [],
|
180
|
+
showSearch: true,
|
181
|
+
filterOption: function filterOption(input, option) {
|
182
|
+
return (option === null || option === void 0 ? void 0 : option.label.indexOf(input)) >= 0;
|
183
|
+
},
|
184
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
185
|
+
return triggerNode.parentNode;
|
186
|
+
},
|
187
|
+
allowClear: true
|
188
|
+
})), /*#__PURE__*/React.createElement("div", {
|
189
|
+
style: {
|
190
|
+
padding: '0 10px'
|
191
|
+
}
|
192
|
+
}, /*#__PURE__*/React.createElement(_Tooltip, {
|
193
|
+
title: "\u6DFB\u52A0\u5F15\u7528\u7C7B\u578B"
|
194
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
195
|
+
shape: "circle",
|
196
|
+
size: "small",
|
197
|
+
type: "primary",
|
198
|
+
onClick: function onClick() {
|
199
|
+
onNewRefClick && onNewRefClick();
|
200
|
+
},
|
201
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
202
|
+
})), /*#__PURE__*/React.createElement(_Tooltip, {
|
203
|
+
title: "\u5237\u65B0"
|
204
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
205
|
+
shape: "circle",
|
206
|
+
size: "small",
|
207
|
+
style: {
|
208
|
+
marginLeft: '10px'
|
209
|
+
},
|
210
|
+
onClick: function onClick() {
|
211
|
+
setRefresh(false);
|
212
|
+
setTimeout(function () {
|
213
|
+
setRefresh(true);
|
214
|
+
}, 100);
|
215
|
+
},
|
216
|
+
icon: /*#__PURE__*/React.createElement(ReloadOutlined, null)
|
217
|
+
}))));
|
218
|
+
|
219
|
+
case 'array':
|
220
|
+
return /*#__PURE__*/React.createElement("div", {
|
221
|
+
style: {
|
222
|
+
border: '1px solid var(--ronds-metadata-color-border-1)',
|
223
|
+
borderRadius: '5px',
|
224
|
+
padding: '10px',
|
225
|
+
marginBottom: '10px',
|
226
|
+
display: 'flex',
|
227
|
+
alignItems: 'center'
|
228
|
+
}
|
229
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
230
|
+
label: "Array",
|
231
|
+
className: "pr-10",
|
232
|
+
name: [field.name, 'items', 'type'],
|
233
|
+
fieldKey: [field.fieldKey, 'items', 'type'],
|
234
|
+
rules: [{
|
235
|
+
required: true
|
236
|
+
}]
|
237
|
+
}), /*#__PURE__*/React.createElement(_Select, {
|
238
|
+
style: {
|
239
|
+
width: '180px'
|
240
|
+
},
|
241
|
+
options: ARRAY_TYPES_OPTIONS,
|
242
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
243
|
+
return triggerNode.parentNode;
|
244
|
+
}
|
245
|
+
})), _properties && ((_properties$index2 = _properties[index]) === null || _properties$index2 === void 0 ? void 0 : (_properties$index2$it = _properties$index2.items) === null || _properties$index2$it === void 0 ? void 0 : _properties$index2$it.type) === 'ref' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
246
|
+
label: "Ref",
|
247
|
+
name: [field.name, 'items', 'refId'],
|
248
|
+
fieldKey: [field.fieldKey, 'items', 'refId'],
|
249
|
+
rules: [{
|
250
|
+
required: true
|
251
|
+
}]
|
252
|
+
}), /*#__PURE__*/React.createElement(_Select, {
|
253
|
+
style: {
|
254
|
+
width: '180px'
|
255
|
+
},
|
256
|
+
options: metaType || [],
|
257
|
+
showSearch: true,
|
258
|
+
filterOption: function filterOption(input, option) {
|
259
|
+
return (option === null || option === void 0 ? void 0 : option.label.indexOf(input)) >= 0;
|
260
|
+
},
|
261
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
262
|
+
return triggerNode.parentNode;
|
263
|
+
}
|
264
|
+
})), /*#__PURE__*/React.createElement("div", {
|
265
|
+
style: {
|
266
|
+
padding: '0 10px'
|
267
|
+
}
|
268
|
+
}, /*#__PURE__*/React.createElement(_Tooltip, {
|
269
|
+
title: "\u6DFB\u52A0\u5F15\u7528\u7C7B\u578B"
|
270
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
271
|
+
shape: "circle",
|
272
|
+
size: "small",
|
273
|
+
type: "primary",
|
274
|
+
onClick: function onClick() {
|
275
|
+
onNewRefClick && onNewRefClick();
|
276
|
+
},
|
277
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
278
|
+
})), /*#__PURE__*/React.createElement(_Tooltip, {
|
279
|
+
title: "\u5237\u65B0"
|
280
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
281
|
+
shape: "circle",
|
282
|
+
size: "small",
|
283
|
+
style: {
|
284
|
+
marginLeft: '10px'
|
285
|
+
},
|
286
|
+
onClick: function onClick() {
|
287
|
+
setRefresh(false);
|
288
|
+
setTimeout(function () {
|
289
|
+
setRefresh(true);
|
290
|
+
}, 100);
|
291
|
+
},
|
292
|
+
icon: /*#__PURE__*/React.createElement(ReloadOutlined, null)
|
293
|
+
})))), _properties && ((_properties$index3 = _properties[index]) === null || _properties$index3 === void 0 ? void 0 : (_properties$index3$it = _properties$index3.items) === null || _properties$index3$it === void 0 ? void 0 : _properties$index3$it.type) === 'number' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
294
|
+
label: "format",
|
295
|
+
name: [field.name, 'items', 'format'],
|
296
|
+
fieldKey: [field.fieldKey, 'items', 'format'],
|
297
|
+
rules: [{
|
298
|
+
required: true
|
299
|
+
}]
|
300
|
+
}), /*#__PURE__*/React.createElement(_Select, {
|
301
|
+
style: {
|
302
|
+
width: '180px'
|
303
|
+
},
|
304
|
+
options: NUMBER_FORMAT_OPTIONS,
|
305
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
306
|
+
return triggerNode.parentNode;
|
307
|
+
}
|
308
|
+
}))));
|
309
|
+
|
310
|
+
case 'enum':
|
311
|
+
return /*#__PURE__*/React.createElement("div", {
|
312
|
+
style: {
|
313
|
+
border: '1px solid var(--ronds-metadata-color-border-1)',
|
314
|
+
padding: '10px',
|
315
|
+
marginBottom: '10px'
|
316
|
+
}
|
317
|
+
}, /*#__PURE__*/React.createElement(_Form.List, {
|
318
|
+
name: [field.name, 'enum']
|
319
|
+
}, function (enumFields, operation) {
|
320
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, enumFields.map(function (enumField) {
|
321
|
+
return /*#__PURE__*/React.createElement(_Space, {
|
322
|
+
key: "enumField-".concat(enumField.key),
|
323
|
+
align: "baseline"
|
324
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
325
|
+
className: "pr-10",
|
326
|
+
label: "Enum",
|
327
|
+
name: [enumField.name, 'value'],
|
328
|
+
fieldKey: [enumField.fieldKey, 'value'],
|
329
|
+
rules: [{
|
330
|
+
required: true
|
331
|
+
}]
|
332
|
+
}), /*#__PURE__*/React.createElement(_Input, null)), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
|
333
|
+
onClick: function onClick() {
|
334
|
+
return operation.remove(enumField.name);
|
335
|
+
}
|
336
|
+
}));
|
337
|
+
}), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
|
338
|
+
type: "dashed",
|
339
|
+
onClick: function onClick() {
|
340
|
+
return operation.add();
|
341
|
+
},
|
342
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
343
|
+
}, "\u6DFB\u52A0Enum")));
|
344
|
+
}));
|
345
|
+
|
346
|
+
default:
|
347
|
+
return null;
|
348
|
+
}
|
349
|
+
})));
|
350
|
+
}), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
|
351
|
+
type: "dashed",
|
352
|
+
onClick: function onClick() {
|
353
|
+
return add();
|
354
|
+
},
|
355
|
+
block: true,
|
356
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
357
|
+
}, "\u6DFB\u52A0".concat(name, "\u540D\u79F0"))), isAddFields && /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
|
358
|
+
type: "dashed",
|
359
|
+
onClick: function onClick() {
|
360
|
+
onAddFields(-1);
|
361
|
+
},
|
362
|
+
block: true,
|
363
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
364
|
+
}, "\u6DFB\u52A0\u6269\u5C55\u89C4\u5219")));
|
365
|
+
}));
|
366
|
+
};
|
367
|
+
|
368
|
+
export default MetaPropsEdit;
|
@@ -0,0 +1,69 @@
|
|
1
|
+
export var BASIC_TYPES_OPTIONS = [{
|
2
|
+
label: '数字',
|
3
|
+
value: 'number'
|
4
|
+
}, {
|
5
|
+
label: '文本',
|
6
|
+
value: 'text'
|
7
|
+
}, {
|
8
|
+
label: '布尔类型',
|
9
|
+
value: 'bool'
|
10
|
+
}, {
|
11
|
+
label: '枚举类型',
|
12
|
+
value: 'enum'
|
13
|
+
}, {
|
14
|
+
label: '数组',
|
15
|
+
value: 'array'
|
16
|
+
}, {
|
17
|
+
label: '引用类型',
|
18
|
+
value: 'ref'
|
19
|
+
}];
|
20
|
+
export var ARRAY_TYPES_OPTIONS = [{
|
21
|
+
label: '数字',
|
22
|
+
value: 'number'
|
23
|
+
}, {
|
24
|
+
label: '文本',
|
25
|
+
value: 'text'
|
26
|
+
}, {
|
27
|
+
label: '布尔类型',
|
28
|
+
value: 'bool'
|
29
|
+
}, {
|
30
|
+
label: '引用类型',
|
31
|
+
value: 'ref'
|
32
|
+
}];
|
33
|
+
export var OUTERMOST_TYPES_OPTIONS = [{
|
34
|
+
label: '对象',
|
35
|
+
value: 'object'
|
36
|
+
}, {
|
37
|
+
label: '数字',
|
38
|
+
value: 'number'
|
39
|
+
}, {
|
40
|
+
label: '文本',
|
41
|
+
value: 'text'
|
42
|
+
}, {
|
43
|
+
label: '布尔类型',
|
44
|
+
value: 'bool'
|
45
|
+
}];
|
46
|
+
export var RULE_TYPES_OPTIONS = [{
|
47
|
+
label: '引用',
|
48
|
+
value: 'ref'
|
49
|
+
}, {
|
50
|
+
label: '数字',
|
51
|
+
value: 'number'
|
52
|
+
}, {
|
53
|
+
label: '文本',
|
54
|
+
value: 'text'
|
55
|
+
}, {
|
56
|
+
label: '布尔类型',
|
57
|
+
value: 'bool'
|
58
|
+
}];
|
59
|
+
export var NUMBER_FORMAT_OPTIONS = [{
|
60
|
+
label: 'int',
|
61
|
+
value: 'int'
|
62
|
+
}, {
|
63
|
+
label: 'double',
|
64
|
+
value: 'double'
|
65
|
+
}];
|
66
|
+
export var REF_OPTIONS = [{
|
67
|
+
label: '表单扩展规则',
|
68
|
+
value: 'FormRules'
|
69
|
+
}];
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
|
3
|
+
/*
|
4
|
+
* @Author: wangxian
|
5
|
+
* @Date: 2021-09-18 14:15:04
|
6
|
+
* @LastEditTime: 2022-03-28 14:30:25
|
7
|
+
*/
|
8
|
+
import { MetadataService } from './../../../framework/metadata/MetadataService';
|
9
|
+
import React from 'react';
|
10
|
+
export var useMetaType = function useMetaType(tag) {
|
11
|
+
var isFresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
12
|
+
|
13
|
+
var _React$useState = React.useState([]),
|
14
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
15
|
+
metaType = _React$useState2[0],
|
16
|
+
setMetaType = _React$useState2[1];
|
17
|
+
|
18
|
+
React.useEffect(function () {
|
19
|
+
if (isFresh) {
|
20
|
+
var service = new MetadataService();
|
21
|
+
|
22
|
+
var _tag = tag ? [tag] : [];
|
23
|
+
|
24
|
+
service.GetMetadataList(_tag).then(function (res) {
|
25
|
+
var _metaType = [];
|
26
|
+
|
27
|
+
if (res) {
|
28
|
+
for (var i = 0; i < res.length; i++) {
|
29
|
+
var obj = {
|
30
|
+
label: res[i].name,
|
31
|
+
value: res[i].id
|
32
|
+
};
|
33
|
+
|
34
|
+
_metaType.push(obj);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
setMetaType([].concat(_metaType));
|
39
|
+
});
|
40
|
+
}
|
41
|
+
}, [tag, isFresh]);
|
42
|
+
return metaType;
|
43
|
+
};
|