@zat-design/sisyphus-react 3.11.5 → 3.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/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 +3 -3
- 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 +3 -3
- 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
|
}
|
@@ -650,13 +650,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
650
650
|
setState(nextState);
|
651
651
|
}
|
652
652
|
}, [onOff, visible, JSON.stringify(value)]);
|
653
|
-
|
653
|
+
useEffect(function () {
|
654
654
|
if (value && !visible && isInit && !readOnly) {
|
655
655
|
getInitValues();
|
656
656
|
}
|
657
657
|
}, [JSON.stringify(value), visible, isInit]);
|
658
658
|
useDebounceEffect(function () {
|
659
|
-
if (value && !visible && readOnly && !isEqual(value, preValue.current)) {
|
659
|
+
if (value && !visible && readOnly && (!isEqual(value, preValue.current) || (options === null || options === void 0 ? void 0 : options.length) === 0)) {
|
660
660
|
var _options$some;
|
661
661
|
preValue.current = value;
|
662
662
|
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) {
|
@@ -679,7 +679,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
679
679
|
}, 300);
|
680
680
|
}
|
681
681
|
}
|
682
|
-
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams), JSON.stringify(initParams)]);
|
682
|
+
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams), JSON.stringify(initParams), options === null || options === void 0 ? void 0 : options.length]);
|
683
683
|
useDebounceEffect(function () {
|
684
684
|
if (!value) {
|
685
685
|
if (defaultOne) {
|
@@ -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
|
}
|
@@ -645,13 +645,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
645
645
|
setState(nextState);
|
646
646
|
}
|
647
647
|
}, [onOff, visible, JSON.stringify(value)]);
|
648
|
-
(0,
|
648
|
+
(0, _react.useEffect)(function () {
|
649
649
|
if (value && !visible && isInit && !readOnly) {
|
650
650
|
getInitValues();
|
651
651
|
}
|
652
652
|
}, [JSON.stringify(value), visible, isInit]);
|
653
653
|
(0, _ahooks.useDebounceEffect)(function () {
|
654
|
-
if (value && !visible && readOnly && !(0, _lodash.isEqual)(value, preValue.current)) {
|
654
|
+
if (value && !visible && readOnly && (!(0, _lodash.isEqual)(value, preValue.current) || (options === null || options === void 0 ? void 0 : options.length) === 0)) {
|
655
655
|
var _options$some;
|
656
656
|
preValue.current = value;
|
657
657
|
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) {
|
@@ -674,7 +674,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
674
674
|
}, 300);
|
675
675
|
}
|
676
676
|
}
|
677
|
-
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams), JSON.stringify(initParams)]);
|
677
|
+
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams), JSON.stringify(initParams), options === null || options === void 0 ? void 0 : options.length]);
|
678
678
|
(0, _ahooks.useDebounceEffect)(function () {
|
679
679
|
if (!value) {
|
680
680
|
if (defaultOne) {
|
@@ -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,
|