ronds-metadata 1.2.10 → 1.2.12
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 +199 -0
- package/es/comps/MetadataForm/DataCell/Number.js +131 -0
- package/es/comps/MetadataForm/DataCell/Ref.js +326 -0
- package/es/comps/MetadataForm/DataCell/Select.js +558 -0
- package/es/comps/MetadataForm/DataCell/Switch.js +116 -0
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +359 -0
- package/es/comps/MetadataForm/HOC/index.js +126 -0
- package/es/comps/MetadataForm/constants.js +11 -0
- package/es/comps/MetadataForm/hooks/index.js +139 -0
- package/es/comps/MetadataForm/index.js +268 -0
- package/es/comps/MetadataForm/interface.d.ts +2 -1
- 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,131 @@
|
|
1
|
+
import "antd/es/form/style";
|
2
|
+
import _Form from "antd/es/form";
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
4
|
+
import "antd/es/input-number/style";
|
5
|
+
import _InputNumber from "antd/es/input-number";
|
6
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
7
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
8
|
+
|
9
|
+
/*
|
10
|
+
* @Author: wangxian
|
11
|
+
* @Date: 2021-09-18 14:15:04
|
12
|
+
* @LastEditTime: 2023-02-28 10:19:20
|
13
|
+
*/
|
14
|
+
import React from 'react';
|
15
|
+
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
16
|
+
import { useGetExtraInfo } from '../hooks';
|
17
|
+
|
18
|
+
function Index(props) {
|
19
|
+
var _extraInfo$disabled2, _extraInfo$disabled3;
|
20
|
+
|
21
|
+
var id = props.id,
|
22
|
+
name = props.name,
|
23
|
+
isRefForm = props.isRefForm,
|
24
|
+
disabled = props.disabled,
|
25
|
+
notRequire = props.notRequire,
|
26
|
+
labelSpan = props.labelSpan,
|
27
|
+
field = props.field,
|
28
|
+
isObj = props.isObj;
|
29
|
+
var formContext = React.useContext(MetadataFormContext) || {};
|
30
|
+
var formRefContext = React.useContext(MetadataRefContext);
|
31
|
+
var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
|
32
|
+
|
33
|
+
var _React$useState = React.useState([]),
|
34
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
35
|
+
rules = _React$useState2[0],
|
36
|
+
setRules = _React$useState2[1];
|
37
|
+
|
38
|
+
React.useEffect(function () {
|
39
|
+
var _rules = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.rules;
|
40
|
+
|
41
|
+
if (_rules) {
|
42
|
+
var _ = _rules.map(function (it) {
|
43
|
+
return {
|
44
|
+
pattern: new RegExp(eval(it === null || it === void 0 ? void 0 : it.regExp), 'g'),
|
45
|
+
message: it.message
|
46
|
+
};
|
47
|
+
});
|
48
|
+
|
49
|
+
setRules(_toConsumableArray(_));
|
50
|
+
}
|
51
|
+
}, [extraInfo]);
|
52
|
+
|
53
|
+
if (isObj && isRefForm && field) {
|
54
|
+
var _extraInfo$disabled;
|
55
|
+
|
56
|
+
return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
57
|
+
style: {
|
58
|
+
flex: 1,
|
59
|
+
paddingRight: '10px'
|
60
|
+
},
|
61
|
+
name: [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
|
62
|
+
label: /*#__PURE__*/React.createElement("span", {
|
63
|
+
style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
|
64
|
+
color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
|
65
|
+
} : {}
|
66
|
+
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
|
67
|
+
labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
|
68
|
+
flex: "0 0 ".concat(labelSpan * 100 / 24, "%"),
|
69
|
+
offset: 0
|
70
|
+
} : undefined,
|
71
|
+
wrapperCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
|
72
|
+
flex: "0 0 ".concat((24 - labelSpan) * 100 / 24, "%"),
|
73
|
+
offset: 0
|
74
|
+
} : undefined,
|
75
|
+
rules: [{
|
76
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
77
|
+
}].concat(_toConsumableArray(rules)),
|
78
|
+
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
79
|
+
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
80
|
+
}), /*#__PURE__*/React.createElement(_InputNumber, {
|
81
|
+
disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
|
82
|
+
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
|
83
|
+
}));
|
84
|
+
}
|
85
|
+
|
86
|
+
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
87
|
+
key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
88
|
+
initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
89
|
+
style: {
|
90
|
+
display: "".concat(extraInfo.hidden ? 'none' : '')
|
91
|
+
},
|
92
|
+
label: /*#__PURE__*/React.createElement("span", {
|
93
|
+
style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
|
94
|
+
color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
|
95
|
+
} : {}
|
96
|
+
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
|
97
|
+
labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
|
98
|
+
span: labelSpan,
|
99
|
+
offset: 0
|
100
|
+
} : undefined,
|
101
|
+
wrapperCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
|
102
|
+
span: 24 - labelSpan,
|
103
|
+
offset: 0
|
104
|
+
} : undefined,
|
105
|
+
name: name,
|
106
|
+
rules: [{
|
107
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
108
|
+
}].concat(_toConsumableArray(rules)),
|
109
|
+
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
110
|
+
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
111
|
+
}, /*#__PURE__*/React.createElement(_InputNumber, {
|
112
|
+
disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
|
113
|
+
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
|
114
|
+
})) : /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
115
|
+
style: {
|
116
|
+
flex: 1,
|
117
|
+
paddingRight: '10px'
|
118
|
+
},
|
119
|
+
name: [field === null || field === void 0 ? void 0 : field.name],
|
120
|
+
rules: [{
|
121
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
122
|
+
}].concat(_toConsumableArray(rules)),
|
123
|
+
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
124
|
+
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
125
|
+
}), /*#__PURE__*/React.createElement(_InputNumber, {
|
126
|
+
disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
|
127
|
+
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
|
128
|
+
}));
|
129
|
+
}
|
130
|
+
|
131
|
+
export default /*#__PURE__*/React.memo(Index);
|
@@ -0,0 +1,326 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import "antd/es/form/style";
|
3
|
+
import _Form from "antd/es/form";
|
4
|
+
import "antd/es/select/style";
|
5
|
+
import _Select from "antd/es/select";
|
6
|
+
import "antd/es/row/style";
|
7
|
+
import _Row from "antd/es/row";
|
8
|
+
import "antd/es/col/style";
|
9
|
+
import _Col from "antd/es/col";
|
10
|
+
import "antd/es/button/style";
|
11
|
+
import _Button from "antd/es/button";
|
12
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
13
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
14
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
15
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
16
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
17
|
+
import React from 'react';
|
18
|
+
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons';
|
19
|
+
import { MetadataService } from '../../../framework/metadata/MetadataService';
|
20
|
+
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
21
|
+
import { useGetExtraInfo } from '../hooks';
|
22
|
+
import { renderForm } from '../utils';
|
23
|
+
import { JsonMetadataProvider } from '../../../framework/metadata';
|
24
|
+
|
25
|
+
function Index(props) {
|
26
|
+
var _extraInfo$disabled, _extraInfo$disabled2;
|
27
|
+
|
28
|
+
var id = props.id,
|
29
|
+
refId = props.refId,
|
30
|
+
disabled = props.disabled,
|
31
|
+
isRefForm = props.isRefForm,
|
32
|
+
fieldRule = props.fields,
|
33
|
+
labelSpan = props.labelSpan,
|
34
|
+
initEnumValue = props.initEnumValue,
|
35
|
+
field = props.field,
|
36
|
+
name = props.name;
|
37
|
+
var formContext = React.useContext(MetadataFormContext) || {};
|
38
|
+
var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form, props.type); // 是否折叠
|
39
|
+
|
40
|
+
var _React$useState = React.useState(true),
|
41
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
42
|
+
isFold = _React$useState2[0],
|
43
|
+
setIsFold = _React$useState2[1];
|
44
|
+
|
45
|
+
var _React$useState3 = React.useState([]),
|
46
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
47
|
+
schema = _React$useState4[0],
|
48
|
+
setSchema = _React$useState4[1];
|
49
|
+
|
50
|
+
var _React$useState5 = React.useState({}),
|
51
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
52
|
+
refFields = _React$useState6[0],
|
53
|
+
setRefFields = _React$useState6[1];
|
54
|
+
|
55
|
+
var refFieldsRef = React.useRef(refFields);
|
56
|
+
|
57
|
+
var _React$useState7 = React.useState([]),
|
58
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
59
|
+
options = _React$useState8[0],
|
60
|
+
setOptions = _React$useState8[1];
|
61
|
+
|
62
|
+
var _React$useState9 = React.useState(''),
|
63
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
64
|
+
help = _React$useState10[0],
|
65
|
+
setHelp = _React$useState10[1];
|
66
|
+
|
67
|
+
var onSearch = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
68
|
+
var param, server, res, _options, i, obj;
|
69
|
+
|
70
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
71
|
+
while (1) {
|
72
|
+
switch (_context.prev = _context.next) {
|
73
|
+
case 0:
|
74
|
+
param = {
|
75
|
+
id: refId,
|
76
|
+
filter: {
|
77
|
+
keywords: ''
|
78
|
+
},
|
79
|
+
order: []
|
80
|
+
};
|
81
|
+
server = new MetadataService();
|
82
|
+
_context.next = 4;
|
83
|
+
return server.GetMetadataObjList(param);
|
84
|
+
|
85
|
+
case 4:
|
86
|
+
res = _context.sent;
|
87
|
+
_options = [];
|
88
|
+
|
89
|
+
if (res.length > 0) {
|
90
|
+
for (i = 0; i < res.length; i++) {
|
91
|
+
obj = {
|
92
|
+
label: res[i].name,
|
93
|
+
value: res[i].namespace
|
94
|
+
};
|
95
|
+
|
96
|
+
_options.push(obj);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
setOptions(_options);
|
101
|
+
|
102
|
+
case 8:
|
103
|
+
case "end":
|
104
|
+
return _context.stop();
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}, _callee);
|
108
|
+
})), []);
|
109
|
+
React.useEffect(function () {
|
110
|
+
if (refId && !isRefForm) {
|
111
|
+
onSearch();
|
112
|
+
}
|
113
|
+
}, [refId, isRefForm, onSearch]);
|
114
|
+
var formOptions = React.useMemo(function () {
|
115
|
+
return {
|
116
|
+
disabled: disabled,
|
117
|
+
isRefForm: true,
|
118
|
+
isShowTypeInfo: formContext.isShowTypeInfo,
|
119
|
+
pName: name || [id],
|
120
|
+
field: field ? field : undefined,
|
121
|
+
isObj: true,
|
122
|
+
initEnumValue: initEnumValue
|
123
|
+
};
|
124
|
+
}, [field]);
|
125
|
+
var getSchemaByRefId = React.useCallback( /*#__PURE__*/function () {
|
126
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(server, __TYPE__) {
|
127
|
+
var _schema, res, provider, FormCls, formCls, _fields;
|
128
|
+
|
129
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
130
|
+
while (1) {
|
131
|
+
switch (_context2.prev = _context2.next) {
|
132
|
+
case 0:
|
133
|
+
_schema = []; // 如果有内部类,优先在内部类里面找
|
134
|
+
|
135
|
+
if (__TYPE__.length > 0) {
|
136
|
+
_schema = __TYPE__.filter(function (it) {
|
137
|
+
return it.id === refId;
|
138
|
+
});
|
139
|
+
} // 内部类找不到 从接口里面拿
|
140
|
+
|
141
|
+
|
142
|
+
if (!(_schema.length === 0)) {
|
143
|
+
_context2.next = 7;
|
144
|
+
break;
|
145
|
+
}
|
146
|
+
|
147
|
+
_context2.next = 5;
|
148
|
+
return server.GetMetadataDetailById(refId);
|
149
|
+
|
150
|
+
case 5:
|
151
|
+
res = _context2.sent;
|
152
|
+
|
153
|
+
if (res === null || res === void 0 ? void 0 : res.schema) {
|
154
|
+
_schema = JSON.parse(res === null || res === void 0 ? void 0 : res.schema);
|
155
|
+
}
|
156
|
+
|
157
|
+
case 7:
|
158
|
+
provider = new JsonMetadataProvider();
|
159
|
+
|
160
|
+
if (_schema.length > 0) {
|
161
|
+
provider.add_types(_schema);
|
162
|
+
FormCls = provider.get_type(_schema[0].id);
|
163
|
+
formCls = new FormCls();
|
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
|
+
}
|
174
|
+
}
|
175
|
+
}, _callee2);
|
176
|
+
}));
|
177
|
+
|
178
|
+
return function (_x, _x2) {
|
179
|
+
return _ref2.apply(this, arguments);
|
180
|
+
};
|
181
|
+
}(), [refId]);
|
182
|
+
React.useEffect(function () {
|
183
|
+
if (refId && formContext.__TYPE__) {
|
184
|
+
var server = new MetadataService();
|
185
|
+
getSchemaByRefId(server, formContext.__TYPE__);
|
186
|
+
return function () {
|
187
|
+
server = null;
|
188
|
+
};
|
189
|
+
}
|
190
|
+
|
191
|
+
return function () {};
|
192
|
+
}, [getSchemaByRefId, formContext.__TYPE__]);
|
193
|
+
React.useEffect(function () {
|
194
|
+
if (refId) {
|
195
|
+
var arr = refId.split(':');
|
196
|
+
setHelp(arr[arr.length - 1]);
|
197
|
+
}
|
198
|
+
}, [refId]);
|
199
|
+
|
200
|
+
if (isRefForm && !field && schema.length > 0) {
|
201
|
+
var _fieldRule$, _fieldRule$$value, _fieldRule$2, _fieldRule$2$value, _fieldRule$2$value$co;
|
202
|
+
|
203
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|
204
|
+
className: "ant-form-item"
|
205
|
+
}, !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && /*#__PURE__*/React.createElement(_Col, {
|
206
|
+
span: !labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'vertical' && 24,
|
207
|
+
flex: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? "0 0 ".concat(labelSpan * 100 / 24, "%") : ''
|
208
|
+
}, /*#__PURE__*/React.createElement("div", {
|
209
|
+
style: {
|
210
|
+
display: 'flex',
|
211
|
+
alignItems: 'center'
|
212
|
+
},
|
213
|
+
onClick: function onClick() {
|
214
|
+
if (formContext.isFoldForm) {
|
215
|
+
setIsFold(!isFold);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
}, /*#__PURE__*/React.createElement("div", {
|
219
|
+
className: "ant-form-item-label",
|
220
|
+
style: {
|
221
|
+
width: '100%',
|
222
|
+
textAlign: "".concat((formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan) && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? 'right' : 'left'),
|
223
|
+
flex: '1'
|
224
|
+
}
|
225
|
+
}, /*#__PURE__*/React.createElement("label", {
|
226
|
+
className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
|
227
|
+
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || fieldRule && ((_fieldRule$ = fieldRule[0]) === null || _fieldRule$ === void 0 ? void 0 : (_fieldRule$$value = _fieldRule$.value) === null || _fieldRule$$value === void 0 ? void 0 : _fieldRule$$value.label) || fieldRule && ((_fieldRule$2 = fieldRule[0]) === null || _fieldRule$2 === void 0 ? void 0 : (_fieldRule$2$value = _fieldRule$2.value) === null || _fieldRule$2$value === void 0 ? void 0 : (_fieldRule$2$value$co = _fieldRule$2$value.common) === null || _fieldRule$2$value$co === void 0 ? void 0 : _fieldRule$2$value$co.label) || id)), formContext.isFoldForm && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Button, {
|
228
|
+
type: "link",
|
229
|
+
onClick: function onClick() {
|
230
|
+
setIsFold(!isFold);
|
231
|
+
},
|
232
|
+
icon: isFold ? /*#__PURE__*/React.createElement(CaretDownOutlined, null) : /*#__PURE__*/React.createElement(CaretUpOutlined, null)
|
233
|
+
})))), /*#__PURE__*/React.createElement(_Col, {
|
234
|
+
flex: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? "0 0 ".concat((24 - labelSpan) * 100 / 24, "%") : 1
|
235
|
+
}, /*#__PURE__*/React.createElement("div", {
|
236
|
+
style: {
|
237
|
+
padding: '10px',
|
238
|
+
border: '1px solid var(--ronds-metadata-color-border-1)',
|
239
|
+
width: '100%',
|
240
|
+
borderRadius: '4px',
|
241
|
+
margin: '0 0 8px',
|
242
|
+
display: "".concat(formContext.isFoldForm && isFold ? 'none' : '')
|
243
|
+
}
|
244
|
+
}, /*#__PURE__*/React.createElement(MetadataRefContext.Provider, {
|
245
|
+
value: {
|
246
|
+
fields: refFieldsRef.current
|
247
|
+
}
|
248
|
+
}, renderForm(schema, formOptions, formContext.colSpan))))));
|
249
|
+
}
|
250
|
+
|
251
|
+
if (isRefForm && field && schema.length > 0) {
|
252
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
253
|
+
style: {
|
254
|
+
padding: '10px',
|
255
|
+
border: '1px solid var(--ronds-metadata-color-border-1)',
|
256
|
+
width: '100%',
|
257
|
+
borderRadius: '4px',
|
258
|
+
margin: '0 0 8px'
|
259
|
+
}
|
260
|
+
}, /*#__PURE__*/React.createElement(MetadataRefContext.Provider, {
|
261
|
+
value: {
|
262
|
+
fields: refFieldsRef.current
|
263
|
+
}
|
264
|
+
}, renderForm(schema, formOptions, formContext.colSpan))));
|
265
|
+
}
|
266
|
+
|
267
|
+
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
268
|
+
key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
269
|
+
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
270
|
+
labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
|
271
|
+
flex: "0 0 ".concat(labelSpan * 100 / 24, "%"),
|
272
|
+
offset: 0
|
273
|
+
} : undefined,
|
274
|
+
wrapperCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
|
275
|
+
flex: "0 0 ".concat((24 - labelSpan) * 100 / 24, "%"),
|
276
|
+
offset: 0
|
277
|
+
} : undefined,
|
278
|
+
initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
279
|
+
style: {
|
280
|
+
display: "".concat(extraInfo.hidden ? 'none' : 'block')
|
281
|
+
},
|
282
|
+
name: id,
|
283
|
+
rules: [{
|
284
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
285
|
+
}],
|
286
|
+
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
287
|
+
tooltip: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip) || help
|
288
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
289
|
+
showSearch: true,
|
290
|
+
options: options || [],
|
291
|
+
placeholder: extraInfo.placeholder,
|
292
|
+
disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
|
293
|
+
notFoundContent: '没有批到到该实体数据',
|
294
|
+
filterOption: function filterOption(input, option) {
|
295
|
+
return (option === null || option === void 0 ? void 0 : option.label.indexOf(input)) >= 0;
|
296
|
+
},
|
297
|
+
allowClear: true
|
298
|
+
})) : /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
299
|
+
style: {
|
300
|
+
flex: 1,
|
301
|
+
paddingRight: '10px',
|
302
|
+
width: '100%'
|
303
|
+
},
|
304
|
+
name: [field === null || field === void 0 ? void 0 : field.name],
|
305
|
+
rules: [{
|
306
|
+
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
307
|
+
}],
|
308
|
+
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
309
|
+
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
310
|
+
}), /*#__PURE__*/React.createElement(_Select, {
|
311
|
+
showSearch: true,
|
312
|
+
style: {
|
313
|
+
width: '100%'
|
314
|
+
},
|
315
|
+
options: options || [],
|
316
|
+
placeholder: extraInfo.placeholder,
|
317
|
+
disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
|
318
|
+
notFoundContent: '没有批到到该实体数据',
|
319
|
+
filterOption: function filterOption(input, option) {
|
320
|
+
return (option === null || option === void 0 ? void 0 : option.label.indexOf(input)) >= 0;
|
321
|
+
},
|
322
|
+
allowClear: true
|
323
|
+
}));
|
324
|
+
}
|
325
|
+
|
326
|
+
export default /*#__PURE__*/React.memo(Index);
|