ronds-metadata 1.2.37 → 1.2.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/api/index.js +83 -131
- package/es/comps/DynamicPorts/comps/ContextMenu.js +3 -11
- package/es/comps/DynamicPorts/comps/DragNode.js +3 -8
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +4 -5
- package/es/comps/DynamicPorts/comps/NodeElement.js +1 -4
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +3 -6
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +3 -7
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +18 -21
- package/es/comps/DynamicPorts/comps/shape/edge.js +5 -18
- package/es/comps/DynamicPorts/comps/shape/node.js +4 -17
- package/es/comps/DynamicPorts/constant/index.js +2 -5
- package/es/comps/DynamicPorts/graph.d.ts +2 -2
- package/es/comps/DynamicPorts/graph.js +228 -312
- package/es/comps/DynamicPorts/index.js +39 -58
- package/es/comps/DynamicPorts/utils.js +21 -25
- package/es/comps/Editable/DataCell/ButtonCell.js +4 -10
- package/es/comps/Editable/DataCell/ColorPicker.js +2 -7
- package/es/comps/Editable/DataCell/Input.js +5 -14
- package/es/comps/Editable/DataCell/Number.js +3 -10
- package/es/comps/Editable/DataCell/Select.js +7 -14
- package/es/comps/Editable/DataCell/Switch.js +2 -7
- package/es/comps/Editable/comps/EditableAction.js +8 -12
- package/es/comps/Editable/comps/EditableCell.js +16 -26
- package/es/comps/Editable/comps/EditableHeardCell.js +21 -34
- package/es/comps/Editable/comps/EditableRow.js +49 -59
- package/es/comps/Editable/comps/Texty.js +40 -73
- package/es/comps/Editable/index.js +67 -112
- package/es/comps/Editable/interface.d.ts +1 -1
- package/es/comps/Editable/utils.js +0 -1
- package/es/comps/FileView/index.js +65 -101
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +6 -3
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +2 -5
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +86 -109
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +3 -7
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +54 -91
- package/es/comps/FormGenerator/comps/Canvas/index.js +8 -15
- package/es/comps/FormGenerator/comps/Settings/index.js +16 -30
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +23 -22
- package/es/comps/FormGenerator/comps/Sidebar/index.js +6 -2
- package/es/comps/FormGenerator/index.js +3 -9
- package/es/comps/FormGenerator/interface.d.ts +1 -1
- package/es/comps/FormGenerator/settings/index.js +12 -11
- package/es/comps/FormGenerator/settings/ruleConfig.js +0 -1
- package/es/comps/FormGenerator/transformer.js +40 -105
- package/es/comps/Icons/index.js +4 -7
- package/es/comps/JsonEdit/index.js +25 -50
- package/es/comps/JsonView/index.js +7 -21
- package/es/comps/MdEdit/index.js +7 -10
- package/es/comps/MdEditPro/index.d.ts +10 -0
- package/es/comps/MdEditPro/index.js +22 -0
- package/es/comps/MdEditPro/index.less +74 -0
- package/es/comps/MdNavbar/index.js +17 -40
- package/es/comps/MdNavbar/utils.js +0 -4
- package/es/comps/MdView/index.js +7 -11
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +129 -183
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +11 -27
- package/es/comps/MetadataEdit/hooks/index.js +3 -11
- package/es/comps/MetadataEdit/index.js +25 -58
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +17 -33
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +15 -29
- package/es/comps/MetadataEditV2/hooks/index.js +5 -12
- package/es/comps/MetadataEditV2/index.js +30 -65
- package/es/comps/MetadataForm/DataCell/Array.js +12 -23
- package/es/comps/MetadataForm/DataCell/Input.js +23 -39
- package/es/comps/MetadataForm/DataCell/Number.js +10 -21
- package/es/comps/MetadataForm/DataCell/Ref.js +87 -121
- package/es/comps/MetadataForm/DataCell/Select.js +131 -226
- package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +98 -169
- package/es/comps/MetadataForm/HOC/index.js +20 -37
- package/es/comps/MetadataForm/hooks/index.js +12 -38
- package/es/comps/MetadataForm/index.js +37 -72
- package/es/comps/MetadataForm/interface.d.ts +3 -3
- package/es/comps/MetadataForm/utils.d.ts +1 -0
- package/es/comps/MetadataForm/utils.js +12 -14
- package/es/comps/Split/index.js +40 -38
- package/es/config.js +0 -4
- package/es/framework/RxStore/demo/index.js +9 -10
- package/es/framework/RxStore/hooks.d.ts +9 -9
- package/es/framework/RxStore/hooks.js +10 -35
- package/es/framework/RxStore/store.d.ts +4 -4
- package/es/framework/RxStore/store.js +0 -10
- package/es/framework/fg/index.js +18 -80
- package/es/framework/fg/interface.d.ts +2 -2
- package/es/framework/fg/utils.js +0 -10
- package/es/framework/graph/index.d.ts +2 -2
- package/es/framework/graph/index.js +55 -110
- package/es/framework/hooks/use-async-memo.js +3 -7
- package/es/framework/hooks/use-sync-scroll.js +2 -15
- package/es/framework/http/cache.js +25 -32
- package/es/framework/http/cancel.js +1 -7
- package/es/framework/http/index.js +22 -82
- package/es/framework/http/msgpack.js +0 -4
- package/es/framework/http/msgpack5/index.js +2 -12
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +1 -13
- package/es/framework/http/msgpack5/lib/decoder.js +10 -68
- package/es/framework/http/msgpack5/lib/encoder.js +8 -36
- package/es/framework/http/msgpack5/lib/helpers.js +3 -2
- package/es/framework/http/msgpack5/lib/streams.js +0 -18
- package/es/framework/libs/jquery.min.js +1009 -1696
- package/es/framework/locale/dil8/di18n.js +4 -15
- package/es/framework/locale/dil8/translate.js +0 -14
- package/es/framework/locale/dil8/util.js +0 -3
- package/es/framework/locale/index.js +2 -3
- package/es/framework/metadata/MetadataService.js +39 -78
- package/es/framework/metadata/index.js +4 -70
- package/es/framework/rxjs-hooks/useMemoSubject.js +0 -2
- package/es/framework/rxjs-hooks/useObservable.js +2 -4
- package/es/framework/rxjs-hooks/useObservableState.js +8 -14
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/utils.js +58 -97
- package/package.json +4 -2
- package/es/comps/MdEdit/plugin/EditContent.d.ts +0 -5
- package/es/comps/MdEdit/plugin/EditContent.js +0 -34
- package/es/comps/MdEdit/plugin/Mark.d.ts +0 -7
- package/es/comps/MdEdit/plugin/Mark.js +0 -60
- package/es/framework/libs/iconfont/iconfont.json +0 -401
|
@@ -2,62 +2,54 @@ import "antd/es/form/style";
|
|
|
2
2
|
import _Form from "antd/es/form";
|
|
3
3
|
import "antd/es/tag/style";
|
|
4
4
|
import _Tag from "antd/es/tag";
|
|
5
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
5
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
7
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
9
8
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
10
9
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
10
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
11
|
import React, { useRef } from 'react';
|
|
12
12
|
import { MetadataService } from '../../../../framework/metadata/MetadataService';
|
|
13
13
|
import { JsonMetadataProvider } from '../../../../framework/metadata';
|
|
14
14
|
import Editable from '../../../../comps/Editable';
|
|
15
15
|
import useObservable from '../../../../framework/rxjs-hooks/useObservable';
|
|
16
16
|
import { MetadataFormContext } from '../../interface';
|
|
17
|
-
import {
|
|
17
|
+
import { assignReplace, getLabelByProps } from '../../utils';
|
|
18
18
|
import { deepClone, getConstantValue } from '../../../../utils';
|
|
19
19
|
import { STREAM_EVENT_TYPE } from '../../constants';
|
|
20
|
-
|
|
21
20
|
var TableArray = function TableArray(props) {
|
|
22
21
|
var initValue = props.initValue,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
readonly = props.readonly,
|
|
23
|
+
extraInfo = props.extraInfo,
|
|
24
|
+
rowNumber = props.rowNumber,
|
|
25
|
+
initEnumValue = props.initEnumValue,
|
|
26
|
+
addButtonHidden = props.addButtonHidden,
|
|
27
|
+
name = props.name,
|
|
28
|
+
form = props.form,
|
|
29
|
+
refId = props.refId;
|
|
31
30
|
var formContext = React.useContext(MetadataFormContext) || {};
|
|
32
|
-
|
|
33
31
|
var _React$useState = React.useState([]),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
33
|
+
schema = _React$useState2[0],
|
|
34
|
+
setSchema = _React$useState2[1];
|
|
38
35
|
var _React$useState3 = React.useState({}),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
37
|
+
defaultValue = _React$useState4[0],
|
|
38
|
+
setDefaultValue = _React$useState4[1];
|
|
43
39
|
var _React$useState5 = React.useState({}),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
41
|
+
refFields = _React$useState6[0],
|
|
42
|
+
setRefFields = _React$useState6[1];
|
|
48
43
|
var refFieldsRef = React.useRef(refFields);
|
|
49
44
|
var firstLoadRef = useRef(true);
|
|
50
|
-
|
|
51
45
|
var _React$useState7 = React.useState(),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
47
|
+
tblStream = _React$useState8[0],
|
|
48
|
+
setTblStream = _React$useState8[1];
|
|
56
49
|
var _React$useState9 = React.useState([]),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
51
|
+
list = _React$useState10[0],
|
|
52
|
+
setList = _React$useState10[1];
|
|
61
53
|
var listRef = React.useRef([]);
|
|
62
54
|
var enumOptionsRef = React.useRef({});
|
|
63
55
|
useObservable(function (p) {
|
|
@@ -67,13 +59,10 @@ var TableArray = function TableArray(props) {
|
|
|
67
59
|
listRef.current = p.payload[name];
|
|
68
60
|
} else if (p.payload[name[0]]) {
|
|
69
61
|
var evalString = 'p.payload';
|
|
70
|
-
|
|
71
62
|
for (var i = 0; i < name.length; i++) {
|
|
72
63
|
evalString = "".concat(evalString, "[name[").concat(i, "]]");
|
|
73
64
|
}
|
|
74
|
-
|
|
75
65
|
var _list = eval(evalString) || [];
|
|
76
|
-
|
|
77
66
|
setList(_toConsumableArray(_list));
|
|
78
67
|
listRef.current = _list;
|
|
79
68
|
}
|
|
@@ -83,11 +72,9 @@ var TableArray = function TableArray(props) {
|
|
|
83
72
|
if ((p === null || p === void 0 ? void 0 : p.type) === 'onValuesChange') {
|
|
84
73
|
if (typeof name === 'string') {
|
|
85
74
|
var _p$payload;
|
|
86
|
-
|
|
87
75
|
var val = _defineProperty({}, "".concat(name), _objectSpread({
|
|
88
76
|
rowIdx: p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : _p$payload.rowIdx
|
|
89
77
|
}, p.payload.values));
|
|
90
|
-
|
|
91
78
|
var allVals = form.getFieldsValue();
|
|
92
79
|
allVals[name] = listRef.current;
|
|
93
80
|
formContext.stream$.next({
|
|
@@ -99,15 +86,12 @@ var TableArray = function TableArray(props) {
|
|
|
99
86
|
});
|
|
100
87
|
} else {
|
|
101
88
|
var _p$payload2;
|
|
102
|
-
|
|
103
89
|
var _val2 = {};
|
|
104
|
-
|
|
105
90
|
var _allVals = form.getFieldsValue();
|
|
106
|
-
|
|
107
|
-
assign(name, _objectSpread({
|
|
91
|
+
assignReplace(name, _objectSpread({
|
|
108
92
|
rowIdx: p === null || p === void 0 ? void 0 : (_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.rowIdx
|
|
109
93
|
}, p.payload.values), _val2);
|
|
110
|
-
|
|
94
|
+
assignReplace(name, _toConsumableArray(listRef.current), _allVals);
|
|
111
95
|
formContext.stream$.next({
|
|
112
96
|
type: STREAM_EVENT_TYPE.ON_VALUES_CHANGE,
|
|
113
97
|
payload: {
|
|
@@ -121,57 +105,45 @@ var TableArray = function TableArray(props) {
|
|
|
121
105
|
var getSchemaByRefId = React.useCallback( /*#__PURE__*/function () {
|
|
122
106
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(server, __TYPE__) {
|
|
123
107
|
var _schema, res, provider, FormCls, formCls, _fields;
|
|
124
|
-
|
|
125
108
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
126
|
-
while (1) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
refFieldsRef.current = _fields;
|
|
162
|
-
setRefFields(_objectSpread({}, _fields));
|
|
163
|
-
setSchema(_toConsumableArray(_schema));
|
|
164
|
-
setDefaultValue(_objectSpread({}, JSON.parse(JSON.stringify(formCls))));
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
case 9:
|
|
168
|
-
case "end":
|
|
169
|
-
return _context.stop();
|
|
170
|
-
}
|
|
109
|
+
while (1) switch (_context.prev = _context.next) {
|
|
110
|
+
case 0:
|
|
111
|
+
_schema = []; // 如果有内部类,优先在内部类里面找
|
|
112
|
+
if (__TYPE__.length > 0) {
|
|
113
|
+
_schema = __TYPE__.filter(function (it) {
|
|
114
|
+
return it.id === refId;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// 内部类找不到 从接口里面拿
|
|
118
|
+
if (!(_schema.length === 0)) {
|
|
119
|
+
_context.next = 7;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
_context.next = 5;
|
|
123
|
+
return server.GetMetadataDetailById(refId);
|
|
124
|
+
case 5:
|
|
125
|
+
res = _context.sent;
|
|
126
|
+
if (res === null || res === void 0 ? void 0 : res.schema) {
|
|
127
|
+
_schema = JSON.parse(res === null || res === void 0 ? void 0 : res.schema);
|
|
128
|
+
}
|
|
129
|
+
case 7:
|
|
130
|
+
provider = new JsonMetadataProvider();
|
|
131
|
+
if (_schema.length > 0) {
|
|
132
|
+
provider.add_types(_schema);
|
|
133
|
+
FormCls = provider.get_type(_schema[0].id);
|
|
134
|
+
formCls = new FormCls();
|
|
135
|
+
_fields = formCls.__type__.__fields__;
|
|
136
|
+
refFieldsRef.current = _fields;
|
|
137
|
+
setRefFields(_objectSpread({}, _fields));
|
|
138
|
+
setSchema(_toConsumableArray(_schema));
|
|
139
|
+
setDefaultValue(_objectSpread({}, JSON.parse(JSON.stringify(formCls))));
|
|
140
|
+
}
|
|
141
|
+
case 9:
|
|
142
|
+
case "end":
|
|
143
|
+
return _context.stop();
|
|
171
144
|
}
|
|
172
145
|
}, _callee);
|
|
173
146
|
}));
|
|
174
|
-
|
|
175
147
|
return function (_x, _x2) {
|
|
176
148
|
return _ref.apply(this, arguments);
|
|
177
149
|
};
|
|
@@ -184,7 +156,6 @@ var TableArray = function TableArray(props) {
|
|
|
184
156
|
server = null;
|
|
185
157
|
};
|
|
186
158
|
}
|
|
187
|
-
|
|
188
159
|
return function () {};
|
|
189
160
|
}, [refId]);
|
|
190
161
|
React.useEffect(function () {
|
|
@@ -201,121 +172,93 @@ var TableArray = function TableArray(props) {
|
|
|
201
172
|
listRef.current = initValue[name];
|
|
202
173
|
} else if (initValue[name[0]]) {
|
|
203
174
|
var evalString = 'initValue';
|
|
204
|
-
|
|
205
175
|
for (var i = 0; i < name.length; i++) {
|
|
206
176
|
evalString = "".concat(evalString, "[name[").concat(i, "]]");
|
|
207
177
|
}
|
|
208
|
-
|
|
209
178
|
var _list = eval(evalString);
|
|
210
|
-
|
|
211
179
|
setList(_toConsumableArray(_list));
|
|
212
180
|
listRef.current = _list;
|
|
213
181
|
}
|
|
214
|
-
|
|
215
182
|
firstLoadRef.current = false;
|
|
216
183
|
}
|
|
217
184
|
}, [initValue, form]);
|
|
218
185
|
var getEnumDataByUrl = React.useCallback( /*#__PURE__*/function () {
|
|
219
186
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(http) {
|
|
220
187
|
var server, _url, res, _res;
|
|
221
|
-
|
|
222
188
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
223
|
-
while (1) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
console.warn("".concat(_url, " is not return success result"));
|
|
250
|
-
return _context2.abrupt("return", []);
|
|
251
|
-
|
|
252
|
-
case 12:
|
|
253
|
-
case "end":
|
|
254
|
-
return _context2.stop();
|
|
255
|
-
}
|
|
189
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
190
|
+
case 0:
|
|
191
|
+
server = new MetadataService();
|
|
192
|
+
_url = http.url;
|
|
193
|
+
_context2.next = 4;
|
|
194
|
+
return server.GetEnumDataByUrl(_url, http.method, (http === null || http === void 0 ? void 0 : http.body) && JSON.parse(http === null || http === void 0 ? void 0 : http.body));
|
|
195
|
+
case 4:
|
|
196
|
+
res = _context2.sent;
|
|
197
|
+
_res = (res === null || res === void 0 ? void 0 : res.total) ? res === null || res === void 0 ? void 0 : res.list : res;
|
|
198
|
+
if (!(_res && _res.length > 0)) {
|
|
199
|
+
_context2.next = 10;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
return _context2.abrupt("return", _res.map(function (it) {
|
|
203
|
+
return {
|
|
204
|
+
value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
|
|
205
|
+
label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
|
|
206
|
+
disabled: false
|
|
207
|
+
};
|
|
208
|
+
}));
|
|
209
|
+
case 10:
|
|
210
|
+
console.warn("".concat(_url, " is not return success result"));
|
|
211
|
+
return _context2.abrupt("return", []);
|
|
212
|
+
case 12:
|
|
213
|
+
case "end":
|
|
214
|
+
return _context2.stop();
|
|
256
215
|
}
|
|
257
216
|
}, _callee2);
|
|
258
217
|
}));
|
|
259
|
-
|
|
260
218
|
return function (_x3) {
|
|
261
219
|
return _ref2.apply(this, arguments);
|
|
262
220
|
};
|
|
263
221
|
}(), []);
|
|
264
222
|
var processEnumData = React.useCallback(function (data, _extraInfo) {
|
|
265
223
|
var _extraInfo$enum, _extraInfo$enum3, _extraInfo$enum3$http;
|
|
266
|
-
|
|
267
224
|
var _options = [];
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
225
|
+
var _enum = deepClone(data.enum || []);
|
|
226
|
+
// 扩展规则的value
|
|
272
227
|
if (_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$enum = _extraInfo.enum) === null || _extraInfo$enum === void 0 ? void 0 : _extraInfo$enum.value) {
|
|
273
228
|
var _extraInfo$enum2;
|
|
274
|
-
|
|
275
229
|
_enum = deepClone(_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$enum2 = _extraInfo.enum) === null || _extraInfo$enum2 === void 0 ? void 0 : _extraInfo$enum2.value);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
230
|
+
}
|
|
231
|
+
// 从接口拿数据
|
|
279
232
|
if (_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$enum3 = _extraInfo.enum) === null || _extraInfo$enum3 === void 0 ? void 0 : (_extraInfo$enum3$http = _extraInfo$enum3.http) === null || _extraInfo$enum3$http === void 0 ? void 0 : _extraInfo$enum3$http.url) {
|
|
280
233
|
var _extraInfo$enum4;
|
|
281
|
-
|
|
282
234
|
return getEnumDataByUrl(deepClone(_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$enum4 = _extraInfo.enum) === null || _extraInfo$enum4 === void 0 ? void 0 : _extraInfo$enum4.http));
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
235
|
+
}
|
|
236
|
+
// 目前是更具那么的id判断的,暂未考虑重名问题
|
|
286
237
|
if (initEnumValue && initEnumValue[data.id]) {
|
|
287
238
|
_enum = deepClone(initEnumValue[data.id]);
|
|
288
239
|
}
|
|
289
|
-
|
|
290
240
|
_enum.forEach(function (it) {
|
|
291
241
|
var obj = {
|
|
292
242
|
label: it.value,
|
|
293
243
|
value: (it === null || it === void 0 ? void 0 : it.key) || (it === null || it === void 0 ? void 0 : it.value)
|
|
294
244
|
};
|
|
295
|
-
|
|
296
245
|
_options.push(obj);
|
|
297
246
|
});
|
|
298
|
-
|
|
299
247
|
enumOptionsRef.current[data.id] = _options;
|
|
300
248
|
return _options;
|
|
301
249
|
}, []);
|
|
302
250
|
var processColumnType = React.useCallback(function (data, _extraInfo) {
|
|
303
251
|
var _extraInfo$text, _extraInfo$text2;
|
|
304
|
-
|
|
305
252
|
if ((data === null || data === void 0 ? void 0 : data.type) === 'text' && (_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$text = _extraInfo.text) === null || _extraInfo$text === void 0 ? void 0 : _extraInfo$text.type) && (_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$text2 = _extraInfo.text) === null || _extraInfo$text2 === void 0 ? void 0 : _extraInfo$text2.type) !== 'textarea') {
|
|
306
253
|
var _extraInfo$text3;
|
|
307
|
-
|
|
308
254
|
return (_extraInfo$text3 = _extraInfo.text) === null || _extraInfo$text3 === void 0 ? void 0 : _extraInfo$text3.type;
|
|
309
255
|
}
|
|
310
|
-
|
|
311
256
|
return data.type;
|
|
312
257
|
}, []);
|
|
313
258
|
var processSchemaToColumns = React.useCallback(function (_properties) {
|
|
314
259
|
var _columns = [];
|
|
315
|
-
|
|
316
|
-
var _loop = function _loop(i) {
|
|
260
|
+
var _loop = function _loop() {
|
|
317
261
|
var _extraInfo$common, _extraInfo$enum5;
|
|
318
|
-
|
|
319
262
|
var it = _properties[i];
|
|
320
263
|
var extraInfo = refFieldsRef.current.get(it.id);
|
|
321
264
|
var obj = {
|
|
@@ -336,33 +279,25 @@ var TableArray = function TableArray(props) {
|
|
|
336
279
|
}, getConstantValue(enumOptionsRef.current[it.id], v, 'value', 'label'));
|
|
337
280
|
});
|
|
338
281
|
}
|
|
339
|
-
|
|
340
282
|
return getConstantValue(enumOptionsRef.current[it.id], val, 'value', 'label');
|
|
341
283
|
}
|
|
342
|
-
|
|
343
284
|
return val;
|
|
344
285
|
}
|
|
345
286
|
};
|
|
346
|
-
|
|
347
287
|
_columns.push(obj);
|
|
348
288
|
};
|
|
349
|
-
|
|
350
289
|
for (var i = 0; i < _properties.length; i++) {
|
|
351
|
-
_loop(
|
|
290
|
+
_loop();
|
|
352
291
|
}
|
|
353
|
-
|
|
354
292
|
return _columns;
|
|
355
293
|
}, []);
|
|
356
294
|
var columns = React.useMemo(function () {
|
|
357
295
|
var _columns = [];
|
|
358
|
-
|
|
359
296
|
if (schema.length > 0) {
|
|
360
297
|
_columns = processSchemaToColumns(schema[0].properties);
|
|
361
298
|
}
|
|
362
|
-
|
|
363
299
|
return _columns;
|
|
364
300
|
}, [schema, processSchemaToColumns]);
|
|
365
|
-
|
|
366
301
|
var onTableChange = function onTableChange(values) {
|
|
367
302
|
if (typeof name === 'string') {
|
|
368
303
|
var allVals = form.getFieldsValue();
|
|
@@ -377,11 +312,9 @@ var TableArray = function TableArray(props) {
|
|
|
377
312
|
form.setFieldsValue(_objectSpread({}, _defineProperty({}, "".concat(name), values)));
|
|
378
313
|
} else {
|
|
379
314
|
var val = {};
|
|
380
|
-
|
|
381
|
-
|
|
315
|
+
assignReplace(name, _toConsumableArray(values), val);
|
|
382
316
|
var _allVals2 = form.getFieldsValue();
|
|
383
|
-
|
|
384
|
-
assign(name, _toConsumableArray(values), _allVals2);
|
|
317
|
+
assignReplace(name, _toConsumableArray(values), _allVals2);
|
|
385
318
|
formContext.stream$.next({
|
|
386
319
|
type: STREAM_EVENT_TYPE.ON_VALUES_CHANGE,
|
|
387
320
|
payload: {
|
|
@@ -391,17 +324,14 @@ var TableArray = function TableArray(props) {
|
|
|
391
324
|
});
|
|
392
325
|
form.setFieldsValue(_objectSpread({}, val));
|
|
393
326
|
}
|
|
394
|
-
|
|
395
327
|
listRef.current = values;
|
|
396
328
|
};
|
|
397
|
-
|
|
398
329
|
var onButtonCellClick = function onButtonCellClick(record) {
|
|
399
330
|
formContext.stream$.next({
|
|
400
331
|
type: 'onButtonCellClick',
|
|
401
332
|
payload: record
|
|
402
333
|
});
|
|
403
334
|
};
|
|
404
|
-
|
|
405
335
|
var getCellHeight = React.useCallback(function (_readonly) {
|
|
406
336
|
return _readonly ? 30 : 33;
|
|
407
337
|
}, []);
|
|
@@ -440,5 +370,4 @@ var TableArray = function TableArray(props) {
|
|
|
440
370
|
}
|
|
441
371
|
})));
|
|
442
372
|
};
|
|
443
|
-
|
|
444
373
|
export default TableArray;
|
|
@@ -2,6 +2,11 @@ import "antd/es/col/style";
|
|
|
2
2
|
import _Col from "antd/es/col";
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
|
+
/*
|
|
6
|
+
* @Author: wangxian
|
|
7
|
+
* @Date: 2021-09-18 14:15:04
|
|
8
|
+
* @LastEditTime: 2023-04-18 10:15:35
|
|
9
|
+
*/
|
|
5
10
|
import React from 'react';
|
|
6
11
|
import { deepClone } from '../../../utils';
|
|
7
12
|
import { useWatchDepend } from '../hooks';
|
|
@@ -10,43 +15,34 @@ import './index.less';
|
|
|
10
15
|
export function withAddOnAfter(WrappedComponent) {
|
|
11
16
|
return function (props) {
|
|
12
17
|
var _fields$, _fields$$value, _fields$$value$common, _fields$4, _fields$4$value, _fields$4$value$commo, _fields$4$value$commo2, _fields$5, _fields$5$value, _fields$5$value$commo;
|
|
13
|
-
|
|
14
18
|
var type = props.type,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
refId = props.refId,
|
|
20
|
+
isShowTypeInfo = props.isShowTypeInfo,
|
|
21
|
+
fields = props.fields,
|
|
22
|
+
colSpan = props.colSpan,
|
|
23
|
+
field = props.field,
|
|
24
|
+
id = props.id,
|
|
25
|
+
_props$name = props.name,
|
|
26
|
+
name = _props$name === void 0 ? [] : _props$name,
|
|
27
|
+
isObj = props.isObj;
|
|
24
28
|
var formContext = React.useContext(MetadataFormContext) || {};
|
|
25
29
|
var depend = useWatchDepend(fields && ((_fields$ = fields[0]) === null || _fields$ === void 0 ? void 0 : (_fields$$value = _fields$.value) === null || _fields$$value === void 0 ? void 0 : (_fields$$value$common = _fields$$value.common) === null || _fields$$value$common === void 0 ? void 0 : _fields$$value$common.depend), formContext === null || formContext === void 0 ? void 0 : formContext.stream$, name);
|
|
26
|
-
|
|
27
30
|
var _React$useState = React.useState(),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
32
|
+
help = _React$useState2[0],
|
|
33
|
+
setHelp = _React$useState2[1];
|
|
32
34
|
var _React$useState3 = React.useState(),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
36
|
+
cellColSpan = _React$useState4[0],
|
|
37
|
+
setCellColSpan = _React$useState4[1];
|
|
37
38
|
var labelSpan = React.useMemo(function () {
|
|
38
39
|
var _fields$0$value, _fields$0$value$commo;
|
|
39
|
-
|
|
40
40
|
var _labelSpan = formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan;
|
|
41
|
-
|
|
42
41
|
var _colSpan = fields && ((_fields$0$value = fields[0].value) === null || _fields$0$value === void 0 ? void 0 : (_fields$0$value$commo = _fields$0$value.common) === null || _fields$0$value$commo === void 0 ? void 0 : _fields$0$value$commo.colSpan);
|
|
43
|
-
|
|
44
42
|
var _formLabelSpan = formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan;
|
|
45
|
-
|
|
46
43
|
if (_colSpan && _formLabelSpan) {
|
|
47
44
|
_labelSpan = _formLabelSpan / _colSpan;
|
|
48
45
|
}
|
|
49
|
-
|
|
50
46
|
return _labelSpan;
|
|
51
47
|
}, [fields, formContext === null || formContext === void 0 ? void 0 : formContext.colSpan, formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan]);
|
|
52
48
|
React.useEffect(function () {
|
|
@@ -54,52 +50,39 @@ export function withAddOnAfter(WrappedComponent) {
|
|
|
54
50
|
var arr = refId.split(':');
|
|
55
51
|
setHelp(arr[arr.length - 1]);
|
|
56
52
|
}
|
|
57
|
-
|
|
58
53
|
return function () {};
|
|
59
54
|
}, [refId]);
|
|
60
55
|
React.useEffect(function () {
|
|
61
56
|
var _fields$2, _fields$2$value, _fields$2$value$commo, _fields$3, _fields$3$value;
|
|
62
|
-
|
|
63
57
|
var _colSpan = colSpan;
|
|
64
58
|
var compColSpan = fields && (((_fields$2 = fields[0]) === null || _fields$2 === void 0 ? void 0 : (_fields$2$value = _fields$2.value) === null || _fields$2$value === void 0 ? void 0 : (_fields$2$value$commo = _fields$2$value.common) === null || _fields$2$value$commo === void 0 ? void 0 : _fields$2$value$commo.colSpan) || ((_fields$3 = fields[0]) === null || _fields$3 === void 0 ? void 0 : (_fields$3$value = _fields$3.value) === null || _fields$3$value === void 0 ? void 0 : _fields$3$value.colSpan));
|
|
65
|
-
|
|
66
59
|
if (compColSpan) {
|
|
67
60
|
_colSpan = compColSpan * colSpan <= 24 ? compColSpan * colSpan : 24;
|
|
68
61
|
}
|
|
69
|
-
|
|
70
62
|
setCellColSpan(_colSpan);
|
|
71
63
|
}, [fields, colSpan]);
|
|
72
|
-
|
|
73
64
|
var _name = React.useMemo(function () {
|
|
74
65
|
if (id && name.length > 0 && !field) {
|
|
75
66
|
var res = deepClone(name);
|
|
76
67
|
res.push(id);
|
|
77
68
|
return res;
|
|
78
69
|
}
|
|
79
|
-
|
|
80
70
|
if (id && name.length > 0 && field) {
|
|
81
71
|
var _res = deepClone(name);
|
|
82
|
-
|
|
83
72
|
_res.push(id);
|
|
84
|
-
|
|
85
73
|
if (type !== 'ref') {
|
|
86
74
|
_res.shift();
|
|
87
75
|
}
|
|
88
|
-
|
|
89
76
|
return _res;
|
|
90
77
|
}
|
|
91
|
-
|
|
92
78
|
return [id];
|
|
93
79
|
}, [id, name]);
|
|
94
|
-
|
|
95
80
|
if (depend === null || depend === void 0 ? void 0 : depend.hidden) {
|
|
96
81
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
97
82
|
}
|
|
98
|
-
|
|
99
83
|
if (fields && ((_fields$4 = fields[0]) === null || _fields$4 === void 0 ? void 0 : (_fields$4$value = _fields$4.value) === null || _fields$4$value === void 0 ? void 0 : (_fields$4$value$commo = _fields$4$value.common) === null || _fields$4$value$commo === void 0 ? void 0 : (_fields$4$value$commo2 = _fields$4$value$commo.depend) === null || _fields$4$value$commo2 === void 0 ? void 0 : _fields$4$value$commo2.show) && !(depend === null || depend === void 0 ? void 0 : depend.show)) {
|
|
100
84
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
101
85
|
}
|
|
102
|
-
|
|
103
86
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
|
|
104
87
|
key: id,
|
|
105
88
|
span: cellColSpan
|