@zat-design/sisyphus-react 3.11.5 → 3.11.6-beta.1
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/ProDrawerForm/components/ProDrawer/index.js +28 -3
- package/es/ProEditTable/index.js +3 -1
- package/es/ProEditTable/utils/tools.d.ts +6 -1
- package/es/ProEditTable/utils/tools.js +6 -3
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +1 -4
- package/es/ProForm/components/combination/ProModalSelect/index.js +54 -46
- package/es/ProForm/components/combination/ProModalSelect.zip +0 -0
- package/es/ProStep/components/Item/index.js +6 -3
- package/es/ProTable/index.js +0 -3
- package/es/ProTable/utils/index.d.ts +2 -2
- package/es/ProTable/utils/index.js +1 -0
- package/es/ProUpload/components/ButtonRender.d.ts +1 -0
- package/es/ProUpload/components/ButtonRender.js +32 -2
- package/es/ProUpload/components/ImageRender.d.ts +1 -1
- package/es/ProUpload/index.js +1 -1
- package/lib/ProDrawerForm/components/ProDrawer/index.js +27 -2
- package/lib/ProEditTable/index.js +3 -1
- package/lib/ProEditTable/utils/tools.d.ts +6 -1
- package/lib/ProEditTable/utils/tools.js +6 -3
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +1 -4
- package/lib/ProForm/components/combination/ProModalSelect/index.js +54 -46
- package/lib/ProForm/components/combination/ProModalSelect.zip +0 -0
- package/lib/ProStep/components/Item/index.js +6 -3
- package/lib/ProTable/index.js +0 -3
- package/lib/ProTable/utils/index.d.ts +2 -2
- package/lib/ProTable/utils/index.js +1 -0
- package/lib/ProUpload/components/ButtonRender.d.ts +1 -0
- package/lib/ProUpload/components/ButtonRender.js +32 -2
- package/lib/ProUpload/components/ImageRender.d.ts +1 -1
- package/lib/ProUpload/index.js +1 -1
- package/package.json +1 -1
@@ -9,7 +9,7 @@ import _Modal from "antd/es/modal";
|
|
9
9
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
10
10
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
11
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
12
|
-
import React, { useCallback, useState, useRef } from 'react';
|
12
|
+
import React, { useCallback, useState, useRef, useEffect } from 'react';
|
13
13
|
import { useScroll } from 'ahooks';
|
14
14
|
import { isArray } from 'lodash';
|
15
15
|
import { ReactSVG } from 'react-svg';
|
@@ -46,13 +46,38 @@ var ProDrawer = function ProDrawer(_ref) {
|
|
46
46
|
_useState2 = _slicedToArray(_useState, 2),
|
47
47
|
loading = _useState2[0],
|
48
48
|
toggleLoading = _useState2[1];
|
49
|
+
var _useState3 = useState(''),
|
50
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
51
|
+
initialSnapshot = _useState4[0],
|
52
|
+
setInitialSnapshot = _useState4[1];
|
49
53
|
var noRenderFooter = isView || footer === false || footer === null;
|
54
|
+
// 使用 useEffect 在 visible 变更时延迟捕获 初始DOM 快照
|
55
|
+
useEffect(function () {
|
56
|
+
if (visible) {
|
57
|
+
// 延迟到下一个事件循环,确保 Drawer 已经渲染
|
58
|
+
var timeoutId = setTimeout(function () {
|
59
|
+
if (ref.current) {
|
60
|
+
setInitialSnapshot(ref.current.innerHTML); // 捕获 DOM 快照
|
61
|
+
}
|
62
|
+
}, 100); // 使用 setTimeout 让 DOM 渲染完成后再执行
|
63
|
+
return function () {
|
64
|
+
return clearTimeout(timeoutId);
|
65
|
+
}; // 清理定时器
|
66
|
+
}
|
67
|
+
setInitialSnapshot('');
|
68
|
+
}, [visible]); // 当 visible 变化时执行
|
69
|
+
// 快照对比
|
70
|
+
var compareSnapshots = function compareSnapshots() {
|
71
|
+
if (!ref.current) return false;
|
72
|
+
return ref.current.innerHTML === initialSnapshot;
|
73
|
+
};
|
50
74
|
var onConfirm = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
51
75
|
var _locale$ProDrawerForm, _locale$ProDrawerForm2, _locale$ProDrawerForm3, _locale$ProDrawerForm4;
|
52
76
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
53
77
|
while (1) switch (_context.prev = _context.next) {
|
54
78
|
case 0:
|
55
|
-
|
79
|
+
// 如果当前是查看状态,或者不需要确认关闭,或者快照对比一致,则直接关闭
|
80
|
+
if (isView || !isConfirmClose || compareSnapshots()) {
|
56
81
|
onCancel && onCancel();
|
57
82
|
} else if (!modalRef.current) {
|
58
83
|
modalRef.current = _Modal.confirm(_objectSpread({
|
@@ -74,7 +99,7 @@ var ProDrawer = function ProDrawer(_ref) {
|
|
74
99
|
return _context.stop();
|
75
100
|
}
|
76
101
|
}, _callee);
|
77
|
-
})), [onCancel, modalRef.current]);
|
102
|
+
})), [onCancel, modalRef.current, ref.current]);
|
78
103
|
var handleFinish = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
79
104
|
var values, _error$errorFields, _error$errorFields$;
|
80
105
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
package/es/ProEditTable/index.js
CHANGED
@@ -35,7 +35,10 @@ export declare const handleScrollToError: () => void;
|
|
35
35
|
* @returns 深拷贝后的对象,其中的React节点会被保留
|
36
36
|
*/
|
37
37
|
export declare function cloneDeepFilterNode(value: any): any;
|
38
|
-
|
38
|
+
/**
|
39
|
+
* 分页校验
|
40
|
+
*/
|
41
|
+
export declare const onPageCheck: ({ form, name, value, columns, page, pagination, setState, isView, disabled }: {
|
39
42
|
form: any;
|
40
43
|
name: any;
|
41
44
|
value: any;
|
@@ -43,4 +46,6 @@ export declare const onPageCheck: ({ form, name, value, columns, page, paginatio
|
|
43
46
|
page: any;
|
44
47
|
pagination: any;
|
45
48
|
setState: any;
|
49
|
+
isView: any;
|
50
|
+
disabled: any;
|
46
51
|
}) => Promise<void>;
|
@@ -334,14 +334,17 @@ var handleCheckCellValue = /*#__PURE__*/function () {
|
|
334
334
|
return _ref6.apply(this, arguments);
|
335
335
|
};
|
336
336
|
}();
|
337
|
+
/**
|
338
|
+
* 分页校验
|
339
|
+
*/
|
337
340
|
export var onPageCheck = /*#__PURE__*/function () {
|
338
341
|
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref7) {
|
339
|
-
var form, name, value, columns, page, pagination, setState, pageNum, pageSize, pageArr, flag, errorNum, errorPageNum, _i, _pageArr, item, start, end, nextValues, _iterator2, _step2, record, _iterator3, _step3, column, result, nextState;
|
342
|
+
var form, name, value, columns, page, pagination, setState, isView, disabled, pageNum, pageSize, pageArr, flag, errorNum, errorPageNum, _i, _pageArr, item, start, end, nextValues, _iterator2, _step2, record, _iterator3, _step3, column, result, nextState;
|
340
343
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
341
344
|
while (1) switch (_context2.prev = _context2.next) {
|
342
345
|
case 0:
|
343
|
-
form = _ref7.form, name = _ref7.name, value = _ref7.value, columns = _ref7.columns, page = _ref7.page, pagination = _ref7.pagination, setState = _ref7.setState;
|
344
|
-
if (!pagination) {
|
346
|
+
form = _ref7.form, name = _ref7.name, value = _ref7.value, columns = _ref7.columns, page = _ref7.page, pagination = _ref7.pagination, setState = _ref7.setState, isView = _ref7.isView, disabled = _ref7.disabled;
|
347
|
+
if (!(pagination && !isView && !disabled)) {
|
345
348
|
_context2.next = 75;
|
346
349
|
break;
|
347
350
|
}
|
@@ -104,11 +104,8 @@ export function useRequestList(service, options, useRequestOptions) {
|
|
104
104
|
var dataSource = useMemo(function () {
|
105
105
|
if (data) {
|
106
106
|
var _data$data;
|
107
|
-
if (transformResponse) {
|
108
|
-
return (data === null || data === void 0 ? void 0 : data.data) ? transformResponse(data === null || data === void 0 ? void 0 : data.data) : transformResponse(data);
|
109
|
-
}
|
110
107
|
var list = withPagination ? data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.list : data === null || data === void 0 ? void 0 : data.data;
|
111
|
-
return list !== null && list !== void 0 ? list : [];
|
108
|
+
return transformResponse ? transformResponse(list) : list !== null && list !== void 0 ? list : [];
|
112
109
|
}
|
113
110
|
return [];
|
114
111
|
}, [data, transformResponse, withPagination]);
|
@@ -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$
|
37
|
+
var _useRequest$options, _useRequest$options10, _formColumns$;
|
38
38
|
var value = props.value,
|
39
39
|
onChange = props.onChange,
|
40
40
|
disabled = props.disabled,
|
@@ -74,6 +74,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
74
74
|
withPagination = _configOption$withPag === void 0 ? true : _configOption$withPag,
|
75
75
|
modalProps = configOption.modalProps,
|
76
76
|
tableProps = configOption.tableProps;
|
77
|
+
// const useRequest?.options?.defaultParams;
|
77
78
|
var _ref = modalProps || {},
|
78
79
|
onOk = _ref.onOk,
|
79
80
|
restModalProps = _objectWithoutProperties(_ref, _excluded2);
|
@@ -107,6 +108,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
107
108
|
rowSelection = _ref4.rowSelection,
|
108
109
|
restTableProps = _objectWithoutProperties(_ref4, _excluded3);
|
109
110
|
var preValue = useRef(value);
|
111
|
+
var defaultParamsRef = useRef(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.defaultParams); // 缓存 defaultParams 的引用
|
110
112
|
var _useSetState = useSetState({
|
111
113
|
_value: value,
|
112
114
|
isInit: true,
|
@@ -316,7 +318,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
316
318
|
};
|
317
319
|
}();
|
318
320
|
var handleClose = function handleClose() {
|
319
|
-
var _useRequest$
|
321
|
+
var _useRequest$options2;
|
320
322
|
form.resetFields();
|
321
323
|
setState({
|
322
324
|
onOff: false,
|
@@ -324,7 +326,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
324
326
|
isInit: false
|
325
327
|
});
|
326
328
|
// 当设置manual为true时,清空当前弹框内已搜索出来的值
|
327
|
-
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
329
|
+
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.manual) {
|
328
330
|
mutate(function () {
|
329
331
|
return [];
|
330
332
|
});
|
@@ -471,7 +473,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
471
473
|
// 初始化回显,当传入initParams时,前端用来回险
|
472
474
|
var getInitValues = /*#__PURE__*/function () {
|
473
475
|
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
474
|
-
var _useRequest$
|
476
|
+
var _useRequest$options3, _useRequest$options4, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
|
475
477
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
476
478
|
while (1) switch (_context4.prev = _context4.next) {
|
477
479
|
case 0:
|
@@ -479,11 +481,11 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
479
481
|
_context4.next = 9;
|
480
482
|
break;
|
481
483
|
}
|
482
|
-
queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
484
|
+
queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options3 = useRequest.options) === null || _useRequest$options3 === void 0 ? void 0 : _useRequest$options3.defaultParams), initParams || {});
|
483
485
|
page = _objectSpread({
|
484
486
|
pageNum: 1,
|
485
487
|
pageSize: 10
|
486
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
488
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.page);
|
487
489
|
params = withPagination ? _objectSpread(_objectSpread({}, page), {}, {
|
488
490
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
489
491
|
}) : queryBean;
|
@@ -532,16 +534,16 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
532
534
|
// 初始化回显,当传入initParams时,前端用来回险
|
533
535
|
var getDefaultOneValues = /*#__PURE__*/function () {
|
534
536
|
var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
535
|
-
var _useRequest$
|
537
|
+
var _useRequest$options5, _useRequest$options6;
|
536
538
|
var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
|
537
539
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
538
540
|
while (1) switch (_context5.prev = _context5.next) {
|
539
541
|
case 0:
|
540
|
-
queryBean = _objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
542
|
+
queryBean = _objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options5 = useRequest.options) === null || _useRequest$options5 === void 0 ? void 0 : _useRequest$options5.defaultParams);
|
541
543
|
page = _objectSpread({
|
542
544
|
pageNum: 1,
|
543
545
|
pageSize: 10
|
544
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
546
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.page);
|
545
547
|
params = withPagination ? _objectSpread(_objectSpread({}, page), {}, {
|
546
548
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
547
549
|
}) : queryBean;
|
@@ -616,8 +618,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
616
618
|
});
|
617
619
|
useEffect(function () {
|
618
620
|
if (onOff && !visible) {
|
619
|
-
var _useRequest$
|
620
|
-
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
621
|
+
var _useRequest$options7;
|
622
|
+
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.manual) !== true) {
|
621
623
|
onReset();
|
622
624
|
}
|
623
625
|
var nextState = {
|
@@ -650,13 +652,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
650
652
|
setState(nextState);
|
651
653
|
}
|
652
654
|
}, [onOff, visible, JSON.stringify(value)]);
|
653
|
-
|
655
|
+
useEffect(function () {
|
654
656
|
if (value && !visible && isInit && !readOnly) {
|
655
657
|
getInitValues();
|
656
658
|
}
|
657
659
|
}, [JSON.stringify(value), visible, isInit]);
|
658
660
|
useDebounceEffect(function () {
|
659
|
-
if (value && !visible && readOnly && !isEqual(value, preValue.current)) {
|
661
|
+
if (value && !visible && readOnly && (!isEqual(value, preValue.current) || (options === null || options === void 0 ? void 0 : options.length) === 0)) {
|
660
662
|
var _options$some;
|
661
663
|
preValue.current = value;
|
662
664
|
var isHasValue = options === null || options === void 0 ? void 0 : (_options$some = options.some) === null || _options$some === void 0 ? void 0 : _options$some.call(options, function (item) {
|
@@ -668,18 +670,51 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
668
670
|
if (useRequest) {
|
669
671
|
// 加定时器 修复依赖数据同步更新未取到问题
|
670
672
|
setTimeout(function () {
|
671
|
-
var _useRequest$
|
673
|
+
var _useRequest$options8, _useRequest$options9;
|
672
674
|
var params = withPagination ? {
|
673
675
|
pageNum: 1,
|
674
676
|
pageSize: 50,
|
675
|
-
queryBean: _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
676
|
-
} : _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
677
|
+
queryBean: _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams)
|
678
|
+
} : _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams), initParams);
|
677
679
|
var nextParams = transformParams ? transformParams(params) : params;
|
678
680
|
run(nextParams);
|
679
681
|
}, 300);
|
680
682
|
}
|
681
683
|
}
|
682
|
-
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
684
|
+
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options10 = useRequest.options) === null || _useRequest$options10 === void 0 ? void 0 : _useRequest$options10.defaultParams), JSON.stringify(initParams), options === null || options === void 0 ? void 0 : options.length]);
|
685
|
+
var handleSelectFocus = function handleSelectFocus() {
|
686
|
+
if (useRequest) {
|
687
|
+
var _useRequest$options11;
|
688
|
+
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options11 = useRequest.options) === null || _useRequest$options11 === void 0 ? void 0 : _useRequest$options11.defaultParams) || {};
|
689
|
+
var params = withPagination ? {
|
690
|
+
pageNum: 1,
|
691
|
+
pageSize: 50,
|
692
|
+
queryBean: queryBean
|
693
|
+
} : queryBean;
|
694
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
695
|
+
// 减少请求条件一致时,且请求过时,focus的重复请求
|
696
|
+
if (!isEqual(queryBean, defaultParamsRef.current) || !(options === null || options === void 0 ? void 0 : options.length)) {
|
697
|
+
run(nextParams); // 触发 run 请求
|
698
|
+
defaultParamsRef.current = queryBean; // 更新缓存
|
699
|
+
}
|
700
|
+
setState({
|
701
|
+
isInit: false
|
702
|
+
});
|
703
|
+
}
|
704
|
+
};
|
705
|
+
var handleSelectSearch = debounce(function (val) {
|
706
|
+
if (useRequest) {
|
707
|
+
var _useRequest$options12;
|
708
|
+
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));
|
709
|
+
var params = withPagination ? {
|
710
|
+
pageNum: 1,
|
711
|
+
pageSize: 50,
|
712
|
+
queryBean: queryBean
|
713
|
+
} : queryBean;
|
714
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
715
|
+
run(nextParams);
|
716
|
+
}
|
717
|
+
}, 1000);
|
683
718
|
useDebounceEffect(function () {
|
684
719
|
if (!value) {
|
685
720
|
if (defaultOne) {
|
@@ -729,35 +764,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
729
764
|
notFoundContent: selectLoading ? _jsx(_Spin, {
|
730
765
|
size: "small"
|
731
766
|
}) : null,
|
732
|
-
onFocus:
|
733
|
-
|
734
|
-
var _useRequest$options10;
|
735
|
-
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options10 = useRequest.options) === null || _useRequest$options10 === void 0 ? void 0 : _useRequest$options10.defaultParams) || {};
|
736
|
-
var params = withPagination ? {
|
737
|
-
pageNum: 1,
|
738
|
-
pageSize: 50,
|
739
|
-
queryBean: queryBean
|
740
|
-
} : queryBean;
|
741
|
-
var nextParams = transformParams ? transformParams(params) : params;
|
742
|
-
run(nextParams);
|
743
|
-
setState({
|
744
|
-
isInit: false
|
745
|
-
});
|
746
|
-
}
|
747
|
-
},
|
748
|
-
onSearch: debounce(function (val) {
|
749
|
-
if (useRequest) {
|
750
|
-
var _useRequest$options11;
|
751
|
-
var queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options11 = useRequest.options) === null || _useRequest$options11 === void 0 ? void 0 : _useRequest$options11.defaultParams), {}, _defineProperty({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
|
752
|
-
var params = withPagination ? {
|
753
|
-
pageNum: 1,
|
754
|
-
pageSize: 50,
|
755
|
-
queryBean: queryBean
|
756
|
-
} : queryBean;
|
757
|
-
var nextParams = transformParams ? transformParams(params) : params;
|
758
|
-
run(nextParams);
|
759
|
-
}
|
760
|
-
}, 2000),
|
767
|
+
onFocus: handleSelectFocus,
|
768
|
+
onSearch: handleSelectSearch,
|
761
769
|
style: {
|
762
770
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
763
771
|
}
|
Binary file
|
@@ -8,7 +8,7 @@ import { isBoolean } from 'lodash';
|
|
8
8
|
import { useStep } from '../../index';
|
9
9
|
import ProCollapse from '../../../ProLayout/components/ProCollapse';
|
10
10
|
var defaultLazyLoadConfig = {
|
11
|
-
height:
|
11
|
+
height: 200,
|
12
12
|
offset: 100,
|
13
13
|
once: true // Load only once upon first entry into the viewport
|
14
14
|
};
|
@@ -24,7 +24,7 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
24
24
|
register = _useStep.register,
|
25
25
|
collapse = _useStep.collapse,
|
26
26
|
globalLazyLoad = _useStep.lazyLoad;
|
27
|
-
var lazyLoad = stepLazyLoad
|
27
|
+
var lazyLoad = stepLazyLoad !== null && stepLazyLoad !== void 0 ? stepLazyLoad : globalLazyLoad;
|
28
28
|
useEffect(function () {
|
29
29
|
// Schedule registration to avoid re-render issues
|
30
30
|
var timeoutId = setTimeout(function () {
|
@@ -60,7 +60,10 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
60
60
|
onChange: function onChange(e) {
|
61
61
|
var _restProps$onChange;
|
62
62
|
if (lazyLoad) {
|
63
|
-
|
63
|
+
// 延时执行, 避免在折叠时, 懒加载的元素没有高度
|
64
|
+
setTimeout(function () {
|
65
|
+
forceCheck();
|
66
|
+
}, 100);
|
64
67
|
}
|
65
68
|
// 默认执行
|
66
69
|
restProps === null || restProps === void 0 ? void 0 : (_restProps$onChange = restProps.onChange) === null || _restProps$onChange === void 0 ? void 0 : _restProps$onChange.call(restProps, e);
|
package/es/ProTable/index.js
CHANGED
@@ -250,9 +250,6 @@ var ProTable = function ProTable(props) {
|
|
250
250
|
if (isExistPercentWidth) {
|
251
251
|
_scroll = props === null || props === void 0 ? void 0 : props.scroll;
|
252
252
|
}
|
253
|
-
if (props.expandable) {
|
254
|
-
_scroll = {};
|
255
|
-
}
|
256
253
|
var handleColumnConfig = /*#__PURE__*/function () {
|
257
254
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(checkList) {
|
258
255
|
var newColumns, _columnConfig$onColum, catchColumns;
|
@@ -30,8 +30,8 @@ export declare const isListResult: (data: {
|
|
30
30
|
}) => boolean;
|
31
31
|
export declare const getRowKey: (rowKey: any, record: any) => any;
|
32
32
|
/** 移除对象中的 null , undefined, '' 的key */
|
33
|
-
export declare const removeEmptyKeys: (obj
|
34
|
-
[k: string]:
|
33
|
+
export declare const removeEmptyKeys: (obj?: Record<string, any>) => {
|
34
|
+
[k: string]: any;
|
35
35
|
};
|
36
36
|
export declare const getPadding: (el: HTMLElement) => {
|
37
37
|
pLeft: number;
|
@@ -75,6 +75,7 @@ export var getRowKey = function getRowKey(rowKey, record) {
|
|
75
75
|
};
|
76
76
|
/** 移除对象中的 null , undefined, '' 的key */
|
77
77
|
export var removeEmptyKeys = function removeEmptyKeys(obj) {
|
78
|
+
if (!obj) return {};
|
78
79
|
// 使用 Object.entries() 将对象转换为键值对数组
|
79
80
|
var entries = Object.entries(obj);
|
80
81
|
// 过滤掉值为 null, undefined, 或 '' 的键值对
|
@@ -14,6 +14,7 @@ interface DragRenderProps extends Pick<ProUploadProps, 'buttonProps' | 'disabled
|
|
14
14
|
afterRender: string | ReactNode;
|
15
15
|
extExt: any[];
|
16
16
|
isConfirmDelete?: boolean;
|
17
|
+
onRemove?: (file: UploadFile) => any | Promise<any>;
|
17
18
|
}
|
18
19
|
declare const ButtonRender: FC<DragRenderProps>;
|
19
20
|
export default ButtonRender;
|
@@ -2,6 +2,8 @@ import "antd/es/button/style";
|
|
2
2
|
import _Button from "antd/es/button";
|
3
3
|
import "antd/es/upload/style";
|
4
4
|
import _Upload from "antd/es/upload";
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
6
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
5
7
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
6
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
7
9
|
import { DndContext } from '@dnd-kit/core';
|
@@ -26,7 +28,8 @@ var ButtonRender = function ButtonRender(props) {
|
|
26
28
|
afterRender = props.afterRender,
|
27
29
|
_props$buttonText = props.buttonText,
|
28
30
|
buttonText = _props$buttonText === void 0 ? locale === null || locale === void 0 ? void 0 : (_locale$ProUpload = locale.ProUpload) === null || _locale$ProUpload === void 0 ? void 0 : _locale$ProUpload.buttonText : _props$buttonText,
|
29
|
-
isConfirmDelete = props.isConfirmDelete
|
31
|
+
isConfirmDelete = props.isConfirmDelete,
|
32
|
+
_onRemove = props.onRemove;
|
30
33
|
// 按钮类型的props
|
31
34
|
var buttonUploadProps = _objectSpread(_objectSpread({}, baseUploadProps), {}, {
|
32
35
|
fileList: fileList,
|
@@ -38,7 +41,34 @@ var ButtonRender = function ButtonRender(props) {
|
|
38
41
|
file: file,
|
39
42
|
isConfirmDelete: isConfirmDelete,
|
40
43
|
onPreview: onPreview,
|
41
|
-
onRemove:
|
44
|
+
onRemove: function () {
|
45
|
+
var _onRemove2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
|
46
|
+
var res;
|
47
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
48
|
+
while (1) switch (_context.prev = _context.next) {
|
49
|
+
case 0:
|
50
|
+
_context.next = 2;
|
51
|
+
return _onRemove === null || _onRemove === void 0 ? void 0 : _onRemove(file);
|
52
|
+
case 2:
|
53
|
+
res = _context.sent;
|
54
|
+
if (!(res === false)) {
|
55
|
+
_context.next = 5;
|
56
|
+
break;
|
57
|
+
}
|
58
|
+
return _context.abrupt("return");
|
59
|
+
case 5:
|
60
|
+
actions.remove(file);
|
61
|
+
case 6:
|
62
|
+
case "end":
|
63
|
+
return _context.stop();
|
64
|
+
}
|
65
|
+
}, _callee);
|
66
|
+
}));
|
67
|
+
function onRemove(_x) {
|
68
|
+
return _onRemove2.apply(this, arguments);
|
69
|
+
}
|
70
|
+
return onRemove;
|
71
|
+
}(),
|
42
72
|
onDownload: onDownload
|
43
73
|
})
|
44
74
|
});
|
@@ -13,7 +13,7 @@ interface DragRenderProps extends Pick<ProUploadProps, 'buttonProps' | 'disabled
|
|
13
13
|
onPreview: any;
|
14
14
|
onDownload: any;
|
15
15
|
extExt: any[];
|
16
|
-
onRemove: (file: UploadFile) =>
|
16
|
+
onRemove: (file: UploadFile) => any | Promise<any>;
|
17
17
|
}
|
18
18
|
declare const ImageRender: FC<DragRenderProps>;
|
19
19
|
export default ImageRender;
|
package/es/ProUpload/index.js
CHANGED
@@ -265,7 +265,7 @@ var ProUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
265
265
|
onDragEnd: onDragEnd,
|
266
266
|
onPreview: onPreview,
|
267
267
|
onDownload: onDownload,
|
268
|
-
onRemove:
|
268
|
+
onRemove: onRemove,
|
269
269
|
onChange: onChange,
|
270
270
|
setFileList: setFileList,
|
271
271
|
extExt: extExt,
|
@@ -49,13 +49,38 @@ var ProDrawer = function ProDrawer(_ref) {
|
|
49
49
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
50
50
|
loading = _useState2[0],
|
51
51
|
toggleLoading = _useState2[1];
|
52
|
+
var _useState3 = (0, _react.useState)(''),
|
53
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
54
|
+
initialSnapshot = _useState4[0],
|
55
|
+
setInitialSnapshot = _useState4[1];
|
52
56
|
var noRenderFooter = isView || footer === false || footer === null;
|
57
|
+
// 使用 useEffect 在 visible 变更时延迟捕获 初始DOM 快照
|
58
|
+
(0, _react.useEffect)(function () {
|
59
|
+
if (visible) {
|
60
|
+
// 延迟到下一个事件循环,确保 Drawer 已经渲染
|
61
|
+
var timeoutId = setTimeout(function () {
|
62
|
+
if (ref.current) {
|
63
|
+
setInitialSnapshot(ref.current.innerHTML); // 捕获 DOM 快照
|
64
|
+
}
|
65
|
+
}, 100); // 使用 setTimeout 让 DOM 渲染完成后再执行
|
66
|
+
return function () {
|
67
|
+
return clearTimeout(timeoutId);
|
68
|
+
}; // 清理定时器
|
69
|
+
}
|
70
|
+
setInitialSnapshot('');
|
71
|
+
}, [visible]); // 当 visible 变化时执行
|
72
|
+
// 快照对比
|
73
|
+
var compareSnapshots = function compareSnapshots() {
|
74
|
+
if (!ref.current) return false;
|
75
|
+
return ref.current.innerHTML === initialSnapshot;
|
76
|
+
};
|
53
77
|
var onConfirm = (0, _react.useCallback)(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
54
78
|
var _locale$ProDrawerForm, _locale$ProDrawerForm2, _locale$ProDrawerForm3, _locale$ProDrawerForm4;
|
55
79
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
56
80
|
while (1) switch (_context.prev = _context.next) {
|
57
81
|
case 0:
|
58
|
-
|
82
|
+
// 如果当前是查看状态,或者不需要确认关闭,或者快照对比一致,则直接关闭
|
83
|
+
if (isView || !isConfirmClose || compareSnapshots()) {
|
59
84
|
onCancel && onCancel();
|
60
85
|
} else if (!modalRef.current) {
|
61
86
|
modalRef.current = _antd.Modal.confirm((0, _objectSpread2.default)({
|
@@ -77,7 +102,7 @@ var ProDrawer = function ProDrawer(_ref) {
|
|
77
102
|
return _context.stop();
|
78
103
|
}
|
79
104
|
}, _callee);
|
80
|
-
})), [onCancel, modalRef.current]);
|
105
|
+
})), [onCancel, modalRef.current, ref.current]);
|
81
106
|
var handleFinish = (0, _react.useCallback)(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
82
107
|
var values, _error$errorFields, _error$errorFields$;
|
83
108
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
@@ -35,7 +35,10 @@ export declare const handleScrollToError: () => void;
|
|
35
35
|
* @returns 深拷贝后的对象,其中的React节点会被保留
|
36
36
|
*/
|
37
37
|
export declare function cloneDeepFilterNode(value: any): any;
|
38
|
-
|
38
|
+
/**
|
39
|
+
* 分页校验
|
40
|
+
*/
|
41
|
+
export declare const onPageCheck: ({ form, name, value, columns, page, pagination, setState, isView, disabled }: {
|
39
42
|
form: any;
|
40
43
|
name: any;
|
41
44
|
value: any;
|
@@ -43,4 +46,6 @@ export declare const onPageCheck: ({ form, name, value, columns, page, paginatio
|
|
43
46
|
page: any;
|
44
47
|
pagination: any;
|
45
48
|
setState: any;
|
49
|
+
isView: any;
|
50
|
+
disabled: any;
|
46
51
|
}) => Promise<void>;
|
@@ -343,14 +343,17 @@ var handleCheckCellValue = /*#__PURE__*/function () {
|
|
343
343
|
return _ref6.apply(this, arguments);
|
344
344
|
};
|
345
345
|
}();
|
346
|
+
/**
|
347
|
+
* 分页校验
|
348
|
+
*/
|
346
349
|
var onPageCheck = exports.onPageCheck = /*#__PURE__*/function () {
|
347
350
|
var _ref8 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(_ref7) {
|
348
|
-
var form, name, value, columns, page, pagination, setState, pageNum, pageSize, pageArr, flag, errorNum, errorPageNum, _i, _pageArr, item, start, end, nextValues, _iterator2, _step2, record, _iterator3, _step3, column, result, nextState;
|
351
|
+
var form, name, value, columns, page, pagination, setState, isView, disabled, pageNum, pageSize, pageArr, flag, errorNum, errorPageNum, _i, _pageArr, item, start, end, nextValues, _iterator2, _step2, record, _iterator3, _step3, column, result, nextState;
|
349
352
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
350
353
|
while (1) switch (_context2.prev = _context2.next) {
|
351
354
|
case 0:
|
352
|
-
form = _ref7.form, name = _ref7.name, value = _ref7.value, columns = _ref7.columns, page = _ref7.page, pagination = _ref7.pagination, setState = _ref7.setState;
|
353
|
-
if (!pagination) {
|
355
|
+
form = _ref7.form, name = _ref7.name, value = _ref7.value, columns = _ref7.columns, page = _ref7.page, pagination = _ref7.pagination, setState = _ref7.setState, isView = _ref7.isView, disabled = _ref7.disabled;
|
356
|
+
if (!(pagination && !isView && !disabled)) {
|
354
357
|
_context2.next = 75;
|
355
358
|
break;
|
356
359
|
}
|
@@ -113,11 +113,8 @@ function useRequestList(service, options, useRequestOptions) {
|
|
113
113
|
var dataSource = (0, _react.useMemo)(function () {
|
114
114
|
if (data) {
|
115
115
|
var _data$data;
|
116
|
-
if (transformResponse) {
|
117
|
-
return (data === null || data === void 0 ? void 0 : data.data) ? transformResponse(data === null || data === void 0 ? void 0 : data.data) : transformResponse(data);
|
118
|
-
}
|
119
116
|
var list = withPagination ? data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.list : data === null || data === void 0 ? void 0 : data.data;
|
120
|
-
return list !== null && list !== void 0 ? list : [];
|
117
|
+
return transformResponse ? transformResponse(list) : list !== null && list !== void 0 ? list : [];
|
121
118
|
}
|
122
119
|
return [];
|
123
120
|
}, [data, transformResponse, withPagination]);
|
@@ -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$
|
32
|
+
var _useRequest$options, _useRequest$options10, _formColumns$;
|
33
33
|
var value = props.value,
|
34
34
|
onChange = props.onChange,
|
35
35
|
disabled = props.disabled,
|
@@ -69,6 +69,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
69
69
|
withPagination = _configOption$withPag === void 0 ? true : _configOption$withPag,
|
70
70
|
modalProps = configOption.modalProps,
|
71
71
|
tableProps = configOption.tableProps;
|
72
|
+
// const useRequest?.options?.defaultParams;
|
72
73
|
var _ref = modalProps || {},
|
73
74
|
onOk = _ref.onOk,
|
74
75
|
restModalProps = (0, _objectWithoutProperties2.default)(_ref, _excluded2);
|
@@ -102,6 +103,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
102
103
|
rowSelection = _ref4.rowSelection,
|
103
104
|
restTableProps = (0, _objectWithoutProperties2.default)(_ref4, _excluded3);
|
104
105
|
var preValue = (0, _react.useRef)(value);
|
106
|
+
var defaultParamsRef = (0, _react.useRef)(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.defaultParams); // 缓存 defaultParams 的引用
|
105
107
|
var _useSetState = (0, _ahooks.useSetState)({
|
106
108
|
_value: value,
|
107
109
|
isInit: true,
|
@@ -311,7 +313,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
311
313
|
};
|
312
314
|
}();
|
313
315
|
var handleClose = function handleClose() {
|
314
|
-
var _useRequest$
|
316
|
+
var _useRequest$options2;
|
315
317
|
form.resetFields();
|
316
318
|
setState({
|
317
319
|
onOff: false,
|
@@ -319,7 +321,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
319
321
|
isInit: false
|
320
322
|
});
|
321
323
|
// 当设置manual为true时,清空当前弹框内已搜索出来的值
|
322
|
-
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
324
|
+
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.manual) {
|
323
325
|
mutate(function () {
|
324
326
|
return [];
|
325
327
|
});
|
@@ -466,7 +468,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
466
468
|
// 初始化回显,当传入initParams时,前端用来回险
|
467
469
|
var getInitValues = /*#__PURE__*/function () {
|
468
470
|
var _ref10 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {
|
469
|
-
var _useRequest$
|
471
|
+
var _useRequest$options3, _useRequest$options4, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
|
470
472
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
|
471
473
|
while (1) switch (_context4.prev = _context4.next) {
|
472
474
|
case 0:
|
@@ -474,11 +476,11 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
474
476
|
_context4.next = 9;
|
475
477
|
break;
|
476
478
|
}
|
477
|
-
queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
479
|
+
queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options3 = useRequest.options) === null || _useRequest$options3 === void 0 ? void 0 : _useRequest$options3.defaultParams), initParams || {});
|
478
480
|
page = (0, _objectSpread3.default)({
|
479
481
|
pageNum: 1,
|
480
482
|
pageSize: 10
|
481
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
483
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.page);
|
482
484
|
params = withPagination ? (0, _objectSpread3.default)((0, _objectSpread3.default)({}, page), {}, {
|
483
485
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
484
486
|
}) : queryBean;
|
@@ -527,16 +529,16 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
527
529
|
// 初始化回显,当传入initParams时,前端用来回险
|
528
530
|
var getDefaultOneValues = /*#__PURE__*/function () {
|
529
531
|
var _ref11 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee5() {
|
530
|
-
var _useRequest$
|
532
|
+
var _useRequest$options5, _useRequest$options6;
|
531
533
|
var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
|
532
534
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee5$(_context5) {
|
533
535
|
while (1) switch (_context5.prev = _context5.next) {
|
534
536
|
case 0:
|
535
|
-
queryBean = (0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
537
|
+
queryBean = (0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options5 = useRequest.options) === null || _useRequest$options5 === void 0 ? void 0 : _useRequest$options5.defaultParams);
|
536
538
|
page = (0, _objectSpread3.default)({
|
537
539
|
pageNum: 1,
|
538
540
|
pageSize: 10
|
539
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
541
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.page);
|
540
542
|
params = withPagination ? (0, _objectSpread3.default)((0, _objectSpread3.default)({}, page), {}, {
|
541
543
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
542
544
|
}) : queryBean;
|
@@ -611,8 +613,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
611
613
|
});
|
612
614
|
(0, _react.useEffect)(function () {
|
613
615
|
if (onOff && !visible) {
|
614
|
-
var _useRequest$
|
615
|
-
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
616
|
+
var _useRequest$options7;
|
617
|
+
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.manual) !== true) {
|
616
618
|
onReset();
|
617
619
|
}
|
618
620
|
var nextState = {
|
@@ -645,13 +647,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
645
647
|
setState(nextState);
|
646
648
|
}
|
647
649
|
}, [onOff, visible, JSON.stringify(value)]);
|
648
|
-
(0,
|
650
|
+
(0, _react.useEffect)(function () {
|
649
651
|
if (value && !visible && isInit && !readOnly) {
|
650
652
|
getInitValues();
|
651
653
|
}
|
652
654
|
}, [JSON.stringify(value), visible, isInit]);
|
653
655
|
(0, _ahooks.useDebounceEffect)(function () {
|
654
|
-
if (value && !visible && readOnly && !(0, _lodash.isEqual)(value, preValue.current)) {
|
656
|
+
if (value && !visible && readOnly && (!(0, _lodash.isEqual)(value, preValue.current) || (options === null || options === void 0 ? void 0 : options.length) === 0)) {
|
655
657
|
var _options$some;
|
656
658
|
preValue.current = value;
|
657
659
|
var isHasValue = options === null || options === void 0 ? void 0 : (_options$some = options.some) === null || _options$some === void 0 ? void 0 : _options$some.call(options, function (item) {
|
@@ -663,18 +665,51 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
663
665
|
if (useRequest) {
|
664
666
|
// 加定时器 修复依赖数据同步更新未取到问题
|
665
667
|
setTimeout(function () {
|
666
|
-
var _useRequest$
|
668
|
+
var _useRequest$options8, _useRequest$options9;
|
667
669
|
var params = withPagination ? {
|
668
670
|
pageNum: 1,
|
669
671
|
pageSize: 50,
|
670
|
-
queryBean: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
671
|
-
} : (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
672
|
+
queryBean: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams)
|
673
|
+
} : (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams), initParams);
|
672
674
|
var nextParams = transformParams ? transformParams(params) : params;
|
673
675
|
run(nextParams);
|
674
676
|
}, 300);
|
675
677
|
}
|
676
678
|
}
|
677
|
-
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
679
|
+
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options10 = useRequest.options) === null || _useRequest$options10 === void 0 ? void 0 : _useRequest$options10.defaultParams), JSON.stringify(initParams), options === null || options === void 0 ? void 0 : options.length]);
|
680
|
+
var handleSelectFocus = function handleSelectFocus() {
|
681
|
+
if (useRequest) {
|
682
|
+
var _useRequest$options11;
|
683
|
+
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options11 = useRequest.options) === null || _useRequest$options11 === void 0 ? void 0 : _useRequest$options11.defaultParams) || {};
|
684
|
+
var params = withPagination ? {
|
685
|
+
pageNum: 1,
|
686
|
+
pageSize: 50,
|
687
|
+
queryBean: queryBean
|
688
|
+
} : queryBean;
|
689
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
690
|
+
// 减少请求条件一致时,且请求过时,focus的重复请求
|
691
|
+
if (!(0, _lodash.isEqual)(queryBean, defaultParamsRef.current) || !(options === null || options === void 0 ? void 0 : options.length)) {
|
692
|
+
run(nextParams); // 触发 run 请求
|
693
|
+
defaultParamsRef.current = queryBean; // 更新缓存
|
694
|
+
}
|
695
|
+
setState({
|
696
|
+
isInit: false
|
697
|
+
});
|
698
|
+
}
|
699
|
+
};
|
700
|
+
var handleSelectSearch = (0, _lodash.debounce)(function (val) {
|
701
|
+
if (useRequest) {
|
702
|
+
var _useRequest$options12;
|
703
|
+
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));
|
704
|
+
var params = withPagination ? {
|
705
|
+
pageNum: 1,
|
706
|
+
pageSize: 50,
|
707
|
+
queryBean: queryBean
|
708
|
+
} : queryBean;
|
709
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
710
|
+
run(nextParams);
|
711
|
+
}
|
712
|
+
}, 1000);
|
678
713
|
(0, _ahooks.useDebounceEffect)(function () {
|
679
714
|
if (!value) {
|
680
715
|
if (defaultOne) {
|
@@ -724,35 +759,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
724
759
|
notFoundContent: selectLoading ? (0, _jsxRuntime.jsx)(_antd.Spin, {
|
725
760
|
size: "small"
|
726
761
|
}) : null,
|
727
|
-
onFocus:
|
728
|
-
|
729
|
-
var _useRequest$options10;
|
730
|
-
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options10 = useRequest.options) === null || _useRequest$options10 === void 0 ? void 0 : _useRequest$options10.defaultParams) || {};
|
731
|
-
var params = withPagination ? {
|
732
|
-
pageNum: 1,
|
733
|
-
pageSize: 50,
|
734
|
-
queryBean: queryBean
|
735
|
-
} : queryBean;
|
736
|
-
var nextParams = transformParams ? transformParams(params) : params;
|
737
|
-
run(nextParams);
|
738
|
-
setState({
|
739
|
-
isInit: false
|
740
|
-
});
|
741
|
-
}
|
742
|
-
},
|
743
|
-
onSearch: (0, _lodash.debounce)(function (val) {
|
744
|
-
if (useRequest) {
|
745
|
-
var _useRequest$options11;
|
746
|
-
var queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options11 = useRequest.options) === null || _useRequest$options11 === void 0 ? void 0 : _useRequest$options11.defaultParams), {}, (0, _defineProperty2.default)({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
|
747
|
-
var params = withPagination ? {
|
748
|
-
pageNum: 1,
|
749
|
-
pageSize: 50,
|
750
|
-
queryBean: queryBean
|
751
|
-
} : queryBean;
|
752
|
-
var nextParams = transformParams ? transformParams(params) : params;
|
753
|
-
run(nextParams);
|
754
|
-
}
|
755
|
-
}, 2000),
|
762
|
+
onFocus: handleSelectFocus,
|
763
|
+
onSearch: handleSelectSearch,
|
756
764
|
style: {
|
757
765
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
758
766
|
}
|
Binary file
|
@@ -16,7 +16,7 @@ var _index = require("../../index");
|
|
16
16
|
var _ProCollapse = _interopRequireDefault(require("../../../ProLayout/components/ProCollapse"));
|
17
17
|
var _excluded = ["id", "title", "collapse", "children", "lazyLoad"];
|
18
18
|
var defaultLazyLoadConfig = {
|
19
|
-
height:
|
19
|
+
height: 200,
|
20
20
|
offset: 100,
|
21
21
|
once: true // Load only once upon first entry into the viewport
|
22
22
|
};
|
@@ -32,7 +32,7 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
32
32
|
register = _useStep.register,
|
33
33
|
collapse = _useStep.collapse,
|
34
34
|
globalLazyLoad = _useStep.lazyLoad;
|
35
|
-
var lazyLoad = stepLazyLoad
|
35
|
+
var lazyLoad = stepLazyLoad !== null && stepLazyLoad !== void 0 ? stepLazyLoad : globalLazyLoad;
|
36
36
|
(0, _react.useEffect)(function () {
|
37
37
|
// Schedule registration to avoid re-render issues
|
38
38
|
var timeoutId = setTimeout(function () {
|
@@ -68,7 +68,10 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
68
68
|
onChange: function onChange(e) {
|
69
69
|
var _restProps$onChange;
|
70
70
|
if (lazyLoad) {
|
71
|
-
|
71
|
+
// 延时执行, 避免在折叠时, 懒加载的元素没有高度
|
72
|
+
setTimeout(function () {
|
73
|
+
(0, _reactLazyload.forceCheck)();
|
74
|
+
}, 100);
|
72
75
|
}
|
73
76
|
// 默认执行
|
74
77
|
restProps === null || restProps === void 0 ? void 0 : (_restProps$onChange = restProps.onChange) === null || _restProps$onChange === void 0 ? void 0 : _restProps$onChange.call(restProps, e);
|
package/lib/ProTable/index.js
CHANGED
@@ -257,9 +257,6 @@ var ProTable = function ProTable(props) {
|
|
257
257
|
if (isExistPercentWidth) {
|
258
258
|
_scroll = props === null || props === void 0 ? void 0 : props.scroll;
|
259
259
|
}
|
260
|
-
if (props.expandable) {
|
261
|
-
_scroll = {};
|
262
|
-
}
|
263
260
|
var handleColumnConfig = /*#__PURE__*/function () {
|
264
261
|
var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(checkList) {
|
265
262
|
var newColumns, _columnConfig$onColum, catchColumns;
|
@@ -30,8 +30,8 @@ export declare const isListResult: (data: {
|
|
30
30
|
}) => boolean;
|
31
31
|
export declare const getRowKey: (rowKey: any, record: any) => any;
|
32
32
|
/** 移除对象中的 null , undefined, '' 的key */
|
33
|
-
export declare const removeEmptyKeys: (obj
|
34
|
-
[k: string]:
|
33
|
+
export declare const removeEmptyKeys: (obj?: Record<string, any>) => {
|
34
|
+
[k: string]: any;
|
35
35
|
};
|
36
36
|
export declare const getPadding: (el: HTMLElement) => {
|
37
37
|
pLeft: number;
|
@@ -82,6 +82,7 @@ var getRowKey = exports.getRowKey = function getRowKey(rowKey, record) {
|
|
82
82
|
};
|
83
83
|
/** 移除对象中的 null , undefined, '' 的key */
|
84
84
|
var removeEmptyKeys = exports.removeEmptyKeys = function removeEmptyKeys(obj) {
|
85
|
+
if (!obj) return {};
|
85
86
|
// 使用 Object.entries() 将对象转换为键值对数组
|
86
87
|
var entries = Object.entries(obj);
|
87
88
|
// 过滤掉值为 null, undefined, 或 '' 的键值对
|
@@ -14,6 +14,7 @@ interface DragRenderProps extends Pick<ProUploadProps, 'buttonProps' | 'disabled
|
|
14
14
|
afterRender: string | ReactNode;
|
15
15
|
extExt: any[];
|
16
16
|
isConfirmDelete?: boolean;
|
17
|
+
onRemove?: (file: UploadFile) => any | Promise<any>;
|
17
18
|
}
|
18
19
|
declare const ButtonRender: FC<DragRenderProps>;
|
19
20
|
export default ButtonRender;
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports.default = void 0;
|
8
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
8
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
10
12
|
var _antd = require("antd");
|
@@ -30,7 +32,8 @@ var ButtonRender = function ButtonRender(props) {
|
|
30
32
|
afterRender = props.afterRender,
|
31
33
|
_props$buttonText = props.buttonText,
|
32
34
|
buttonText = _props$buttonText === void 0 ? _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProUpload = _locale.default.ProUpload) === null || _locale$ProUpload === void 0 ? void 0 : _locale$ProUpload.buttonText : _props$buttonText,
|
33
|
-
isConfirmDelete = props.isConfirmDelete
|
35
|
+
isConfirmDelete = props.isConfirmDelete,
|
36
|
+
_onRemove = props.onRemove;
|
34
37
|
// 按钮类型的props
|
35
38
|
var buttonUploadProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, baseUploadProps), {}, {
|
36
39
|
fileList: fileList,
|
@@ -42,7 +45,34 @@ var ButtonRender = function ButtonRender(props) {
|
|
42
45
|
file: file,
|
43
46
|
isConfirmDelete: isConfirmDelete,
|
44
47
|
onPreview: onPreview,
|
45
|
-
onRemove:
|
48
|
+
onRemove: function () {
|
49
|
+
var _onRemove2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(file) {
|
50
|
+
var res;
|
51
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
52
|
+
while (1) switch (_context.prev = _context.next) {
|
53
|
+
case 0:
|
54
|
+
_context.next = 2;
|
55
|
+
return _onRemove === null || _onRemove === void 0 ? void 0 : _onRemove(file);
|
56
|
+
case 2:
|
57
|
+
res = _context.sent;
|
58
|
+
if (!(res === false)) {
|
59
|
+
_context.next = 5;
|
60
|
+
break;
|
61
|
+
}
|
62
|
+
return _context.abrupt("return");
|
63
|
+
case 5:
|
64
|
+
actions.remove(file);
|
65
|
+
case 6:
|
66
|
+
case "end":
|
67
|
+
return _context.stop();
|
68
|
+
}
|
69
|
+
}, _callee);
|
70
|
+
}));
|
71
|
+
function onRemove(_x) {
|
72
|
+
return _onRemove2.apply(this, arguments);
|
73
|
+
}
|
74
|
+
return onRemove;
|
75
|
+
}(),
|
46
76
|
onDownload: onDownload
|
47
77
|
})
|
48
78
|
});
|
@@ -13,7 +13,7 @@ interface DragRenderProps extends Pick<ProUploadProps, 'buttonProps' | 'disabled
|
|
13
13
|
onPreview: any;
|
14
14
|
onDownload: any;
|
15
15
|
extExt: any[];
|
16
|
-
onRemove: (file: UploadFile) =>
|
16
|
+
onRemove: (file: UploadFile) => any | Promise<any>;
|
17
17
|
}
|
18
18
|
declare const ImageRender: FC<DragRenderProps>;
|
19
19
|
export default ImageRender;
|
package/lib/ProUpload/index.js
CHANGED
@@ -272,7 +272,7 @@ var ProUpload = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
272
272
|
onDragEnd: onDragEnd,
|
273
273
|
onPreview: onPreview,
|
274
274
|
onDownload: onDownload,
|
275
|
-
onRemove:
|
275
|
+
onRemove: onRemove,
|
276
276
|
onChange: onChange,
|
277
277
|
setFileList: setFileList,
|
278
278
|
extExt: extExt,
|