@zat-design/sisyphus-react 3.11.6-beta.4 → 3.11.6-beta.6
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/ProEditTable/components/RcTable/BaseTable.js +19 -9
- package/es/ProEditTable/index.js +24 -15
- package/es/ProEditTable/propsType.d.ts +0 -1
- package/es/ProEditTable/utils/tools.d.ts +2 -2
- package/es/ProEditTable/utils/tools.js +4 -11
- package/es/ProEditTable/utils/useEditTableError.d.ts +7 -0
- package/es/ProEditTable/utils/useEditTableError.js +81 -0
- package/es/ProForm/components/combination/ProModalSelect/index.js +15 -17
- package/lib/ProEditTable/components/RcTable/BaseTable.js +19 -9
- package/lib/ProEditTable/index.js +24 -15
- package/lib/ProEditTable/propsType.d.ts +0 -1
- package/lib/ProEditTable/utils/tools.d.ts +2 -2
- package/lib/ProEditTable/utils/tools.js +4 -11
- package/lib/ProEditTable/utils/useEditTableError.d.ts +7 -0
- package/lib/ProEditTable/utils/useEditTableError.js +88 -0
- package/lib/ProForm/components/combination/ProModalSelect/index.js +15 -17
- package/package.json +1 -1
@@ -3,10 +3,12 @@ import _Badge from "antd/es/badge";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
4
4
|
import "antd/es/table/style";
|
5
5
|
import _Table from "antd/es/table";
|
6
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
6
7
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
7
8
|
var _excluded = ["tableProps"];
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
9
10
|
import { memo } from 'react';
|
11
|
+
import useEditTableError from '../../utils/useEditTableError';
|
10
12
|
var BaseTable = function BaseTable(_ref) {
|
11
13
|
var _value$;
|
12
14
|
var tableProps = _ref.tableProps,
|
@@ -29,8 +31,14 @@ var BaseTable = function BaseTable(_ref) {
|
|
29
31
|
page = tableProps.page,
|
30
32
|
formatMessage = tableProps.formatMessage,
|
31
33
|
locale = tableProps.locale,
|
32
|
-
handlePageChange = tableProps.handlePageChange
|
33
|
-
|
34
|
+
handlePageChange = tableProps.handlePageChange;
|
35
|
+
var _useEditTableError = useEditTableError({
|
36
|
+
containerNode: tableRef.current,
|
37
|
+
className: 'ant-form-item-explain-error',
|
38
|
+
isEnabled: pagination // 分页时启用
|
39
|
+
}),
|
40
|
+
_useEditTableError2 = _slicedToArray(_useEditTableError, 1),
|
41
|
+
errorLength = _useEditTableError2[0];
|
34
42
|
return _jsxs(_Fragment, {
|
35
43
|
children: [headerRender ? _jsx("div", {
|
36
44
|
className: "pro-edit-table-header",
|
@@ -51,10 +59,9 @@ var BaseTable = function BaseTable(_ref) {
|
|
51
59
|
};
|
52
60
|
}
|
53
61
|
}, resetProps), {}, {
|
54
|
-
pagination: pagination ? _objectSpread({
|
55
|
-
|
56
|
-
|
57
|
-
showSizeChanger: false,
|
62
|
+
pagination: pagination ? _objectSpread(_objectSpread({
|
63
|
+
showSizeChanger: true,
|
64
|
+
pageSizeOptions: [5, 10, 20, 50],
|
58
65
|
showQuickJumper: true,
|
59
66
|
total: value === null || value === void 0 ? void 0 : value.length,
|
60
67
|
showTotal: function showTotal(total) {
|
@@ -65,15 +72,18 @@ var BaseTable = function BaseTable(_ref) {
|
|
65
72
|
});
|
66
73
|
},
|
67
74
|
itemRender: function itemRender(index, type, originalElement) {
|
68
|
-
return type === 'page' && page.pageNum === index &&
|
75
|
+
return type === 'page' && page.pageNum === index && errorLength ? _jsxs("div", {
|
69
76
|
className: "pro-edit-table-pagination-item-badge",
|
70
77
|
children: [_jsx(_Badge, {
|
71
|
-
count:
|
78
|
+
count: errorLength
|
72
79
|
}), originalElement]
|
73
80
|
}) : originalElement;
|
74
81
|
},
|
75
82
|
onChange: handlePageChange
|
76
|
-
}, pagination)
|
83
|
+
}, pagination), {}, {
|
84
|
+
current: page.pageNum,
|
85
|
+
pageSize: page.pageSize
|
86
|
+
}) : false,
|
77
87
|
rowKey: "rowKey",
|
78
88
|
scroll: {
|
79
89
|
x: scroll === null || scroll === void 0 ? void 0 : scroll.x,
|
package/es/ProEditTable/index.js
CHANGED
@@ -99,8 +99,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
99
99
|
page: {
|
100
100
|
pageNum: 1,
|
101
101
|
pageSize: (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || 10
|
102
|
-
}
|
103
|
-
pageErrorNum: 0
|
102
|
+
}
|
104
103
|
}),
|
105
104
|
_useSetState2 = _slicedToArray(_useSetState, 2),
|
106
105
|
state = _useSetState2[0],
|
@@ -111,8 +110,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
111
110
|
virtualKey = state.virtualKey,
|
112
111
|
selectedRowKeys = state.selectedRowKeys,
|
113
112
|
selectedRows = state.selectedRows,
|
114
|
-
page = state.page
|
115
|
-
pageErrorNum = state.pageErrorNum;
|
113
|
+
page = state.page;
|
116
114
|
var virtualRowName = getNamePath(isArray(name) ? name : [name], virtualKey);
|
117
115
|
// 样式处理
|
118
116
|
var _className = classnames({
|
@@ -171,32 +169,44 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
171
169
|
case 0:
|
172
170
|
_context.prev = 0;
|
173
171
|
if (!pagination) {
|
172
|
+
_context.next = 8;
|
173
|
+
break;
|
174
|
+
}
|
175
|
+
if (!(pageSize !== page.pageSize)) {
|
174
176
|
_context.next = 5;
|
175
177
|
break;
|
176
178
|
}
|
177
|
-
|
179
|
+
setState({
|
180
|
+
page: {
|
181
|
+
pageNum: current,
|
182
|
+
pageSize: pageSize
|
183
|
+
}
|
184
|
+
});
|
185
|
+
return _context.abrupt("return");
|
186
|
+
case 5:
|
187
|
+
_context.next = 7;
|
178
188
|
return form.validateFields([name], {
|
179
189
|
recursive: true
|
180
190
|
});
|
181
|
-
case
|
191
|
+
case 7:
|
182
192
|
setState({
|
183
193
|
page: {
|
184
194
|
pageNum: current,
|
185
195
|
pageSize: pageSize !== null && pageSize !== void 0 ? pageSize : page.pageSize
|
186
196
|
}
|
187
197
|
});
|
188
|
-
case
|
189
|
-
_context.next =
|
198
|
+
case 8:
|
199
|
+
_context.next = 13;
|
190
200
|
break;
|
191
|
-
case
|
192
|
-
_context.prev =
|
201
|
+
case 10:
|
202
|
+
_context.prev = 10;
|
193
203
|
_context.t0 = _context["catch"](0);
|
194
204
|
handleScrollToError();
|
195
|
-
case
|
205
|
+
case 13:
|
196
206
|
case "end":
|
197
207
|
return _context.stop();
|
198
208
|
}
|
199
|
-
}, _callee, null, [[0,
|
209
|
+
}, _callee, null, [[0, 10]]);
|
200
210
|
}));
|
201
211
|
return function (_x, _x2) {
|
202
212
|
return _ref4.apply(this, arguments);
|
@@ -413,7 +423,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
413
423
|
page: page,
|
414
424
|
formatMessage: formatMessage,
|
415
425
|
locale: locale,
|
416
|
-
pageErrorNum: pageErrorNum,
|
417
426
|
handlePageChange: handlePageChange
|
418
427
|
}
|
419
428
|
})), !isView && (value === null || value === void 0 ? void 0 : value.length) ? toolbarSticky ? _jsx(_Affix, _objectSpread(_objectSpread({
|
@@ -439,9 +448,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
439
448
|
columns: columns,
|
440
449
|
page: page,
|
441
450
|
pagination: pagination,
|
442
|
-
setState: setState,
|
443
451
|
isView: isView,
|
444
|
-
disabled: disabled
|
452
|
+
disabled: disabled,
|
453
|
+
setState: setState
|
445
454
|
});
|
446
455
|
}
|
447
456
|
}) : null]
|
@@ -38,14 +38,14 @@ export declare function cloneDeepFilterNode(value: any): any;
|
|
38
38
|
/**
|
39
39
|
* 分页校验
|
40
40
|
*/
|
41
|
-
export declare const onPageCheck: ({ form, name, value, columns, page, pagination,
|
41
|
+
export declare const onPageCheck: ({ form, name, value, columns, setState, page, pagination, isView, disabled }: {
|
42
42
|
form: any;
|
43
43
|
name: any;
|
44
44
|
value: any;
|
45
45
|
columns: any;
|
46
|
+
setState: any;
|
46
47
|
page: any;
|
47
48
|
pagination: any;
|
48
|
-
setState: any;
|
49
49
|
isView: any;
|
50
50
|
disabled: any;
|
51
51
|
}) => Promise<void>;
|
@@ -339,13 +339,13 @@ var handleCheckCellValue = /*#__PURE__*/function () {
|
|
339
339
|
*/
|
340
340
|
export var onPageCheck = /*#__PURE__*/function () {
|
341
341
|
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref7) {
|
342
|
-
var form, name, value, columns, page, pagination,
|
342
|
+
var form, name, value, columns, setState, page, pagination, isView, disabled, pageNum, pageSize, pageArr, flag, errorNum, errorPageNum, _i, _pageArr, item, start, end, nextValues, _iterator2, _step2, record, _iterator3, _step3, column, result, nextState;
|
343
343
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
344
344
|
while (1) switch (_context2.prev = _context2.next) {
|
345
345
|
case 0:
|
346
|
-
form = _ref7.form, name = _ref7.name, value = _ref7.value, columns = _ref7.columns,
|
346
|
+
form = _ref7.form, name = _ref7.name, value = _ref7.value, columns = _ref7.columns, setState = _ref7.setState, page = _ref7.page, pagination = _ref7.pagination, isView = _ref7.isView, disabled = _ref7.disabled;
|
347
347
|
if (!(pagination && !isView && !disabled)) {
|
348
|
-
_context2.next =
|
348
|
+
_context2.next = 72;
|
349
349
|
break;
|
350
350
|
}
|
351
351
|
pageNum = page.pageNum, pageSize = page.pageSize;
|
@@ -447,7 +447,7 @@ export var onPageCheck = /*#__PURE__*/function () {
|
|
447
447
|
break;
|
448
448
|
case 60:
|
449
449
|
if (!(flag && errorNum > 0)) {
|
450
|
-
_context2.next =
|
450
|
+
_context2.next = 72;
|
451
451
|
break;
|
452
452
|
}
|
453
453
|
nextState = {
|
@@ -473,13 +473,6 @@ export var onPageCheck = /*#__PURE__*/function () {
|
|
473
473
|
_context2.t3 = _context2["catch"](64);
|
474
474
|
handleScrollToError();
|
475
475
|
case 72:
|
476
|
-
_context2.next = 75;
|
477
|
-
break;
|
478
|
-
case 74:
|
479
|
-
setState({
|
480
|
-
pageErrorNum: 0
|
481
|
-
});
|
482
|
-
case 75:
|
483
476
|
case "end":
|
484
477
|
return _context2.stop();
|
485
478
|
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
interface UseEditTableErrorProps {
|
2
|
+
containerNode: HTMLElement | null;
|
3
|
+
className: string;
|
4
|
+
isEnabled: boolean;
|
5
|
+
}
|
6
|
+
declare const useEditTableError: ({ containerNode, className, isEnabled }: UseEditTableErrorProps) => [number];
|
7
|
+
export default useEditTableError;
|
@@ -0,0 +1,81 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
import { useState, useEffect } from 'react';
|
3
|
+
import { debounce } from 'lodash';
|
4
|
+
var useEditTableError = function useEditTableError(_ref) {
|
5
|
+
var containerNode = _ref.containerNode,
|
6
|
+
className = _ref.className,
|
7
|
+
isEnabled = _ref.isEnabled;
|
8
|
+
var _useState = useState(0),
|
9
|
+
_useState2 = _slicedToArray(_useState, 2),
|
10
|
+
errorLength = _useState2[0],
|
11
|
+
setErrorLength = _useState2[1];
|
12
|
+
useEffect(function () {
|
13
|
+
// 如果 isEnabled 为 false 或容器节点不存在,直接跳过监听
|
14
|
+
if (!isEnabled || !containerNode) {
|
15
|
+
return; // 如果未启用监听或容器节点不存在,直接返回
|
16
|
+
}
|
17
|
+
// 防抖处理:将 setErrorLength 函数进行防抖
|
18
|
+
var debouncedSetErrorLength = debounce(function (errorCount) {
|
19
|
+
setErrorLength(errorCount); // 更新错误数量
|
20
|
+
}, 300); // 300ms 后更新状态
|
21
|
+
var observer = new MutationObserver(function (mutations) {
|
22
|
+
mutations.forEach(function (mutation) {
|
23
|
+
// 只处理节点的 class 属性变化
|
24
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
25
|
+
var target = mutation.target;
|
26
|
+
// 检查目标节点是否包含指定的类
|
27
|
+
if (target.classList.contains(className)) {
|
28
|
+
// 查找所有包含 className 的节点
|
29
|
+
var errorNodes = containerNode.querySelectorAll(".".concat(className));
|
30
|
+
// debugger;
|
31
|
+
// 过滤这些节点,只保留那些类名完全为 `ant-form-item-explain-error` 的节点
|
32
|
+
var validErrorNodes = Array.from(errorNodes).filter(function (node) {
|
33
|
+
return node.classList.length === 1 && node.classList.contains('ant-form-item-explain-error');
|
34
|
+
});
|
35
|
+
if (errorLength === 0) {
|
36
|
+
debouncedSetErrorLength(0);
|
37
|
+
}
|
38
|
+
if (errorLength === validErrorNodes.length) {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
// 使用防抖后的方法更新错误数量
|
42
|
+
debouncedSetErrorLength(validErrorNodes.length);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
// 监听子节点的添加或删除
|
46
|
+
if (mutation.type === 'childList') {
|
47
|
+
// 检查删除的节点是否包含指定的类名
|
48
|
+
mutation.removedNodes.forEach(function (removedNode) {
|
49
|
+
if (removedNode instanceof HTMLElement && removedNode.classList.contains('ant-table-row')) {
|
50
|
+
// 更新错误数量
|
51
|
+
var _errorNodes = containerNode.querySelectorAll(".".concat(className));
|
52
|
+
if (errorLength === 0) {
|
53
|
+
debouncedSetErrorLength(0);
|
54
|
+
}
|
55
|
+
if (errorLength === _errorNodes.length) {
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
// 使用防抖后的方法更新错误数量
|
59
|
+
debouncedSetErrorLength(_errorNodes.length);
|
60
|
+
}
|
61
|
+
});
|
62
|
+
}
|
63
|
+
});
|
64
|
+
});
|
65
|
+
var config = {
|
66
|
+
attributes: true,
|
67
|
+
subtree: true,
|
68
|
+
attributeFilter: ['class'],
|
69
|
+
childList: true
|
70
|
+
};
|
71
|
+
// 启动 MutationObserver
|
72
|
+
observer.observe(containerNode.querySelector('tbody'), config);
|
73
|
+
// 清理 MutationObserver 和防抖定时器
|
74
|
+
return function () {
|
75
|
+
observer.disconnect();
|
76
|
+
debouncedSetErrorLength.cancel(); // 取消防抖定时器
|
77
|
+
};
|
78
|
+
}, [containerNode, className, isEnabled]); // 当 isEnabled 改变时会重新启动或取消监听
|
79
|
+
return [errorLength];
|
80
|
+
};
|
81
|
+
export default useEditTableError;
|
@@ -34,7 +34,7 @@ import viewSvg from '../../../../assets/view.svg';
|
|
34
34
|
import useRequestList from './hooks/useRequestList';
|
35
35
|
import locale from '../../../../locale';
|
36
36
|
var ProModalSelect = function ProModalSelect(props, ref) {
|
37
|
-
var _useRequest$options, _useRequest$
|
37
|
+
var _useRequest$options, _useRequest$options2, _useRequest$options2$, _useRequest$options3, _formColumns$;
|
38
38
|
var value = props.value,
|
39
39
|
onChange = props.onChange,
|
40
40
|
disabled = props.disabled,
|
@@ -107,7 +107,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
107
107
|
rowSelection = _ref4.rowSelection,
|
108
108
|
restTableProps = _objectWithoutProperties(_ref4, _excluded3);
|
109
109
|
var preValue = useRef(value);
|
110
|
-
var
|
110
|
+
var defaultParams = Array.isArray(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.defaultParams) ? useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : (_useRequest$options2$ = _useRequest$options2.defaultParams) === null || _useRequest$options2$ === void 0 ? void 0 : _useRequest$options2$[0] : (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options3 = useRequest.options) === null || _useRequest$options3 === void 0 ? void 0 : _useRequest$options3.defaultParams) || {};
|
111
|
+
var defaultParamsRef = useRef(defaultParams); // 缓存 defaultParams 的引用
|
111
112
|
var _useSetState = useSetState({
|
112
113
|
_value: value,
|
113
114
|
isInit: true,
|
@@ -317,7 +318,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
317
318
|
};
|
318
319
|
}();
|
319
320
|
var handleClose = function handleClose() {
|
320
|
-
var _useRequest$
|
321
|
+
var _useRequest$options4;
|
321
322
|
form.resetFields();
|
322
323
|
setState({
|
323
324
|
onOff: false,
|
@@ -325,7 +326,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
325
326
|
isInit: false
|
326
327
|
});
|
327
328
|
// 当设置manual为true时,清空当前弹框内已搜索出来的值
|
328
|
-
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
329
|
+
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.manual) {
|
329
330
|
mutate(function () {
|
330
331
|
return [];
|
331
332
|
});
|
@@ -472,7 +473,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
472
473
|
// 初始化回显,当传入initParams时,前端用来回险
|
473
474
|
var getInitValues = /*#__PURE__*/function () {
|
474
475
|
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
475
|
-
var _useRequest$
|
476
|
+
var _useRequest$options5, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
|
476
477
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
477
478
|
while (1) switch (_context4.prev = _context4.next) {
|
478
479
|
case 0:
|
@@ -480,11 +481,11 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
480
481
|
_context4.next = 9;
|
481
482
|
break;
|
482
483
|
}
|
483
|
-
queryBean = _objectSpread(_objectSpread({},
|
484
|
+
queryBean = _objectSpread(_objectSpread({}, defaultParams), initParams || {});
|
484
485
|
page = _objectSpread({
|
485
486
|
pageNum: 1,
|
486
487
|
pageSize: 10
|
487
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
488
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options5 = useRequest.options) === null || _useRequest$options5 === void 0 ? void 0 : _useRequest$options5.page);
|
488
489
|
params = withPagination ? _objectSpread(_objectSpread({}, page), {}, {
|
489
490
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
490
491
|
}) : queryBean;
|
@@ -533,12 +534,12 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
533
534
|
// 初始化回显,当传入initParams时,前端用来回险
|
534
535
|
var getDefaultOneValues = /*#__PURE__*/function () {
|
535
536
|
var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
536
|
-
var _useRequest$
|
537
|
+
var _useRequest$options6;
|
537
538
|
var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
|
538
539
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
539
540
|
while (1) switch (_context5.prev = _context5.next) {
|
540
541
|
case 0:
|
541
|
-
queryBean = _objectSpread({},
|
542
|
+
queryBean = _objectSpread({}, defaultParams);
|
542
543
|
page = _objectSpread({
|
543
544
|
pageNum: 1,
|
544
545
|
pageSize: 10
|
@@ -669,22 +670,20 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
669
670
|
if (useRequest) {
|
670
671
|
// 加定时器 修复依赖数据同步更新未取到问题
|
671
672
|
setTimeout(function () {
|
672
|
-
var _useRequest$options8, _useRequest$options9;
|
673
673
|
var params = withPagination ? {
|
674
674
|
pageNum: 1,
|
675
675
|
pageSize: 50,
|
676
|
-
queryBean: _objectSpread(_objectSpread({},
|
677
|
-
} : _objectSpread(_objectSpread({},
|
676
|
+
queryBean: _objectSpread(_objectSpread({}, defaultParams), initParams)
|
677
|
+
} : _objectSpread(_objectSpread({}, defaultParams), initParams);
|
678
678
|
var nextParams = transformParams ? transformParams(params) : params;
|
679
679
|
run(nextParams);
|
680
680
|
}, 300);
|
681
681
|
}
|
682
682
|
}
|
683
|
-
}, [JSON.stringify(value), visible, JSON.stringify(
|
683
|
+
}, [JSON.stringify(value), visible, JSON.stringify(defaultParams), JSON.stringify(initParams), options === null || options === void 0 ? void 0 : options.length]);
|
684
684
|
var handleSelectFocus = function handleSelectFocus() {
|
685
685
|
if (useRequest) {
|
686
|
-
var
|
687
|
-
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options11 = useRequest.options) === null || _useRequest$options11 === void 0 ? void 0 : _useRequest$options11.defaultParams) || {};
|
686
|
+
var queryBean = defaultParams || {};
|
688
687
|
var params = withPagination ? {
|
689
688
|
pageNum: 1,
|
690
689
|
pageSize: 50,
|
@@ -703,8 +702,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
703
702
|
};
|
704
703
|
var handleSelectSearch = debounce(function (val) {
|
705
704
|
if (useRequest) {
|
706
|
-
var
|
707
|
-
var queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options12 = useRequest.options) === null || _useRequest$options12 === void 0 ? void 0 : _useRequest$options12.defaultParams), {}, _defineProperty({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
|
705
|
+
var queryBean = _objectSpread(_objectSpread({}, defaultParams), {}, _defineProperty({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
|
708
706
|
var params = withPagination ? {
|
709
707
|
pageNum: 1,
|
710
708
|
pageSize: 50,
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.default = void 0;
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
11
12
|
var _react = require("react");
|
12
13
|
var _antd = require("antd");
|
14
|
+
var _useEditTableError3 = _interopRequireDefault(require("../../utils/useEditTableError"));
|
13
15
|
var _excluded = ["tableProps"];
|
14
16
|
var BaseTable = function BaseTable(_ref) {
|
15
17
|
var _value$;
|
@@ -33,8 +35,14 @@ var BaseTable = function BaseTable(_ref) {
|
|
33
35
|
page = tableProps.page,
|
34
36
|
formatMessage = tableProps.formatMessage,
|
35
37
|
locale = tableProps.locale,
|
36
|
-
handlePageChange = tableProps.handlePageChange
|
37
|
-
|
38
|
+
handlePageChange = tableProps.handlePageChange;
|
39
|
+
var _useEditTableError = (0, _useEditTableError3.default)({
|
40
|
+
containerNode: tableRef.current,
|
41
|
+
className: 'ant-form-item-explain-error',
|
42
|
+
isEnabled: pagination // 分页时启用
|
43
|
+
}),
|
44
|
+
_useEditTableError2 = (0, _slicedToArray2.default)(_useEditTableError, 1),
|
45
|
+
errorLength = _useEditTableError2[0];
|
38
46
|
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
39
47
|
children: [headerRender ? (0, _jsxRuntime.jsx)("div", {
|
40
48
|
className: "pro-edit-table-header",
|
@@ -55,10 +63,9 @@ var BaseTable = function BaseTable(_ref) {
|
|
55
63
|
};
|
56
64
|
}
|
57
65
|
}, resetProps), {}, {
|
58
|
-
pagination: pagination ? (0, _objectSpread2.default)({
|
59
|
-
|
60
|
-
|
61
|
-
showSizeChanger: false,
|
66
|
+
pagination: pagination ? (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
67
|
+
showSizeChanger: true,
|
68
|
+
pageSizeOptions: [5, 10, 20, 50],
|
62
69
|
showQuickJumper: true,
|
63
70
|
total: value === null || value === void 0 ? void 0 : value.length,
|
64
71
|
showTotal: function showTotal(total) {
|
@@ -69,15 +76,18 @@ var BaseTable = function BaseTable(_ref) {
|
|
69
76
|
});
|
70
77
|
},
|
71
78
|
itemRender: function itemRender(index, type, originalElement) {
|
72
|
-
return type === 'page' && page.pageNum === index &&
|
79
|
+
return type === 'page' && page.pageNum === index && errorLength ? (0, _jsxRuntime.jsxs)("div", {
|
73
80
|
className: "pro-edit-table-pagination-item-badge",
|
74
81
|
children: [(0, _jsxRuntime.jsx)(_antd.Badge, {
|
75
|
-
count:
|
82
|
+
count: errorLength
|
76
83
|
}), originalElement]
|
77
84
|
}) : originalElement;
|
78
85
|
},
|
79
86
|
onChange: handlePageChange
|
80
|
-
}, pagination)
|
87
|
+
}, pagination), {}, {
|
88
|
+
current: page.pageNum,
|
89
|
+
pageSize: page.pageSize
|
90
|
+
}) : false,
|
81
91
|
rowKey: "rowKey",
|
82
92
|
scroll: {
|
83
93
|
x: scroll === null || scroll === void 0 ? void 0 : scroll.x,
|
@@ -102,8 +102,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
102
102
|
page: {
|
103
103
|
pageNum: 1,
|
104
104
|
pageSize: (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || 10
|
105
|
-
}
|
106
|
-
pageErrorNum: 0
|
105
|
+
}
|
107
106
|
}),
|
108
107
|
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
109
108
|
state = _useSetState2[0],
|
@@ -114,8 +113,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
114
113
|
virtualKey = state.virtualKey,
|
115
114
|
selectedRowKeys = state.selectedRowKeys,
|
116
115
|
selectedRows = state.selectedRows,
|
117
|
-
page = state.page
|
118
|
-
pageErrorNum = state.pageErrorNum;
|
116
|
+
page = state.page;
|
119
117
|
var virtualRowName = (0, _tools.getNamePath)((0, _lodash.isArray)(name) ? name : [name], virtualKey);
|
120
118
|
// 样式处理
|
121
119
|
var _className = (0, _classnames.default)({
|
@@ -174,32 +172,44 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
174
172
|
case 0:
|
175
173
|
_context.prev = 0;
|
176
174
|
if (!pagination) {
|
175
|
+
_context.next = 8;
|
176
|
+
break;
|
177
|
+
}
|
178
|
+
if (!(pageSize !== page.pageSize)) {
|
177
179
|
_context.next = 5;
|
178
180
|
break;
|
179
181
|
}
|
180
|
-
|
182
|
+
setState({
|
183
|
+
page: {
|
184
|
+
pageNum: current,
|
185
|
+
pageSize: pageSize
|
186
|
+
}
|
187
|
+
});
|
188
|
+
return _context.abrupt("return");
|
189
|
+
case 5:
|
190
|
+
_context.next = 7;
|
181
191
|
return form.validateFields([name], {
|
182
192
|
recursive: true
|
183
193
|
});
|
184
|
-
case
|
194
|
+
case 7:
|
185
195
|
setState({
|
186
196
|
page: {
|
187
197
|
pageNum: current,
|
188
198
|
pageSize: pageSize !== null && pageSize !== void 0 ? pageSize : page.pageSize
|
189
199
|
}
|
190
200
|
});
|
191
|
-
case
|
192
|
-
_context.next =
|
201
|
+
case 8:
|
202
|
+
_context.next = 13;
|
193
203
|
break;
|
194
|
-
case
|
195
|
-
_context.prev =
|
204
|
+
case 10:
|
205
|
+
_context.prev = 10;
|
196
206
|
_context.t0 = _context["catch"](0);
|
197
207
|
(0, _tools.handleScrollToError)();
|
198
|
-
case
|
208
|
+
case 13:
|
199
209
|
case "end":
|
200
210
|
return _context.stop();
|
201
211
|
}
|
202
|
-
}, _callee, null, [[0,
|
212
|
+
}, _callee, null, [[0, 10]]);
|
203
213
|
}));
|
204
214
|
return function (_x, _x2) {
|
205
215
|
return _ref4.apply(this, arguments);
|
@@ -416,7 +426,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
416
426
|
page: page,
|
417
427
|
formatMessage: _locale.formatMessage,
|
418
428
|
locale: _locale.default,
|
419
|
-
pageErrorNum: pageErrorNum,
|
420
429
|
handlePageChange: handlePageChange
|
421
430
|
}
|
422
431
|
})), !isView && (value === null || value === void 0 ? void 0 : value.length) ? toolbarSticky ? (0, _jsxRuntime.jsx)(_antd.Affix, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
@@ -442,9 +451,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
442
451
|
columns: columns,
|
443
452
|
page: page,
|
444
453
|
pagination: pagination,
|
445
|
-
setState: setState,
|
446
454
|
isView: isView,
|
447
|
-
disabled: disabled
|
455
|
+
disabled: disabled,
|
456
|
+
setState: setState
|
448
457
|
});
|
449
458
|
}
|
450
459
|
}) : null]
|
@@ -38,14 +38,14 @@ export declare function cloneDeepFilterNode(value: any): any;
|
|
38
38
|
/**
|
39
39
|
* 分页校验
|
40
40
|
*/
|
41
|
-
export declare const onPageCheck: ({ form, name, value, columns, page, pagination,
|
41
|
+
export declare const onPageCheck: ({ form, name, value, columns, setState, page, pagination, isView, disabled }: {
|
42
42
|
form: any;
|
43
43
|
name: any;
|
44
44
|
value: any;
|
45
45
|
columns: any;
|
46
|
+
setState: any;
|
46
47
|
page: any;
|
47
48
|
pagination: any;
|
48
|
-
setState: any;
|
49
49
|
isView: any;
|
50
50
|
disabled: any;
|
51
51
|
}) => Promise<void>;
|
@@ -348,13 +348,13 @@ var handleCheckCellValue = /*#__PURE__*/function () {
|
|
348
348
|
*/
|
349
349
|
var onPageCheck = exports.onPageCheck = /*#__PURE__*/function () {
|
350
350
|
var _ref8 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(_ref7) {
|
351
|
-
var form, name, value, columns, page, pagination,
|
351
|
+
var form, name, value, columns, setState, page, pagination, isView, disabled, pageNum, pageSize, pageArr, flag, errorNum, errorPageNum, _i, _pageArr, item, start, end, nextValues, _iterator2, _step2, record, _iterator3, _step3, column, result, nextState;
|
352
352
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
353
353
|
while (1) switch (_context2.prev = _context2.next) {
|
354
354
|
case 0:
|
355
|
-
form = _ref7.form, name = _ref7.name, value = _ref7.value, columns = _ref7.columns,
|
355
|
+
form = _ref7.form, name = _ref7.name, value = _ref7.value, columns = _ref7.columns, setState = _ref7.setState, page = _ref7.page, pagination = _ref7.pagination, isView = _ref7.isView, disabled = _ref7.disabled;
|
356
356
|
if (!(pagination && !isView && !disabled)) {
|
357
|
-
_context2.next =
|
357
|
+
_context2.next = 72;
|
358
358
|
break;
|
359
359
|
}
|
360
360
|
pageNum = page.pageNum, pageSize = page.pageSize;
|
@@ -456,7 +456,7 @@ var onPageCheck = exports.onPageCheck = /*#__PURE__*/function () {
|
|
456
456
|
break;
|
457
457
|
case 60:
|
458
458
|
if (!(flag && errorNum > 0)) {
|
459
|
-
_context2.next =
|
459
|
+
_context2.next = 72;
|
460
460
|
break;
|
461
461
|
}
|
462
462
|
nextState = {
|
@@ -482,13 +482,6 @@ var onPageCheck = exports.onPageCheck = /*#__PURE__*/function () {
|
|
482
482
|
_context2.t3 = _context2["catch"](64);
|
483
483
|
handleScrollToError();
|
484
484
|
case 72:
|
485
|
-
_context2.next = 75;
|
486
|
-
break;
|
487
|
-
case 74:
|
488
|
-
setState({
|
489
|
-
pageErrorNum: 0
|
490
|
-
});
|
491
|
-
case 75:
|
492
485
|
case "end":
|
493
486
|
return _context2.stop();
|
494
487
|
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
interface UseEditTableErrorProps {
|
2
|
+
containerNode: HTMLElement | null;
|
3
|
+
className: string;
|
4
|
+
isEnabled: boolean;
|
5
|
+
}
|
6
|
+
declare const useEditTableError: ({ containerNode, className, isEnabled }: UseEditTableErrorProps) => [number];
|
7
|
+
export default useEditTableError;
|
@@ -0,0 +1,88 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.default = void 0;
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
|
+
var _react = require("react");
|
10
|
+
var _lodash = require("lodash");
|
11
|
+
var useEditTableError = function useEditTableError(_ref) {
|
12
|
+
var containerNode = _ref.containerNode,
|
13
|
+
className = _ref.className,
|
14
|
+
isEnabled = _ref.isEnabled;
|
15
|
+
var _useState = (0, _react.useState)(0),
|
16
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
17
|
+
errorLength = _useState2[0],
|
18
|
+
setErrorLength = _useState2[1];
|
19
|
+
(0, _react.useEffect)(function () {
|
20
|
+
// 如果 isEnabled 为 false 或容器节点不存在,直接跳过监听
|
21
|
+
if (!isEnabled || !containerNode) {
|
22
|
+
return; // 如果未启用监听或容器节点不存在,直接返回
|
23
|
+
}
|
24
|
+
// 防抖处理:将 setErrorLength 函数进行防抖
|
25
|
+
var debouncedSetErrorLength = (0, _lodash.debounce)(function (errorCount) {
|
26
|
+
setErrorLength(errorCount); // 更新错误数量
|
27
|
+
}, 300); // 300ms 后更新状态
|
28
|
+
var observer = new MutationObserver(function (mutations) {
|
29
|
+
mutations.forEach(function (mutation) {
|
30
|
+
// 只处理节点的 class 属性变化
|
31
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
32
|
+
var target = mutation.target;
|
33
|
+
// 检查目标节点是否包含指定的类
|
34
|
+
if (target.classList.contains(className)) {
|
35
|
+
// 查找所有包含 className 的节点
|
36
|
+
var errorNodes = containerNode.querySelectorAll(".".concat(className));
|
37
|
+
// debugger;
|
38
|
+
// 过滤这些节点,只保留那些类名完全为 `ant-form-item-explain-error` 的节点
|
39
|
+
var validErrorNodes = Array.from(errorNodes).filter(function (node) {
|
40
|
+
return node.classList.length === 1 && node.classList.contains('ant-form-item-explain-error');
|
41
|
+
});
|
42
|
+
if (errorLength === 0) {
|
43
|
+
debouncedSetErrorLength(0);
|
44
|
+
}
|
45
|
+
if (errorLength === validErrorNodes.length) {
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
// 使用防抖后的方法更新错误数量
|
49
|
+
debouncedSetErrorLength(validErrorNodes.length);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
// 监听子节点的添加或删除
|
53
|
+
if (mutation.type === 'childList') {
|
54
|
+
// 检查删除的节点是否包含指定的类名
|
55
|
+
mutation.removedNodes.forEach(function (removedNode) {
|
56
|
+
if (removedNode instanceof HTMLElement && removedNode.classList.contains('ant-table-row')) {
|
57
|
+
// 更新错误数量
|
58
|
+
var _errorNodes = containerNode.querySelectorAll(".".concat(className));
|
59
|
+
if (errorLength === 0) {
|
60
|
+
debouncedSetErrorLength(0);
|
61
|
+
}
|
62
|
+
if (errorLength === _errorNodes.length) {
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
// 使用防抖后的方法更新错误数量
|
66
|
+
debouncedSetErrorLength(_errorNodes.length);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
}
|
70
|
+
});
|
71
|
+
});
|
72
|
+
var config = {
|
73
|
+
attributes: true,
|
74
|
+
subtree: true,
|
75
|
+
attributeFilter: ['class'],
|
76
|
+
childList: true
|
77
|
+
};
|
78
|
+
// 启动 MutationObserver
|
79
|
+
observer.observe(containerNode.querySelector('tbody'), config);
|
80
|
+
// 清理 MutationObserver 和防抖定时器
|
81
|
+
return function () {
|
82
|
+
observer.disconnect();
|
83
|
+
debouncedSetErrorLength.cancel(); // 取消防抖定时器
|
84
|
+
};
|
85
|
+
}, [containerNode, className, isEnabled]); // 当 isEnabled 改变时会重新启动或取消监听
|
86
|
+
return [errorLength];
|
87
|
+
};
|
88
|
+
var _default = exports.default = useEditTableError;
|
@@ -29,7 +29,7 @@ var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames",
|
|
29
29
|
_excluded2 = ["onOk"],
|
30
30
|
_excluded3 = ["rowKey", "columns", "rowSelection"];
|
31
31
|
var ProModalSelect = function ProModalSelect(props, ref) {
|
32
|
-
var _useRequest$options, _useRequest$
|
32
|
+
var _useRequest$options, _useRequest$options2, _useRequest$options2$, _useRequest$options3, _formColumns$;
|
33
33
|
var value = props.value,
|
34
34
|
onChange = props.onChange,
|
35
35
|
disabled = props.disabled,
|
@@ -102,7 +102,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
102
102
|
rowSelection = _ref4.rowSelection,
|
103
103
|
restTableProps = (0, _objectWithoutProperties2.default)(_ref4, _excluded3);
|
104
104
|
var preValue = (0, _react.useRef)(value);
|
105
|
-
var
|
105
|
+
var defaultParams = Array.isArray(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.defaultParams) ? useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : (_useRequest$options2$ = _useRequest$options2.defaultParams) === null || _useRequest$options2$ === void 0 ? void 0 : _useRequest$options2$[0] : (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options3 = useRequest.options) === null || _useRequest$options3 === void 0 ? void 0 : _useRequest$options3.defaultParams) || {};
|
106
|
+
var defaultParamsRef = (0, _react.useRef)(defaultParams); // 缓存 defaultParams 的引用
|
106
107
|
var _useSetState = (0, _ahooks.useSetState)({
|
107
108
|
_value: value,
|
108
109
|
isInit: true,
|
@@ -312,7 +313,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
312
313
|
};
|
313
314
|
}();
|
314
315
|
var handleClose = function handleClose() {
|
315
|
-
var _useRequest$
|
316
|
+
var _useRequest$options4;
|
316
317
|
form.resetFields();
|
317
318
|
setState({
|
318
319
|
onOff: false,
|
@@ -320,7 +321,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
320
321
|
isInit: false
|
321
322
|
});
|
322
323
|
// 当设置manual为true时,清空当前弹框内已搜索出来的值
|
323
|
-
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
324
|
+
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.manual) {
|
324
325
|
mutate(function () {
|
325
326
|
return [];
|
326
327
|
});
|
@@ -467,7 +468,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
467
468
|
// 初始化回显,当传入initParams时,前端用来回险
|
468
469
|
var getInitValues = /*#__PURE__*/function () {
|
469
470
|
var _ref10 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {
|
470
|
-
var _useRequest$
|
471
|
+
var _useRequest$options5, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
|
471
472
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
|
472
473
|
while (1) switch (_context4.prev = _context4.next) {
|
473
474
|
case 0:
|
@@ -475,11 +476,11 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
475
476
|
_context4.next = 9;
|
476
477
|
break;
|
477
478
|
}
|
478
|
-
queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({},
|
479
|
+
queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, defaultParams), initParams || {});
|
479
480
|
page = (0, _objectSpread3.default)({
|
480
481
|
pageNum: 1,
|
481
482
|
pageSize: 10
|
482
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
483
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options5 = useRequest.options) === null || _useRequest$options5 === void 0 ? void 0 : _useRequest$options5.page);
|
483
484
|
params = withPagination ? (0, _objectSpread3.default)((0, _objectSpread3.default)({}, page), {}, {
|
484
485
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
485
486
|
}) : queryBean;
|
@@ -528,12 +529,12 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
528
529
|
// 初始化回显,当传入initParams时,前端用来回险
|
529
530
|
var getDefaultOneValues = /*#__PURE__*/function () {
|
530
531
|
var _ref11 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee5() {
|
531
|
-
var _useRequest$
|
532
|
+
var _useRequest$options6;
|
532
533
|
var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
|
533
534
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee5$(_context5) {
|
534
535
|
while (1) switch (_context5.prev = _context5.next) {
|
535
536
|
case 0:
|
536
|
-
queryBean = (0, _objectSpread3.default)({},
|
537
|
+
queryBean = (0, _objectSpread3.default)({}, defaultParams);
|
537
538
|
page = (0, _objectSpread3.default)({
|
538
539
|
pageNum: 1,
|
539
540
|
pageSize: 10
|
@@ -664,22 +665,20 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
664
665
|
if (useRequest) {
|
665
666
|
// 加定时器 修复依赖数据同步更新未取到问题
|
666
667
|
setTimeout(function () {
|
667
|
-
var _useRequest$options8, _useRequest$options9;
|
668
668
|
var params = withPagination ? {
|
669
669
|
pageNum: 1,
|
670
670
|
pageSize: 50,
|
671
|
-
queryBean: (0, _objectSpread3.default)((0, _objectSpread3.default)({},
|
672
|
-
} : (0, _objectSpread3.default)((0, _objectSpread3.default)({},
|
671
|
+
queryBean: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, defaultParams), initParams)
|
672
|
+
} : (0, _objectSpread3.default)((0, _objectSpread3.default)({}, defaultParams), initParams);
|
673
673
|
var nextParams = transformParams ? transformParams(params) : params;
|
674
674
|
run(nextParams);
|
675
675
|
}, 300);
|
676
676
|
}
|
677
677
|
}
|
678
|
-
}, [JSON.stringify(value), visible, JSON.stringify(
|
678
|
+
}, [JSON.stringify(value), visible, JSON.stringify(defaultParams), JSON.stringify(initParams), options === null || options === void 0 ? void 0 : options.length]);
|
679
679
|
var handleSelectFocus = function handleSelectFocus() {
|
680
680
|
if (useRequest) {
|
681
|
-
var
|
682
|
-
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options11 = useRequest.options) === null || _useRequest$options11 === void 0 ? void 0 : _useRequest$options11.defaultParams) || {};
|
681
|
+
var queryBean = defaultParams || {};
|
683
682
|
var params = withPagination ? {
|
684
683
|
pageNum: 1,
|
685
684
|
pageSize: 50,
|
@@ -698,8 +697,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
698
697
|
};
|
699
698
|
var handleSelectSearch = (0, _lodash.debounce)(function (val) {
|
700
699
|
if (useRequest) {
|
701
|
-
var
|
702
|
-
var queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options12 = useRequest.options) === null || _useRequest$options12 === void 0 ? void 0 : _useRequest$options12.defaultParams), {}, (0, _defineProperty2.default)({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
|
700
|
+
var queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, defaultParams), {}, (0, _defineProperty2.default)({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
|
703
701
|
var params = withPagination ? {
|
704
702
|
pageNum: 1,
|
705
703
|
pageSize: 50,
|