ronds-metadata 1.2.16 → 1.2.18
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.
|
@@ -19,6 +19,8 @@ import "antd/es/input/style";
|
|
|
19
19
|
import _Input from "antd/es/input";
|
|
20
20
|
import "antd/es/divider/style";
|
|
21
21
|
import _Divider from "antd/es/divider";
|
|
22
|
+
import "antd/es/tree-select/style";
|
|
23
|
+
import _TreeSelect from "antd/es/tree-select";
|
|
22
24
|
import "antd/es/cascader/style";
|
|
23
25
|
import _Cascader from "antd/es/cascader";
|
|
24
26
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
@@ -32,7 +34,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
32
34
|
/*
|
|
33
35
|
* @Author:wangxian
|
|
34
36
|
* @Date: 2021-09-18 14:15:04
|
|
35
|
-
* @LastEditTime: 2023-03-
|
|
37
|
+
* @LastEditTime: 2023-03-07 08:29:13
|
|
36
38
|
*/
|
|
37
39
|
import React from 'react';
|
|
38
40
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
|
@@ -45,7 +47,7 @@ import useObservable from '../../../framework/rxjs-hooks/useObservable';
|
|
|
45
47
|
import { assign } from '../utils';
|
|
46
48
|
|
|
47
49
|
function Index(props) {
|
|
48
|
-
var _extraInfo$
|
|
50
|
+
var _extraInfo$http8, _extraInfo$http9, _extraInfo$http10, _extraInfo$http11, _extraInfo$http12, _extraInfo$http13;
|
|
49
51
|
|
|
50
52
|
var id = props.id,
|
|
51
53
|
name = props.name,
|
|
@@ -68,17 +70,22 @@ function Index(props) {
|
|
|
68
70
|
cascaderOption = _React$useState2[0],
|
|
69
71
|
setCascaderOption = _React$useState2[1];
|
|
70
72
|
|
|
71
|
-
var _React$useState3 = React.useState(),
|
|
73
|
+
var _React$useState3 = React.useState([]),
|
|
72
74
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
treeData = _React$useState4[0],
|
|
76
|
+
setTreeData = _React$useState4[1];
|
|
77
|
+
|
|
78
|
+
var _React$useState5 = React.useState(),
|
|
79
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
80
|
+
watchValue = _React$useState6[0],
|
|
81
|
+
setWatchValue = _React$useState6[1];
|
|
75
82
|
|
|
76
83
|
var watchValueRef = React.useRef();
|
|
77
84
|
|
|
78
|
-
var _React$
|
|
79
|
-
_React$
|
|
80
|
-
mutiSelect = _React$
|
|
81
|
-
setMutiSelect = _React$
|
|
85
|
+
var _React$useState7 = React.useState([]),
|
|
86
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
87
|
+
mutiSelect = _React$useState8[0],
|
|
88
|
+
setMutiSelect = _React$useState8[1];
|
|
82
89
|
|
|
83
90
|
var pageRef = React.useRef(1);
|
|
84
91
|
var totalRef = React.useRef();
|
|
@@ -101,6 +108,8 @@ function Index(props) {
|
|
|
101
108
|
var _watchArr = _watch.split(',');
|
|
102
109
|
|
|
103
110
|
if (_watchArr.length === 1) {
|
|
111
|
+
var _p$payload;
|
|
112
|
+
|
|
104
113
|
var evalString = '';
|
|
105
114
|
|
|
106
115
|
for (var i = 0; i < name.length; i++) {
|
|
@@ -126,7 +135,7 @@ function Index(props) {
|
|
|
126
135
|
}
|
|
127
136
|
}
|
|
128
137
|
|
|
129
|
-
if (_changeData) {
|
|
138
|
+
if (_changeData && !(p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : _p$payload.trigger)) {
|
|
130
139
|
setTimeout(function () {
|
|
131
140
|
var v = {};
|
|
132
141
|
assign(name, undefined, v);
|
|
@@ -134,6 +143,8 @@ function Index(props) {
|
|
|
134
143
|
}, 100);
|
|
135
144
|
}
|
|
136
145
|
} else {
|
|
146
|
+
var _p$payload2;
|
|
147
|
+
|
|
137
148
|
var b = false;
|
|
138
149
|
|
|
139
150
|
for (var _i = 0; _i < _watchArr.length; _i++) {
|
|
@@ -157,7 +168,7 @@ function Index(props) {
|
|
|
157
168
|
}
|
|
158
169
|
}
|
|
159
170
|
|
|
160
|
-
if (b) {
|
|
171
|
+
if (b && !(p === null || p === void 0 ? void 0 : (_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.trigger)) {
|
|
161
172
|
setWatchValue(_objectSpread({}, watchValueRef.current));
|
|
162
173
|
setTimeout(function () {
|
|
163
174
|
var v = {};
|
|
@@ -198,7 +209,7 @@ function Index(props) {
|
|
|
198
209
|
totalRef.current = res === null || res === void 0 ? void 0 : res.total;
|
|
199
210
|
|
|
200
211
|
if (!(_res && _res.length > 0)) {
|
|
201
|
-
_context.next =
|
|
212
|
+
_context.next = 19;
|
|
202
213
|
break;
|
|
203
214
|
}
|
|
204
215
|
|
|
@@ -218,6 +229,14 @@ function Index(props) {
|
|
|
218
229
|
return _context.abrupt("return", _res);
|
|
219
230
|
|
|
220
231
|
case 14:
|
|
232
|
+
if (!(http === null || http === void 0 ? void 0 : http.isTreeSelect)) {
|
|
233
|
+
_context.next = 16;
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return _context.abrupt("return", _res);
|
|
238
|
+
|
|
239
|
+
case 16:
|
|
221
240
|
return _context.abrupt("return", _res.map(function (it) {
|
|
222
241
|
if (http === null || http === void 0 ? void 0 : http.isCascader) {
|
|
223
242
|
return {
|
|
@@ -234,11 +253,11 @@ function Index(props) {
|
|
|
234
253
|
}
|
|
235
254
|
}));
|
|
236
255
|
|
|
237
|
-
case
|
|
256
|
+
case 19:
|
|
238
257
|
console.warn("".concat(_url, " is not return success result"));
|
|
239
258
|
return _context.abrupt("return", []);
|
|
240
259
|
|
|
241
|
-
case
|
|
260
|
+
case 21:
|
|
242
261
|
case "end":
|
|
243
262
|
return _context.stop();
|
|
244
263
|
}
|
|
@@ -284,14 +303,14 @@ function Index(props) {
|
|
|
284
303
|
return processSelectOptionsData();
|
|
285
304
|
}, [initEnumValue, myEnum, id, extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxSelect]);
|
|
286
305
|
var httpOptions = useAsyncMemo( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
287
|
-
var _extraInfo$http2, _extraInfo$http3, res;
|
|
306
|
+
var _extraInfo$http2, _extraInfo$http3, _extraInfo$http4, res;
|
|
288
307
|
|
|
289
308
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
290
309
|
while (1) {
|
|
291
310
|
switch (_context2.prev = _context2.next) {
|
|
292
311
|
case 0:
|
|
293
312
|
if (!((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http.url))) {
|
|
294
|
-
_context2.next =
|
|
313
|
+
_context2.next = 7;
|
|
295
314
|
break;
|
|
296
315
|
}
|
|
297
316
|
|
|
@@ -305,12 +324,16 @@ function Index(props) {
|
|
|
305
324
|
setCascaderOption(_toConsumableArray(res));
|
|
306
325
|
}
|
|
307
326
|
|
|
327
|
+
if (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http4 = extraInfo.http) === null || _extraInfo$http4 === void 0 ? void 0 : _extraInfo$http4.isTreeSelect) {
|
|
328
|
+
setTreeData(_toConsumableArray(res));
|
|
329
|
+
}
|
|
330
|
+
|
|
308
331
|
return _context2.abrupt("return", res);
|
|
309
332
|
|
|
310
|
-
case
|
|
333
|
+
case 7:
|
|
311
334
|
return _context2.abrupt("return", []);
|
|
312
335
|
|
|
313
|
-
case
|
|
336
|
+
case 8:
|
|
314
337
|
case "end":
|
|
315
338
|
return _context2.stop();
|
|
316
339
|
}
|
|
@@ -394,7 +417,7 @@ function Index(props) {
|
|
|
394
417
|
}
|
|
395
418
|
};
|
|
396
419
|
|
|
397
|
-
var processSelectType = function processSelectType(isCascader, isPagination) {
|
|
420
|
+
var processSelectType = function processSelectType(isCascader, isTreeSelect, isPagination) {
|
|
398
421
|
if (isCascader) {
|
|
399
422
|
var _extraInfo$disabled;
|
|
400
423
|
|
|
@@ -405,13 +428,43 @@ function Index(props) {
|
|
|
405
428
|
loadData: loadData,
|
|
406
429
|
maxTagCount: 10
|
|
407
430
|
});
|
|
408
|
-
} else if (
|
|
431
|
+
} else if (isTreeSelect) {
|
|
409
432
|
var _extraInfo$disabled2;
|
|
410
433
|
|
|
434
|
+
return /*#__PURE__*/React.createElement(_TreeSelect, {
|
|
435
|
+
showSearch: true,
|
|
436
|
+
filterTreeNode: function filterTreeNode(input, treeNode) {
|
|
437
|
+
var _treeNode$label;
|
|
438
|
+
|
|
439
|
+
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;
|
|
440
|
+
},
|
|
441
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
442
|
+
return triggerNode.parentNode;
|
|
443
|
+
},
|
|
444
|
+
multiple: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple,
|
|
445
|
+
style: {
|
|
446
|
+
width: '100%'
|
|
447
|
+
},
|
|
448
|
+
dropdownStyle: {
|
|
449
|
+
maxHeight: 400,
|
|
450
|
+
overflow: 'auto'
|
|
451
|
+
},
|
|
452
|
+
treeData: treeData,
|
|
453
|
+
allowClear: true,
|
|
454
|
+
disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
|
|
455
|
+
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
|
|
456
|
+
treeDefaultExpandAll: true,
|
|
457
|
+
maxTagCount: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxTagCount,
|
|
458
|
+
maxTagTextLength: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxTagTextLength,
|
|
459
|
+
maxTagPlaceholder: "..."
|
|
460
|
+
});
|
|
461
|
+
} else if (isPagination) {
|
|
462
|
+
var _extraInfo$disabled3;
|
|
463
|
+
|
|
411
464
|
return /*#__PURE__*/React.createElement(_Select, {
|
|
412
465
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple) ? 'multiple' : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.mode,
|
|
413
466
|
onSelect: onSelect,
|
|
414
|
-
disabled: (_extraInfo$
|
|
467
|
+
disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
|
|
415
468
|
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
|
|
416
469
|
options: httpOptions && httpOptions.length > 0 ? httpOptions : options,
|
|
417
470
|
dropdownRender: function dropdownRender(menu) {
|
|
@@ -470,12 +523,12 @@ function Index(props) {
|
|
|
470
523
|
}, it.label));
|
|
471
524
|
})));
|
|
472
525
|
} else {
|
|
473
|
-
var _extraInfo$
|
|
526
|
+
var _extraInfo$disabled4;
|
|
474
527
|
|
|
475
528
|
return /*#__PURE__*/React.createElement(_Select, {
|
|
476
529
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple) ? 'multiple' : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.mode,
|
|
477
530
|
onSelect: onSelect,
|
|
478
|
-
disabled: (_extraInfo$
|
|
531
|
+
disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
|
|
479
532
|
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
|
|
480
533
|
options: myOptions,
|
|
481
534
|
showSearch: true,
|
|
@@ -490,14 +543,14 @@ function Index(props) {
|
|
|
490
543
|
allowClear: true,
|
|
491
544
|
onChange: onSelectChange,
|
|
492
545
|
maxTagCount: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxTagCount,
|
|
493
|
-
maxTagTextLength:
|
|
546
|
+
maxTagTextLength: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxTagTextLength,
|
|
494
547
|
maxTagPlaceholder: "..."
|
|
495
548
|
});
|
|
496
549
|
}
|
|
497
550
|
};
|
|
498
551
|
|
|
499
552
|
if (isObj && isRefForm && field) {
|
|
500
|
-
var _extraInfo$
|
|
553
|
+
var _extraInfo$http5, _extraInfo$http6, _extraInfo$http7;
|
|
501
554
|
|
|
502
555
|
return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
|
503
556
|
style: {
|
|
@@ -523,7 +576,7 @@ function Index(props) {
|
|
|
523
576
|
}],
|
|
524
577
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
|
525
578
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
|
526
|
-
}), processSelectType((_extraInfo$
|
|
579
|
+
}), 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));
|
|
527
580
|
}
|
|
528
581
|
|
|
529
582
|
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
|
@@ -551,7 +604,7 @@ function Index(props) {
|
|
|
551
604
|
}],
|
|
552
605
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
|
553
606
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
|
554
|
-
}, processSelectType((_extraInfo$
|
|
607
|
+
}, processSelectType((_extraInfo$http8 = extraInfo.http) === null || _extraInfo$http8 === void 0 ? void 0 : _extraInfo$http8.isCascader, (_extraInfo$http9 = extraInfo.http) === null || _extraInfo$http9 === void 0 ? void 0 : _extraInfo$http9.isTreeSelect, (_extraInfo$http10 = extraInfo.http) === null || _extraInfo$http10 === void 0 ? void 0 : _extraInfo$http10.isPagination)) : /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
|
|
555
608
|
style: {
|
|
556
609
|
flex: 1,
|
|
557
610
|
paddingRight: '10px'
|
|
@@ -562,7 +615,7 @@ function Index(props) {
|
|
|
562
615
|
}],
|
|
563
616
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
|
564
617
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
|
565
|
-
}), processSelectType((_extraInfo$
|
|
618
|
+
}), 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));
|
|
566
619
|
}
|
|
567
620
|
|
|
568
621
|
export default /*#__PURE__*/React.memo(Index);
|