@zat-design/sisyphus-react 3.11.5 → 3.11.6-beta.2
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/index.js +53 -46
- 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/index.js +53 -46
- 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
|
}
|
@@ -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,
|
@@ -107,6 +107,7 @@ 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 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
111
|
var _useSetState = useSetState({
|
111
112
|
_value: value,
|
112
113
|
isInit: true,
|
@@ -316,7 +317,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
316
317
|
};
|
317
318
|
}();
|
318
319
|
var handleClose = function handleClose() {
|
319
|
-
var _useRequest$
|
320
|
+
var _useRequest$options2;
|
320
321
|
form.resetFields();
|
321
322
|
setState({
|
322
323
|
onOff: false,
|
@@ -324,7 +325,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
324
325
|
isInit: false
|
325
326
|
});
|
326
327
|
// 当设置manual为true时,清空当前弹框内已搜索出来的值
|
327
|
-
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
328
|
+
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.manual) {
|
328
329
|
mutate(function () {
|
329
330
|
return [];
|
330
331
|
});
|
@@ -471,7 +472,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
471
472
|
// 初始化回显,当传入initParams时,前端用来回险
|
472
473
|
var getInitValues = /*#__PURE__*/function () {
|
473
474
|
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
474
|
-
var _useRequest$
|
475
|
+
var _useRequest$options3, _useRequest$options4, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
|
475
476
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
476
477
|
while (1) switch (_context4.prev = _context4.next) {
|
477
478
|
case 0:
|
@@ -479,11 +480,11 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
479
480
|
_context4.next = 9;
|
480
481
|
break;
|
481
482
|
}
|
482
|
-
queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
483
|
+
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
484
|
page = _objectSpread({
|
484
485
|
pageNum: 1,
|
485
486
|
pageSize: 10
|
486
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
487
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.page);
|
487
488
|
params = withPagination ? _objectSpread(_objectSpread({}, page), {}, {
|
488
489
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
489
490
|
}) : queryBean;
|
@@ -532,16 +533,16 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
532
533
|
// 初始化回显,当传入initParams时,前端用来回险
|
533
534
|
var getDefaultOneValues = /*#__PURE__*/function () {
|
534
535
|
var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
535
|
-
var _useRequest$
|
536
|
+
var _useRequest$options5, _useRequest$options6;
|
536
537
|
var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
|
537
538
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
538
539
|
while (1) switch (_context5.prev = _context5.next) {
|
539
540
|
case 0:
|
540
|
-
queryBean = _objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
541
|
+
queryBean = _objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options5 = useRequest.options) === null || _useRequest$options5 === void 0 ? void 0 : _useRequest$options5.defaultParams);
|
541
542
|
page = _objectSpread({
|
542
543
|
pageNum: 1,
|
543
544
|
pageSize: 10
|
544
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
545
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.page);
|
545
546
|
params = withPagination ? _objectSpread(_objectSpread({}, page), {}, {
|
546
547
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
547
548
|
}) : queryBean;
|
@@ -616,8 +617,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
616
617
|
});
|
617
618
|
useEffect(function () {
|
618
619
|
if (onOff && !visible) {
|
619
|
-
var _useRequest$
|
620
|
-
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
620
|
+
var _useRequest$options7;
|
621
|
+
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.manual) !== true) {
|
621
622
|
onReset();
|
622
623
|
}
|
623
624
|
var nextState = {
|
@@ -650,13 +651,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
650
651
|
setState(nextState);
|
651
652
|
}
|
652
653
|
}, [onOff, visible, JSON.stringify(value)]);
|
653
|
-
|
654
|
+
useEffect(function () {
|
654
655
|
if (value && !visible && isInit && !readOnly) {
|
655
656
|
getInitValues();
|
656
657
|
}
|
657
658
|
}, [JSON.stringify(value), visible, isInit]);
|
658
659
|
useDebounceEffect(function () {
|
659
|
-
if (value && !visible && readOnly && !isEqual(value, preValue.current)) {
|
660
|
+
if (value && !visible && readOnly && (!isEqual(value, preValue.current) || (options === null || options === void 0 ? void 0 : options.length) === 0)) {
|
660
661
|
var _options$some;
|
661
662
|
preValue.current = value;
|
662
663
|
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 +669,51 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
668
669
|
if (useRequest) {
|
669
670
|
// 加定时器 修复依赖数据同步更新未取到问题
|
670
671
|
setTimeout(function () {
|
671
|
-
var _useRequest$
|
672
|
+
var _useRequest$options8, _useRequest$options9;
|
672
673
|
var params = withPagination ? {
|
673
674
|
pageNum: 1,
|
674
675
|
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$
|
676
|
+
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)
|
677
|
+
} : _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
678
|
var nextParams = transformParams ? transformParams(params) : params;
|
678
679
|
run(nextParams);
|
679
680
|
}, 300);
|
680
681
|
}
|
681
682
|
}
|
682
|
-
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
683
|
+
}, [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]);
|
684
|
+
var handleSelectFocus = function handleSelectFocus() {
|
685
|
+
if (useRequest) {
|
686
|
+
var _useRequest$options11;
|
687
|
+
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options11 = useRequest.options) === null || _useRequest$options11 === void 0 ? void 0 : _useRequest$options11.defaultParams) || {};
|
688
|
+
var params = withPagination ? {
|
689
|
+
pageNum: 1,
|
690
|
+
pageSize: 50,
|
691
|
+
queryBean: queryBean
|
692
|
+
} : queryBean;
|
693
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
694
|
+
// 减少请求条件一致时,且请求过时,focus的重复请求
|
695
|
+
if (!isEqual(queryBean, defaultParamsRef.current) || !(options === null || options === void 0 ? void 0 : options.length)) {
|
696
|
+
run(nextParams); // 触发 run 请求
|
697
|
+
defaultParamsRef.current = queryBean; // 更新缓存
|
698
|
+
}
|
699
|
+
setState({
|
700
|
+
isInit: false
|
701
|
+
});
|
702
|
+
}
|
703
|
+
};
|
704
|
+
var handleSelectSearch = debounce(function (val) {
|
705
|
+
if (useRequest) {
|
706
|
+
var _useRequest$options12;
|
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));
|
708
|
+
var params = withPagination ? {
|
709
|
+
pageNum: 1,
|
710
|
+
pageSize: 50,
|
711
|
+
queryBean: queryBean
|
712
|
+
} : queryBean;
|
713
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
714
|
+
run(nextParams);
|
715
|
+
}
|
716
|
+
}, 1000);
|
683
717
|
useDebounceEffect(function () {
|
684
718
|
if (!value) {
|
685
719
|
if (defaultOne) {
|
@@ -729,35 +763,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
729
763
|
notFoundContent: selectLoading ? _jsx(_Spin, {
|
730
764
|
size: "small"
|
731
765
|
}) : 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),
|
766
|
+
onFocus: handleSelectFocus,
|
767
|
+
onSearch: handleSelectSearch,
|
761
768
|
style: {
|
762
769
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
763
770
|
}
|
@@ -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
|
}
|
@@ -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,
|
@@ -102,6 +102,7 @@ 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 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
106
|
var _useSetState = (0, _ahooks.useSetState)({
|
106
107
|
_value: value,
|
107
108
|
isInit: true,
|
@@ -311,7 +312,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
311
312
|
};
|
312
313
|
}();
|
313
314
|
var handleClose = function handleClose() {
|
314
|
-
var _useRequest$
|
315
|
+
var _useRequest$options2;
|
315
316
|
form.resetFields();
|
316
317
|
setState({
|
317
318
|
onOff: false,
|
@@ -319,7 +320,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
319
320
|
isInit: false
|
320
321
|
});
|
321
322
|
// 当设置manual为true时,清空当前弹框内已搜索出来的值
|
322
|
-
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
323
|
+
if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.manual) {
|
323
324
|
mutate(function () {
|
324
325
|
return [];
|
325
326
|
});
|
@@ -466,7 +467,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
466
467
|
// 初始化回显,当传入initParams时,前端用来回险
|
467
468
|
var getInitValues = /*#__PURE__*/function () {
|
468
469
|
var _ref10 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {
|
469
|
-
var _useRequest$
|
470
|
+
var _useRequest$options3, _useRequest$options4, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
|
470
471
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
|
471
472
|
while (1) switch (_context4.prev = _context4.next) {
|
472
473
|
case 0:
|
@@ -474,11 +475,11 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
474
475
|
_context4.next = 9;
|
475
476
|
break;
|
476
477
|
}
|
477
|
-
queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
478
|
+
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
479
|
page = (0, _objectSpread3.default)({
|
479
480
|
pageNum: 1,
|
480
481
|
pageSize: 10
|
481
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
482
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.page);
|
482
483
|
params = withPagination ? (0, _objectSpread3.default)((0, _objectSpread3.default)({}, page), {}, {
|
483
484
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
484
485
|
}) : queryBean;
|
@@ -527,16 +528,16 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
527
528
|
// 初始化回显,当传入initParams时,前端用来回险
|
528
529
|
var getDefaultOneValues = /*#__PURE__*/function () {
|
529
530
|
var _ref11 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee5() {
|
530
|
-
var _useRequest$
|
531
|
+
var _useRequest$options5, _useRequest$options6;
|
531
532
|
var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
|
532
533
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee5$(_context5) {
|
533
534
|
while (1) switch (_context5.prev = _context5.next) {
|
534
535
|
case 0:
|
535
|
-
queryBean = (0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
536
|
+
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
537
|
page = (0, _objectSpread3.default)({
|
537
538
|
pageNum: 1,
|
538
539
|
pageSize: 10
|
539
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
540
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.page);
|
540
541
|
params = withPagination ? (0, _objectSpread3.default)((0, _objectSpread3.default)({}, page), {}, {
|
541
542
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
542
543
|
}) : queryBean;
|
@@ -611,8 +612,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
611
612
|
});
|
612
613
|
(0, _react.useEffect)(function () {
|
613
614
|
if (onOff && !visible) {
|
614
|
-
var _useRequest$
|
615
|
-
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
615
|
+
var _useRequest$options7;
|
616
|
+
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.manual) !== true) {
|
616
617
|
onReset();
|
617
618
|
}
|
618
619
|
var nextState = {
|
@@ -645,13 +646,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
645
646
|
setState(nextState);
|
646
647
|
}
|
647
648
|
}, [onOff, visible, JSON.stringify(value)]);
|
648
|
-
(0,
|
649
|
+
(0, _react.useEffect)(function () {
|
649
650
|
if (value && !visible && isInit && !readOnly) {
|
650
651
|
getInitValues();
|
651
652
|
}
|
652
653
|
}, [JSON.stringify(value), visible, isInit]);
|
653
654
|
(0, _ahooks.useDebounceEffect)(function () {
|
654
|
-
if (value && !visible && readOnly && !(0, _lodash.isEqual)(value, preValue.current)) {
|
655
|
+
if (value && !visible && readOnly && (!(0, _lodash.isEqual)(value, preValue.current) || (options === null || options === void 0 ? void 0 : options.length) === 0)) {
|
655
656
|
var _options$some;
|
656
657
|
preValue.current = value;
|
657
658
|
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 +664,51 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
663
664
|
if (useRequest) {
|
664
665
|
// 加定时器 修复依赖数据同步更新未取到问题
|
665
666
|
setTimeout(function () {
|
666
|
-
var _useRequest$
|
667
|
+
var _useRequest$options8, _useRequest$options9;
|
667
668
|
var params = withPagination ? {
|
668
669
|
pageNum: 1,
|
669
670
|
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$
|
671
|
+
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)
|
672
|
+
} : (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
673
|
var nextParams = transformParams ? transformParams(params) : params;
|
673
674
|
run(nextParams);
|
674
675
|
}, 300);
|
675
676
|
}
|
676
677
|
}
|
677
|
-
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
678
|
+
}, [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]);
|
679
|
+
var handleSelectFocus = function handleSelectFocus() {
|
680
|
+
if (useRequest) {
|
681
|
+
var _useRequest$options11;
|
682
|
+
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options11 = useRequest.options) === null || _useRequest$options11 === void 0 ? void 0 : _useRequest$options11.defaultParams) || {};
|
683
|
+
var params = withPagination ? {
|
684
|
+
pageNum: 1,
|
685
|
+
pageSize: 50,
|
686
|
+
queryBean: queryBean
|
687
|
+
} : queryBean;
|
688
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
689
|
+
// 减少请求条件一致时,且请求过时,focus的重复请求
|
690
|
+
if (!(0, _lodash.isEqual)(queryBean, defaultParamsRef.current) || !(options === null || options === void 0 ? void 0 : options.length)) {
|
691
|
+
run(nextParams); // 触发 run 请求
|
692
|
+
defaultParamsRef.current = queryBean; // 更新缓存
|
693
|
+
}
|
694
|
+
setState({
|
695
|
+
isInit: false
|
696
|
+
});
|
697
|
+
}
|
698
|
+
};
|
699
|
+
var handleSelectSearch = (0, _lodash.debounce)(function (val) {
|
700
|
+
if (useRequest) {
|
701
|
+
var _useRequest$options12;
|
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));
|
703
|
+
var params = withPagination ? {
|
704
|
+
pageNum: 1,
|
705
|
+
pageSize: 50,
|
706
|
+
queryBean: queryBean
|
707
|
+
} : queryBean;
|
708
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
709
|
+
run(nextParams);
|
710
|
+
}
|
711
|
+
}, 1000);
|
678
712
|
(0, _ahooks.useDebounceEffect)(function () {
|
679
713
|
if (!value) {
|
680
714
|
if (defaultOne) {
|
@@ -724,35 +758,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
724
758
|
notFoundContent: selectLoading ? (0, _jsxRuntime.jsx)(_antd.Spin, {
|
725
759
|
size: "small"
|
726
760
|
}) : 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),
|
761
|
+
onFocus: handleSelectFocus,
|
762
|
+
onSearch: handleSelectSearch,
|
756
763
|
style: {
|
757
764
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
758
765
|
}
|
@@ -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,
|