ronds-metadata 1.2.38 → 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 +2 -7
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +4 -5
- package/es/comps/DynamicPorts/comps/NodeElement.js +1 -4
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +3 -6
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +3 -7
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +18 -21
- package/es/comps/DynamicPorts/comps/shape/edge.js +5 -18
- package/es/comps/DynamicPorts/comps/shape/node.js +4 -17
- package/es/comps/DynamicPorts/constant/index.js +2 -5
- package/es/comps/DynamicPorts/graph.d.ts +2 -2
- package/es/comps/DynamicPorts/graph.js +228 -312
- package/es/comps/DynamicPorts/index.js +39 -58
- package/es/comps/DynamicPorts/utils.js +21 -25
- package/es/comps/Editable/DataCell/ButtonCell.js +4 -10
- package/es/comps/Editable/DataCell/ColorPicker.js +2 -7
- package/es/comps/Editable/DataCell/Input.js +5 -14
- package/es/comps/Editable/DataCell/Number.js +3 -10
- package/es/comps/Editable/DataCell/Select.js +7 -14
- package/es/comps/Editable/DataCell/Switch.js +2 -7
- package/es/comps/Editable/comps/EditableAction.js +8 -12
- package/es/comps/Editable/comps/EditableCell.js +16 -26
- package/es/comps/Editable/comps/EditableHeardCell.js +21 -34
- package/es/comps/Editable/comps/EditableRow.js +49 -59
- package/es/comps/Editable/comps/Texty.js +36 -72
- package/es/comps/Editable/index.js +67 -112
- package/es/comps/Editable/interface.d.ts +1 -1
- package/es/comps/Editable/utils.js +0 -1
- package/es/comps/FileView/index.js +65 -101
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +6 -3
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +2 -5
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +86 -109
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +3 -7
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +54 -91
- package/es/comps/FormGenerator/comps/Canvas/core/index.less +23 -23
- package/es/comps/FormGenerator/comps/Canvas/index.js +8 -15
- package/es/comps/FormGenerator/comps/Settings/index.js +16 -30
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +23 -22
- package/es/comps/FormGenerator/comps/Sidebar/index.js +6 -2
- package/es/comps/FormGenerator/index.js +3 -9
- package/es/comps/FormGenerator/interface.d.ts +1 -1
- package/es/comps/FormGenerator/settings/index.js +12 -11
- package/es/comps/FormGenerator/settings/ruleConfig.js +0 -1
- package/es/comps/FormGenerator/transformer.js +40 -105
- package/es/comps/Icons/index.js +4 -7
- package/es/comps/JsonEdit/index.js +25 -50
- package/es/comps/JsonView/index.js +7 -21
- package/es/comps/JsonView/index.less +41 -41
- package/es/comps/MdEdit/index.js +7 -10
- package/es/comps/MdEdit/index.less +6 -6
- package/es/comps/MdEditPro/index.d.ts +10 -0
- package/es/comps/MdEditPro/index.js +22 -0
- package/es/comps/MdEditPro/index.less +74 -0
- package/es/comps/MdNavbar/index.js +17 -40
- package/es/comps/MdNavbar/utils.js +0 -4
- package/es/comps/MdView/index.js +7 -11
- package/es/comps/MdView/index.less +353 -353
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +129 -183
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +11 -27
- package/es/comps/MetadataEdit/hooks/index.js +3 -11
- package/es/comps/MetadataEdit/index.js +25 -58
- package/es/comps/MetadataEdit/index.less +10 -10
- package/es/comps/MetadataEdit/type.d.ts +20 -20
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +17 -33
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +15 -29
- package/es/comps/MetadataEditV2/hooks/index.js +5 -12
- package/es/comps/MetadataEditV2/index.js +30 -65
- package/es/comps/MetadataForm/DataCell/Array.js +12 -23
- package/es/comps/MetadataForm/DataCell/Input.js +12 -32
- package/es/comps/MetadataForm/DataCell/Number.js +10 -21
- package/es/comps/MetadataForm/DataCell/Ref.js +87 -121
- package/es/comps/MetadataForm/DataCell/Select.js +127 -222
- package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +93 -164
- package/es/comps/MetadataForm/HOC/index.js +20 -37
- package/es/comps/MetadataForm/HOC/index.less +41 -41
- package/es/comps/MetadataForm/hooks/index.js +12 -38
- package/es/comps/MetadataForm/index.js +37 -72
- package/es/comps/MetadataForm/interface.d.ts +3 -3
- package/es/comps/MetadataForm/utils.js +0 -14
- package/es/comps/Split/index.js +20 -22
- package/es/config.js +0 -4
- package/es/framework/RxStore/demo/index.js +9 -10
- package/es/framework/RxStore/hooks.d.ts +9 -9
- package/es/framework/RxStore/hooks.js +10 -35
- package/es/framework/RxStore/store.d.ts +4 -4
- package/es/framework/RxStore/store.js +0 -10
- package/es/framework/fg/index.js +18 -80
- package/es/framework/fg/interface.d.ts +2 -2
- package/es/framework/fg/utils.js +0 -10
- package/es/framework/graph/index.d.ts +2 -2
- package/es/framework/graph/index.js +55 -110
- package/es/framework/hooks/use-async-memo.js +3 -7
- package/es/framework/hooks/use-sync-scroll.js +2 -15
- package/es/framework/http/cache.js +25 -32
- package/es/framework/http/cancel.js +1 -7
- package/es/framework/http/index.js +22 -82
- package/es/framework/http/msgpack.js +0 -4
- package/es/framework/http/msgpack5/index.js +2 -12
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +1 -13
- package/es/framework/http/msgpack5/lib/decoder.js +10 -68
- package/es/framework/http/msgpack5/lib/encoder.js +8 -36
- package/es/framework/http/msgpack5/lib/helpers.js +3 -2
- package/es/framework/http/msgpack5/lib/streams.js +0 -18
- package/es/framework/libs/jquery.min.js +1009 -1696
- package/es/framework/locale/dil8/di18n.js +4 -15
- package/es/framework/locale/dil8/translate.js +0 -14
- package/es/framework/locale/dil8/util.js +0 -3
- package/es/framework/locale/index.js +2 -3
- package/es/framework/metadata/MetadataService.js +39 -78
- package/es/framework/metadata/index.js +4 -70
- package/es/framework/metadata/types.d.ts +98 -98
- package/es/framework/rxjs-hooks/useMemoSubject.js +0 -2
- package/es/framework/rxjs-hooks/useObservable.js +2 -4
- package/es/framework/rxjs-hooks/useObservableState.js +8 -14
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/theme.less +79 -79
- package/es/utils.js +58 -97
- package/package.json +104 -102
|
@@ -29,12 +29,11 @@ import "antd/es/tag/style";
|
|
|
29
29
|
import _Tag from "antd/es/tag";
|
|
30
30
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
31
31
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
32
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
33
32
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
34
33
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
35
34
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
36
35
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
37
|
-
|
|
36
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
38
37
|
/*
|
|
39
38
|
* @Author:wangxian
|
|
40
39
|
* @Date: 2021-09-18 14:15:04
|
|
@@ -49,87 +48,68 @@ import { useAsyncMemo } from '../../../framework/hooks/use-async-memo';
|
|
|
49
48
|
import { tr } from '../../../framework/locale';
|
|
50
49
|
import useObservable from '../../../framework/rxjs-hooks/useObservable';
|
|
51
50
|
import { assignReplace } from '../utils';
|
|
52
|
-
|
|
53
51
|
function Index(props) {
|
|
54
52
|
var _extraInfo$http8, _extraInfo$http9, _extraInfo$http10, _extraInfo$http11, _extraInfo$http12, _extraInfo$http13;
|
|
55
|
-
|
|
56
53
|
var id = props.id,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
name = props.name,
|
|
55
|
+
isRefForm = props.isRefForm,
|
|
56
|
+
_props$initEnumValue = props.initEnumValue,
|
|
57
|
+
initEnumValue = _props$initEnumValue === void 0 ? {} : _props$initEnumValue,
|
|
58
|
+
disabled = props.disabled,
|
|
59
|
+
field = props.field,
|
|
60
|
+
notRequire = props.notRequire,
|
|
61
|
+
labelSpan = props.labelSpan,
|
|
62
|
+
isObj = props.isObj,
|
|
63
|
+
_props$enum = props.enum,
|
|
64
|
+
myEnum = _props$enum === void 0 ? [] : _props$enum;
|
|
68
65
|
var formContext = React.useContext(MetadataFormContext) || {};
|
|
69
66
|
var formRefContext = React.useContext(MetadataRefContext);
|
|
70
67
|
var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
|
|
71
|
-
|
|
72
68
|
var _React$useState = React.useState([]),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
70
|
+
cascaderOption = _React$useState2[0],
|
|
71
|
+
setCascaderOption = _React$useState2[1];
|
|
77
72
|
var _React$useState3 = React.useState([]),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
74
|
+
treeData = _React$useState4[0],
|
|
75
|
+
setTreeData = _React$useState4[1];
|
|
82
76
|
var _React$useState5 = React.useState(),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
77
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
78
|
+
watchValue = _React$useState6[0],
|
|
79
|
+
setWatchValue = _React$useState6[1];
|
|
87
80
|
var watchValueRef = React.useRef();
|
|
88
|
-
|
|
89
81
|
var _React$useState7 = React.useState([]),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
82
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
83
|
+
mutiSelect = _React$useState8[0],
|
|
84
|
+
setMutiSelect = _React$useState8[1];
|
|
94
85
|
var pageRef = React.useRef(1);
|
|
95
86
|
var totalRef = React.useRef();
|
|
96
|
-
|
|
97
87
|
var onSelect = function onSelect(value) {
|
|
98
88
|
formContext.stream$ && formContext.stream$.next({
|
|
99
89
|
type: 'onSelectChange',
|
|
100
90
|
payload: _defineProperty({}, id, value)
|
|
101
91
|
});
|
|
102
92
|
};
|
|
103
|
-
|
|
104
93
|
useObservable(function (p) {
|
|
105
94
|
var _extraInfo$http;
|
|
106
|
-
|
|
107
95
|
// 判断是否有 watch的扩展属性
|
|
108
96
|
var _watch = extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http = extraInfo.http) === null || _extraInfo$http === void 0 ? void 0 : _extraInfo$http.watch;
|
|
109
|
-
|
|
110
97
|
if (_watch && (p === null || p === void 0 ? void 0 : p.type) === 'onValuesChange') {
|
|
111
98
|
try {
|
|
112
99
|
var _watchArr = _watch.split(',');
|
|
113
|
-
|
|
114
100
|
if (_watchArr.length === 1) {
|
|
115
101
|
var _p$payload;
|
|
116
|
-
|
|
117
102
|
var evalString = '';
|
|
118
|
-
|
|
119
103
|
for (var i = 0; i < name.length; i++) {
|
|
120
104
|
if (i < name.length - 1) {
|
|
121
105
|
evalString = "".concat(evalString, "[name[").concat(i, "]]");
|
|
122
106
|
}
|
|
123
107
|
}
|
|
124
|
-
|
|
125
108
|
var _value = eval("p?.payload?.allVals".concat(evalString, "[_watchArr[0]]"));
|
|
126
|
-
|
|
127
109
|
var _changeData = eval("p?.payload?.val".concat(evalString, "[_watchArr[0]]"));
|
|
128
|
-
|
|
129
110
|
if (_value && _changeData) {
|
|
130
111
|
if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http.method) === 'post') {
|
|
131
112
|
var _wRef = watchValueRef.current || {};
|
|
132
|
-
|
|
133
113
|
_wRef[_watchArr[0]] = _value;
|
|
134
114
|
watchValueRef.current = _wRef;
|
|
135
115
|
setWatchValue(_value);
|
|
@@ -138,7 +118,6 @@ function Index(props) {
|
|
|
138
118
|
watchValueRef.current = _value;
|
|
139
119
|
}
|
|
140
120
|
}
|
|
141
|
-
|
|
142
121
|
if (_changeData && !(p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : _p$payload.trigger)) {
|
|
143
122
|
setTimeout(function () {
|
|
144
123
|
var v = {};
|
|
@@ -148,30 +127,23 @@ function Index(props) {
|
|
|
148
127
|
}
|
|
149
128
|
} else {
|
|
150
129
|
var _p$payload2;
|
|
151
|
-
|
|
152
130
|
var b = false;
|
|
153
|
-
|
|
154
131
|
for (var _i = 0; _i < _watchArr.length; _i++) {
|
|
155
132
|
var w = _watchArr[_i];
|
|
156
133
|
var _evalString = '';
|
|
157
|
-
|
|
158
134
|
for (var _i2 = 0; _i2 < name.length; _i2++) {
|
|
159
135
|
if (_i2 < name.length - 1) {
|
|
160
136
|
_evalString = "".concat(_evalString, "[name[").concat(_i2, "]]");
|
|
161
137
|
}
|
|
162
138
|
}
|
|
163
|
-
|
|
164
139
|
var _value2 = eval("p?.payload?.allVals".concat(_evalString, "[w]"));
|
|
165
|
-
|
|
166
140
|
if (_value2) {
|
|
167
141
|
var _wRef2 = watchValueRef.current || {};
|
|
168
|
-
|
|
169
142
|
_wRef2[w] = _value2;
|
|
170
143
|
watchValueRef.current = _wRef2;
|
|
171
144
|
b = eval("p?.payload?.val".concat(_evalString, "[w]"));
|
|
172
145
|
}
|
|
173
146
|
}
|
|
174
|
-
|
|
175
147
|
if (b && !(p === null || p === void 0 ? void 0 : (_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.trigger)) {
|
|
176
148
|
setWatchValue(_objectSpread({}, watchValueRef.current));
|
|
177
149
|
setTimeout(function () {
|
|
@@ -189,170 +161,131 @@ function Index(props) {
|
|
|
189
161
|
var getEnumDataByUrl = React.useCallback( /*#__PURE__*/function () {
|
|
190
162
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(http, pid, page) {
|
|
191
163
|
var server, _url, res, _res;
|
|
192
|
-
|
|
193
164
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
194
|
-
while (1) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (typeof watchValueRef.current === 'string') {
|
|
203
|
-
_url = _url.replace('{watch}', watchValueRef.current);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
_context.next = 6;
|
|
208
|
-
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) ? _objectSpread(_objectSpread({}, JSON.parse(http === null || http === void 0 ? void 0 : http.body)), watchValueRef.current || {}) : watchValueRef.current);
|
|
209
|
-
|
|
210
|
-
case 6:
|
|
211
|
-
res = _context.sent;
|
|
212
|
-
_res = (res === null || res === void 0 ? void 0 : res.total) ? res === null || res === void 0 ? void 0 : res.list : res;
|
|
213
|
-
totalRef.current = res === null || res === void 0 ? void 0 : res.total;
|
|
214
|
-
|
|
215
|
-
if (!(_res && _res.length > 0)) {
|
|
216
|
-
_context.next = 19;
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (!((http === null || http === void 0 ? void 0 : http.isCascader) && http.url.indexOf('{pid}') === -1)) {
|
|
221
|
-
_context.next = 12;
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return _context.abrupt("return", _res);
|
|
226
|
-
|
|
227
|
-
case 12:
|
|
228
|
-
if (!(http === null || http === void 0 ? void 0 : http.isGroup)) {
|
|
229
|
-
_context.next = 14;
|
|
230
|
-
break;
|
|
165
|
+
while (1) switch (_context.prev = _context.next) {
|
|
166
|
+
case 0:
|
|
167
|
+
server = new MetadataService();
|
|
168
|
+
_url = pid || pid === '' ? http.url.replace('{pid}', pid) : http.url;
|
|
169
|
+
_url = page ? http.url.replace('{page}', page) : _url;
|
|
170
|
+
if (watchValueRef.current) {
|
|
171
|
+
if (typeof watchValueRef.current === 'string') {
|
|
172
|
+
_url = _url.replace('{watch}', watchValueRef.current);
|
|
231
173
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
174
|
+
}
|
|
175
|
+
_context.next = 6;
|
|
176
|
+
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) ? _objectSpread(_objectSpread({}, JSON.parse(http === null || http === void 0 ? void 0 : http.body)), watchValueRef.current || {}) : watchValueRef.current);
|
|
177
|
+
case 6:
|
|
178
|
+
res = _context.sent;
|
|
179
|
+
_res = (res === null || res === void 0 ? void 0 : res.total) ? res === null || res === void 0 ? void 0 : res.list : res;
|
|
180
|
+
totalRef.current = res === null || res === void 0 ? void 0 : res.total;
|
|
181
|
+
if (!(_res && _res.length > 0)) {
|
|
182
|
+
_context.next = 19;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
if (!((http === null || http === void 0 ? void 0 : http.isCascader) && http.url.indexOf('{pid}') === -1)) {
|
|
186
|
+
_context.next = 12;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
return _context.abrupt("return", _res);
|
|
190
|
+
case 12:
|
|
191
|
+
if (!(http === null || http === void 0 ? void 0 : http.isGroup)) {
|
|
192
|
+
_context.next = 14;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
return _context.abrupt("return", _res);
|
|
196
|
+
case 14:
|
|
197
|
+
if (!(http === null || http === void 0 ? void 0 : http.isTreeSelect)) {
|
|
198
|
+
_context.next = 16;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
return _context.abrupt("return", _res);
|
|
202
|
+
case 16:
|
|
203
|
+
return _context.abrupt("return", _res.map(function (it) {
|
|
204
|
+
if (http === null || http === void 0 ? void 0 : http.isCascader) {
|
|
205
|
+
return {
|
|
206
|
+
value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
|
|
207
|
+
label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
|
|
208
|
+
isLeaf: it['isLeaf'] ? it['isLeaf'] : false
|
|
209
|
+
};
|
|
210
|
+
} else {
|
|
211
|
+
return {
|
|
212
|
+
value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
|
|
213
|
+
label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
|
|
214
|
+
disabled: false
|
|
215
|
+
};
|
|
239
216
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
|
|
248
|
-
label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
|
|
249
|
-
isLeaf: it['isLeaf'] ? it['isLeaf'] : false
|
|
250
|
-
};
|
|
251
|
-
} else {
|
|
252
|
-
return {
|
|
253
|
-
value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
|
|
254
|
-
label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
|
|
255
|
-
disabled: false
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
}));
|
|
259
|
-
|
|
260
|
-
case 19:
|
|
261
|
-
console.warn("".concat(_url, " is not return success result"));
|
|
262
|
-
return _context.abrupt("return", []);
|
|
263
|
-
|
|
264
|
-
case 21:
|
|
265
|
-
case "end":
|
|
266
|
-
return _context.stop();
|
|
267
|
-
}
|
|
217
|
+
}));
|
|
218
|
+
case 19:
|
|
219
|
+
console.warn("".concat(_url, " is not return success result"));
|
|
220
|
+
return _context.abrupt("return", []);
|
|
221
|
+
case 21:
|
|
222
|
+
case "end":
|
|
223
|
+
return _context.stop();
|
|
268
224
|
}
|
|
269
225
|
}, _callee);
|
|
270
226
|
}));
|
|
271
|
-
|
|
272
227
|
return function (_x, _x2, _x3) {
|
|
273
228
|
return _ref.apply(this, arguments);
|
|
274
229
|
};
|
|
275
230
|
}(), []);
|
|
276
|
-
|
|
277
231
|
var processSelectOptionsData = function processSelectOptionsData() {
|
|
278
232
|
var _options = [];
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
233
|
+
var _enum = deepClone(myEnum || []);
|
|
234
|
+
// 扩展规则的value
|
|
283
235
|
if (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.value) {
|
|
284
236
|
_enum = deepClone(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.value);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
|
|
237
|
+
}
|
|
238
|
+
// 目前是更具那么的id判断的,暂未考虑重名问题
|
|
288
239
|
if (initEnumValue[id]) {
|
|
289
240
|
_enum = deepClone(initEnumValue[id]);
|
|
290
241
|
}
|
|
291
|
-
|
|
292
242
|
_enum.forEach(function (it) {
|
|
293
243
|
var _it$key;
|
|
294
|
-
|
|
295
244
|
var obj = {
|
|
296
245
|
label: it.value,
|
|
297
246
|
value: (_it$key = it === null || it === void 0 ? void 0 : it.key) !== null && _it$key !== void 0 ? _it$key : it === null || it === void 0 ? void 0 : it.value
|
|
298
247
|
};
|
|
299
|
-
|
|
300
248
|
_options.push(obj);
|
|
301
249
|
});
|
|
302
|
-
|
|
303
250
|
return _options;
|
|
304
251
|
};
|
|
305
|
-
|
|
306
252
|
var options = React.useMemo(function () {
|
|
307
253
|
return processSelectOptionsData();
|
|
308
254
|
}, [initEnumValue, myEnum, id, extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxSelect]);
|
|
309
255
|
var httpOptions = useAsyncMemo( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
310
256
|
var _extraInfo$http2, _extraInfo$http3, _extraInfo$http4, res;
|
|
311
|
-
|
|
312
257
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
313
|
-
while (1) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
return _context2.abrupt("return", res);
|
|
336
|
-
|
|
337
|
-
case 7:
|
|
338
|
-
return _context2.abrupt("return", []);
|
|
339
|
-
|
|
340
|
-
case 8:
|
|
341
|
-
case "end":
|
|
342
|
-
return _context2.stop();
|
|
343
|
-
}
|
|
258
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
259
|
+
case 0:
|
|
260
|
+
if (!((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http.url))) {
|
|
261
|
+
_context2.next = 7;
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
_context2.next = 3;
|
|
265
|
+
return getEnumDataByUrl(deepClone(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http), '', (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http2 = extraInfo.http) === null || _extraInfo$http2 === void 0 ? void 0 : _extraInfo$http2.isPagination) && pageRef.current);
|
|
266
|
+
case 3:
|
|
267
|
+
res = _context2.sent;
|
|
268
|
+
if (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http3 = extraInfo.http) === null || _extraInfo$http3 === void 0 ? void 0 : _extraInfo$http3.isCascader) {
|
|
269
|
+
setCascaderOption(_toConsumableArray(res));
|
|
270
|
+
}
|
|
271
|
+
if (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http4 = extraInfo.http) === null || _extraInfo$http4 === void 0 ? void 0 : _extraInfo$http4.isTreeSelect) {
|
|
272
|
+
setTreeData(_toConsumableArray(res));
|
|
273
|
+
}
|
|
274
|
+
return _context2.abrupt("return", res);
|
|
275
|
+
case 7:
|
|
276
|
+
return _context2.abrupt("return", []);
|
|
277
|
+
case 8:
|
|
278
|
+
case "end":
|
|
279
|
+
return _context2.stop();
|
|
344
280
|
}
|
|
345
281
|
}, _callee2);
|
|
346
282
|
})), [extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http, watchValue]);
|
|
347
283
|
var myOptions = React.useMemo(function () {
|
|
348
284
|
var _options = options;
|
|
349
|
-
|
|
350
285
|
if (httpOptions && httpOptions.length > 0) {
|
|
351
286
|
_options = httpOptions;
|
|
352
287
|
}
|
|
353
|
-
|
|
354
288
|
var _maxSelect = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxSelect;
|
|
355
|
-
|
|
356
289
|
if (_maxSelect && mutiSelect.length > 0) {
|
|
357
290
|
if (mutiSelect.length === _maxSelect) {
|
|
358
291
|
_options = _options.map(function (it) {
|
|
@@ -365,62 +298,47 @@ function Index(props) {
|
|
|
365
298
|
});
|
|
366
299
|
}
|
|
367
300
|
}
|
|
368
|
-
|
|
369
301
|
return _options;
|
|
370
302
|
}, [options, httpOptions, mutiSelect, extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxSelect]);
|
|
371
|
-
|
|
372
303
|
var loadData = /*#__PURE__*/function () {
|
|
373
304
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(selectedOptions) {
|
|
374
305
|
var _targetOption$childre;
|
|
375
|
-
|
|
376
306
|
var targetOption, _children;
|
|
377
|
-
|
|
378
307
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
379
|
-
while (1) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
}, 500);
|
|
400
|
-
|
|
401
|
-
case 7:
|
|
402
|
-
case "end":
|
|
403
|
-
return _context3.stop();
|
|
404
|
-
}
|
|
308
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
309
|
+
case 0:
|
|
310
|
+
targetOption = selectedOptions[selectedOptions.length - 1];
|
|
311
|
+
targetOption.loading = true;
|
|
312
|
+
if (!(!targetOption.isLeaf && (!(targetOption === null || targetOption === void 0 ? void 0 : targetOption.children) || ((_targetOption$childre = targetOption.children) === null || _targetOption$childre === void 0 ? void 0 : _targetOption$childre.length) === 0))) {
|
|
313
|
+
_context3.next = 7;
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
_context3.next = 5;
|
|
317
|
+
return getEnumDataByUrl(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http, targetOption.value);
|
|
318
|
+
case 5:
|
|
319
|
+
_children = _context3.sent;
|
|
320
|
+
setTimeout(function () {
|
|
321
|
+
targetOption.loading = false;
|
|
322
|
+
targetOption.children = _children;
|
|
323
|
+
setCascaderOption(_toConsumableArray(cascaderOption));
|
|
324
|
+
}, 500);
|
|
325
|
+
case 7:
|
|
326
|
+
case "end":
|
|
327
|
+
return _context3.stop();
|
|
405
328
|
}
|
|
406
329
|
}, _callee3);
|
|
407
330
|
}));
|
|
408
|
-
|
|
409
331
|
return function loadData(_x4) {
|
|
410
332
|
return _ref3.apply(this, arguments);
|
|
411
333
|
};
|
|
412
334
|
}();
|
|
413
|
-
|
|
414
335
|
var onSearch = function onSearch(value) {};
|
|
415
|
-
|
|
416
336
|
var onPagination = function onPagination(page, pageSize) {};
|
|
417
|
-
|
|
418
337
|
var onSelectChange = function onSelectChange(v) {
|
|
419
338
|
if (_typeof(v) === 'object') {
|
|
420
339
|
setMutiSelect(_toConsumableArray(v));
|
|
421
340
|
}
|
|
422
341
|
};
|
|
423
|
-
|
|
424
342
|
var maxTagPlaceholder = function maxTagPlaceholder(omittedValues) {
|
|
425
343
|
if (omittedValues) {
|
|
426
344
|
return /*#__PURE__*/React.createElement(_Tooltip, {
|
|
@@ -437,11 +355,9 @@ function Index(props) {
|
|
|
437
355
|
return '...';
|
|
438
356
|
}
|
|
439
357
|
};
|
|
440
|
-
|
|
441
358
|
var processSelectType = function processSelectType(isCascader, isTreeSelect, isPagination) {
|
|
442
359
|
if (isCascader) {
|
|
443
360
|
var _extraInfo$disabled;
|
|
444
|
-
|
|
445
361
|
return /*#__PURE__*/React.createElement(_Cascader, {
|
|
446
362
|
multiple: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple,
|
|
447
363
|
disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
|
|
@@ -451,12 +367,10 @@ function Index(props) {
|
|
|
451
367
|
});
|
|
452
368
|
} else if (isTreeSelect) {
|
|
453
369
|
var _extraInfo$disabled2;
|
|
454
|
-
|
|
455
370
|
return /*#__PURE__*/React.createElement(_TreeSelect, {
|
|
456
371
|
showSearch: true,
|
|
457
372
|
filterTreeNode: function filterTreeNode(input, treeNode) {
|
|
458
373
|
var _treeNode$label;
|
|
459
|
-
|
|
460
374
|
return (treeNode === null || treeNode === void 0 ? void 0 : (_treeNode$label = treeNode.label) === null || _treeNode$label === void 0 ? void 0 : _treeNode$label.toString().indexOf(input)) >= 0;
|
|
461
375
|
},
|
|
462
376
|
treeNodeLabelProp: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.treeNodeLabelProp,
|
|
@@ -481,7 +395,6 @@ function Index(props) {
|
|
|
481
395
|
});
|
|
482
396
|
} else if (isPagination) {
|
|
483
397
|
var _extraInfo$disabled3;
|
|
484
|
-
|
|
485
398
|
return /*#__PURE__*/React.createElement(_Select, {
|
|
486
399
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple) ? 'multiple' : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.mode,
|
|
487
400
|
onSelect: onSelect,
|
|
@@ -522,7 +435,6 @@ function Index(props) {
|
|
|
522
435
|
}
|
|
523
436
|
}, /*#__PURE__*/React.createElement(_Row, null, (httpOptions && httpOptions.length > 0 ? httpOptions : options).map(function (it) {
|
|
524
437
|
var _extraInfo$checkbox;
|
|
525
|
-
|
|
526
438
|
return /*#__PURE__*/React.createElement(_Col, {
|
|
527
439
|
key: it.value,
|
|
528
440
|
span: extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$checkbox = extraInfo.checkbox) === null || _extraInfo$checkbox === void 0 ? void 0 : _extraInfo$checkbox.colSpan
|
|
@@ -535,7 +447,6 @@ function Index(props) {
|
|
|
535
447
|
}
|
|
536
448
|
}, /*#__PURE__*/React.createElement(_Row, null, (httpOptions && httpOptions.length > 0 ? httpOptions : options).map(function (it) {
|
|
537
449
|
var _extraInfo$checkbox2;
|
|
538
|
-
|
|
539
450
|
return /*#__PURE__*/React.createElement(_Col, {
|
|
540
451
|
key: it.value,
|
|
541
452
|
span: extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$checkbox2 = extraInfo.checkbox) === null || _extraInfo$checkbox2 === void 0 ? void 0 : _extraInfo$checkbox2.colSpan
|
|
@@ -545,7 +456,6 @@ function Index(props) {
|
|
|
545
456
|
})));
|
|
546
457
|
} else {
|
|
547
458
|
var _extraInfo$disabled4;
|
|
548
|
-
|
|
549
459
|
return /*#__PURE__*/React.createElement(_Select, {
|
|
550
460
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple) ? 'multiple' : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.mode,
|
|
551
461
|
onSelect: onSelect,
|
|
@@ -555,7 +465,6 @@ function Index(props) {
|
|
|
555
465
|
showSearch: true,
|
|
556
466
|
filterOption: function filterOption(input, option) {
|
|
557
467
|
var _option$label;
|
|
558
|
-
|
|
559
468
|
return (option === null || option === void 0 ? void 0 : (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.toString().indexOf(input)) >= 0;
|
|
560
469
|
},
|
|
561
470
|
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
@@ -569,10 +478,8 @@ function Index(props) {
|
|
|
569
478
|
});
|
|
570
479
|
}
|
|
571
480
|
};
|
|
572
|
-
|
|
573
481
|
if (isObj && isRefForm && field) {
|
|
574
482
|
var _extraInfo$http5, _extraInfo$http6, _extraInfo$http7;
|
|
575
|
-
|
|
576
483
|
return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
|
577
484
|
style: {
|
|
578
485
|
flex: 1,
|
|
@@ -602,7 +509,6 @@ function Index(props) {
|
|
|
602
509
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
|
603
510
|
}), processSelectType((_extraInfo$http5 = extraInfo.http) === null || _extraInfo$http5 === void 0 ? void 0 : _extraInfo$http5.isCascader, (_extraInfo$http6 = extraInfo.http) === null || _extraInfo$http6 === void 0 ? void 0 : _extraInfo$http6.isTreeSelect, (_extraInfo$http7 = extraInfo.http) === null || _extraInfo$http7 === void 0 ? void 0 : _extraInfo$http7.isPagination));
|
|
604
511
|
}
|
|
605
|
-
|
|
606
512
|
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
|
607
513
|
key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
|
608
514
|
initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
|
@@ -644,5 +550,4 @@ function Index(props) {
|
|
|
644
550
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
|
645
551
|
}), processSelectType((_extraInfo$http11 = extraInfo.http) === null || _extraInfo$http11 === void 0 ? void 0 : _extraInfo$http11.isCascader, (_extraInfo$http12 = extraInfo.http) === null || _extraInfo$http12 === void 0 ? void 0 : _extraInfo$http12.isTreeSelect, (_extraInfo$http13 = extraInfo.http) === null || _extraInfo$http13 === void 0 ? void 0 : _extraInfo$http13.isPagination));
|
|
646
552
|
}
|
|
647
|
-
|
|
648
553
|
export default /*#__PURE__*/React.memo(Index);
|
|
@@ -4,7 +4,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import "antd/es/switch/style";
|
|
5
5
|
import _Switch from "antd/es/switch";
|
|
6
6
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* @Author: wangxian
|
|
10
9
|
* @Date: 2021-09-18 14:15:04
|
|
@@ -13,25 +12,21 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
13
12
|
import React from 'react';
|
|
14
13
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
|
15
14
|
import { useGetExtraInfo } from '../hooks';
|
|
16
|
-
|
|
17
15
|
function Index(props) {
|
|
18
16
|
var _extraInfo$disabled2, _extraInfo$disabled3;
|
|
19
|
-
|
|
20
17
|
var id = props.id,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
name = props.name,
|
|
19
|
+
isRefForm = props.isRefForm,
|
|
20
|
+
disabled = props.disabled,
|
|
21
|
+
notRequire = props.notRequire,
|
|
22
|
+
labelSpan = props.labelSpan,
|
|
23
|
+
field = props.field,
|
|
24
|
+
isObj = props.isObj;
|
|
28
25
|
var formContext = React.useContext(MetadataFormContext) || {};
|
|
29
26
|
var formRefContext = React.useContext(MetadataRefContext);
|
|
30
27
|
var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
|
|
31
|
-
|
|
32
28
|
if (isObj && isRefForm && field) {
|
|
33
29
|
var _extraInfo$disabled;
|
|
34
|
-
|
|
35
30
|
return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
|
36
31
|
style: {
|
|
37
32
|
flex: 1,
|
|
@@ -66,7 +61,6 @@ function Index(props) {
|
|
|
66
61
|
unCheckedChildren: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.unCheckedChildren
|
|
67
62
|
}));
|
|
68
63
|
}
|
|
69
|
-
|
|
70
64
|
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
|
71
65
|
label: /*#__PURE__*/React.createElement("span", {
|
|
72
66
|
style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
|
|
@@ -118,5 +112,4 @@ function Index(props) {
|
|
|
118
112
|
unCheckedChildren: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.unCheckedChildren
|
|
119
113
|
}));
|
|
120
114
|
}
|
|
121
|
-
|
|
122
115
|
export default /*#__PURE__*/React.memo(Index);
|