@zat-design/sisyphus-react 3.10.4 → 3.11.0
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/dist/index.esm.css +8 -0
- package/dist/less.esm.css +8 -0
- package/es/ProEditTable/components/RcTable/BaseTable.js +13 -2
- package/es/ProEditTable/components/RcTable/VirtualTable.d.ts +2 -5
- package/es/ProEditTable/components/RcTable/VirtualTable.js +5 -163
- package/es/ProEditTable/components/RcTable/index.d.ts +1 -1
- package/es/ProEditTable/components/RcTable/index.js +1 -1
- package/es/ProEditTable/index.js +20 -4
- package/es/ProEditTable/propsType.d.ts +1 -0
- package/es/ProEditTable/style/index.less +8 -0
- package/es/ProEditTable/utils/tools.d.ts +9 -0
- package/es/ProEditTable/utils/tools.js +277 -2
- package/es/ProForm/components/base/InputNumber/index.js +2 -1
- package/es/ProForm/utils/useForm.js +12 -6
- package/es/ProStep/components/Item/index.d.ts +3 -3
- package/es/ProStep/components/Item/index.js +43 -15
- package/es/ProStep/components/Listener/index.js +25 -6
- package/es/ProStep/index.d.ts +2 -1
- package/es/ProStep/index.js +15 -6
- package/es/ProStep/propsType.d.ts +4 -1
- package/lib/ProEditTable/components/RcTable/BaseTable.js +11 -2
- package/lib/ProEditTable/components/RcTable/VirtualTable.d.ts +2 -5
- package/lib/ProEditTable/components/RcTable/VirtualTable.js +3 -161
- package/lib/ProEditTable/components/RcTable/index.d.ts +1 -1
- package/lib/ProEditTable/index.js +19 -3
- package/lib/ProEditTable/propsType.d.ts +1 -0
- package/lib/ProEditTable/style/index.less +8 -0
- package/lib/ProEditTable/utils/tools.d.ts +9 -0
- package/lib/ProEditTable/utils/tools.js +278 -2
- package/lib/ProForm/components/base/InputNumber/index.js +2 -1
- package/lib/ProForm/utils/useForm.js +12 -6
- package/lib/ProStep/components/Item/index.d.ts +3 -3
- package/lib/ProStep/components/Item/index.js +43 -15
- package/lib/ProStep/components/Listener/index.js +24 -5
- package/lib/ProStep/index.d.ts +2 -1
- package/lib/ProStep/index.js +15 -6
- package/lib/ProStep/propsType.d.ts +4 -1
- package/package.json +7 -6
package/dist/index.esm.css
CHANGED
@@ -4516,6 +4516,14 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
4516
4516
|
padding: 0;
|
4517
4517
|
border-radius: 0;
|
4518
4518
|
}
|
4519
|
+
.pro-edit-table .ant-pagination .ant-pagination-item .pro-edit-table-pagination-item-badge {
|
4520
|
+
position: relative;
|
4521
|
+
}
|
4522
|
+
.pro-edit-table .ant-pagination .ant-pagination-item .pro-edit-table-pagination-item-badge .ant-badge {
|
4523
|
+
position: absolute;
|
4524
|
+
top: -10px;
|
4525
|
+
right: -10px;
|
4526
|
+
}
|
4519
4527
|
.pro-edit-table .pro-edit-table-tooltip {
|
4520
4528
|
display: -webkit-inline-box;
|
4521
4529
|
display: -webkit-inline-flex;
|
package/dist/less.esm.css
CHANGED
@@ -4516,6 +4516,14 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
4516
4516
|
padding: 0;
|
4517
4517
|
border-radius: 0;
|
4518
4518
|
}
|
4519
|
+
.pro-edit-table .ant-pagination .ant-pagination-item .pro-edit-table-pagination-item-badge {
|
4520
|
+
position: relative;
|
4521
|
+
}
|
4522
|
+
.pro-edit-table .ant-pagination .ant-pagination-item .pro-edit-table-pagination-item-badge .ant-badge {
|
4523
|
+
position: absolute;
|
4524
|
+
top: -10px;
|
4525
|
+
right: -10px;
|
4526
|
+
}
|
4519
4527
|
.pro-edit-table .pro-edit-table-tooltip {
|
4520
4528
|
display: -webkit-inline-box;
|
4521
4529
|
display: -webkit-inline-flex;
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import "antd/es/badge/style";
|
2
|
+
import _Badge from "antd/es/badge";
|
1
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
4
|
import "antd/es/table/style";
|
3
5
|
import _Table from "antd/es/table";
|
4
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
5
7
|
var _excluded = ["tableProps"];
|
6
|
-
import { jsx as _jsx,
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
7
9
|
import { memo } from 'react';
|
8
10
|
var BaseTable = function BaseTable(_ref) {
|
9
11
|
var _value$;
|
@@ -27,7 +29,8 @@ var BaseTable = function BaseTable(_ref) {
|
|
27
29
|
page = tableProps.page,
|
28
30
|
formatMessage = tableProps.formatMessage,
|
29
31
|
locale = tableProps.locale,
|
30
|
-
handlePageChange = tableProps.handlePageChange
|
32
|
+
handlePageChange = tableProps.handlePageChange,
|
33
|
+
pageErrorNum = tableProps.pageErrorNum;
|
31
34
|
return _jsxs(_Fragment, {
|
32
35
|
children: [headerRender ? _jsx("div", {
|
33
36
|
className: "pro-edit-table-header",
|
@@ -61,6 +64,14 @@ var BaseTable = function BaseTable(_ref) {
|
|
61
64
|
total: total
|
62
65
|
});
|
63
66
|
},
|
67
|
+
itemRender: function itemRender(index, type, originalElement) {
|
68
|
+
return type === 'page' && page.pageNum === index && pageErrorNum ? _jsxs("div", {
|
69
|
+
className: "pro-edit-table-pagination-item-badge",
|
70
|
+
children: [_jsx(_Badge, {
|
71
|
+
count: pageErrorNum
|
72
|
+
}), originalElement]
|
73
|
+
}) : originalElement;
|
74
|
+
},
|
64
75
|
onChange: handlePageChange
|
65
76
|
}, pagination) : false,
|
66
77
|
rowKey: "rowKey",
|
@@ -1,6 +1,3 @@
|
|
1
|
-
|
2
|
-
declare const _default:
|
3
|
-
[x: string]: any;
|
4
|
-
tableProps: any;
|
5
|
-
}) => import("react/jsx-runtime").JSX.Element>;
|
1
|
+
/// <reference types="react" />
|
2
|
+
declare const _default: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
6
3
|
export default _default;
|
@@ -1,166 +1,8 @@
|
|
1
|
-
import "
|
2
|
-
import
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
var _excluded = ["tableProps"];
|
7
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
8
|
-
import { useEffect, useRef, useState, memo } from 'react';
|
9
|
-
import classNames from 'classnames';
|
10
|
-
import ResizeObserver from 'rc-resize-observer';
|
11
|
-
import { VariableSizeGrid } from 'react-window';
|
12
|
-
var VirtualTable = function VirtualTable(_ref) {
|
13
|
-
var _value$;
|
14
|
-
var tableProps = _ref.tableProps,
|
15
|
-
resetProps = _objectWithoutProperties(_ref, _excluded);
|
16
|
-
var value = tableProps.value,
|
17
|
-
headerRender = tableProps.headerRender,
|
18
|
-
tableRef = tableProps.tableRef,
|
19
|
-
className = tableProps.className,
|
20
|
-
columns = tableProps.columns,
|
21
|
-
renderRowSelection = tableProps.renderRowSelection,
|
22
|
-
rowClassName = tableProps.rowClassName,
|
23
|
-
disabled = tableProps.disabled,
|
24
|
-
virtualKey = tableProps.virtualKey,
|
25
|
-
editingKeys = tableProps.editingKeys,
|
26
|
-
isHideCheckBox = tableProps.isHideCheckBox,
|
27
|
-
rowDraggable = tableProps.rowDraggable,
|
28
|
-
scroll = tableProps.scroll,
|
29
|
-
summary = tableProps.summary;
|
30
|
-
var _useState = useState(0),
|
31
|
-
_useState2 = _slicedToArray(_useState, 2),
|
32
|
-
tableWidth = _useState2[0],
|
33
|
-
setTableWidth = _useState2[1];
|
34
|
-
var widthColumnCount = columns.filter(function (_ref2) {
|
35
|
-
var width = _ref2.width;
|
36
|
-
return !width;
|
37
|
-
}).length;
|
38
|
-
var mergedColumns = columns.map(function (column) {
|
39
|
-
if (column.width) {
|
40
|
-
return column;
|
41
|
-
}
|
42
|
-
return _objectSpread(_objectSpread({}, column), {}, {
|
43
|
-
width: Math.floor(tableWidth / widthColumnCount)
|
44
|
-
});
|
45
|
-
});
|
46
|
-
var gridRef = useRef();
|
47
|
-
var _useState3 = useState(function () {
|
48
|
-
var obj = {};
|
49
|
-
Object.defineProperty(obj, 'scrollLeft', {
|
50
|
-
get: function get() {
|
51
|
-
if (gridRef.current) {
|
52
|
-
var _gridRef$current, _gridRef$current$stat;
|
53
|
-
return (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : (_gridRef$current$stat = _gridRef$current.state) === null || _gridRef$current$stat === void 0 ? void 0 : _gridRef$current$stat.scrollLeft;
|
54
|
-
}
|
55
|
-
return null;
|
56
|
-
},
|
57
|
-
set: function set(scrollLeft) {
|
58
|
-
if (gridRef.current) {
|
59
|
-
gridRef.current.scrollTo({
|
60
|
-
scrollLeft: scrollLeft
|
61
|
-
});
|
62
|
-
}
|
63
|
-
}
|
64
|
-
});
|
65
|
-
return obj;
|
66
|
-
}),
|
67
|
-
_useState4 = _slicedToArray(_useState3, 1),
|
68
|
-
connectObject = _useState4[0];
|
69
|
-
var resetVirtualGrid = function resetVirtualGrid() {
|
70
|
-
var _gridRef$current2;
|
71
|
-
(_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.resetAfterIndices({
|
72
|
-
columnIndex: 0,
|
73
|
-
shouldForceUpdate: true
|
74
|
-
});
|
75
|
-
};
|
76
|
-
useEffect(function () {
|
77
|
-
return resetVirtualGrid;
|
78
|
-
}, [tableWidth]);
|
79
|
-
var renderVirtualList = function renderVirtualList(rawData, _ref3) {
|
80
|
-
var scrollbarSize = _ref3.scrollbarSize,
|
81
|
-
ref = _ref3.ref,
|
82
|
-
_onScroll = _ref3.onScroll;
|
83
|
-
ref.current = connectObject;
|
84
|
-
var totalHeight = rawData.length * 54;
|
85
|
-
return _jsx(VariableSizeGrid, {
|
86
|
-
ref: gridRef,
|
87
|
-
className: "virtual-grid",
|
88
|
-
columnCount: mergedColumns.length,
|
89
|
-
columnWidth: function columnWidth(index) {
|
90
|
-
var _width2;
|
91
|
-
var width = mergedColumns[index].width;
|
92
|
-
var _width = width;
|
93
|
-
if (typeof _width === 'string' && ((_width2 = _width) === null || _width2 === void 0 ? void 0 : _width2.includes('px'))) {
|
94
|
-
_width = parseInt(width, 10);
|
95
|
-
}
|
96
|
-
return totalHeight > scroll.y && index === mergedColumns.length - 1 ? _width - scrollbarSize - 1 : _width;
|
97
|
-
},
|
98
|
-
height: scroll.y,
|
99
|
-
rowCount: rawData.length,
|
100
|
-
rowHeight: function rowHeight() {
|
101
|
-
return 54;
|
102
|
-
},
|
103
|
-
width: tableWidth,
|
104
|
-
onScroll: function onScroll(_ref4) {
|
105
|
-
var scrollLeft = _ref4.scrollLeft;
|
106
|
-
_onScroll({
|
107
|
-
scrollLeft: scrollLeft
|
108
|
-
});
|
109
|
-
},
|
110
|
-
children: function children(_ref5) {
|
111
|
-
var columnIndex = _ref5.columnIndex,
|
112
|
-
rowIndex = _ref5.rowIndex,
|
113
|
-
style = _ref5.style;
|
114
|
-
return _jsx("div", {
|
115
|
-
className: classNames('virtual-table-cell', {
|
116
|
-
'virtual-table-cell-last': columnIndex === mergedColumns.length - 1
|
117
|
-
}),
|
118
|
-
style: style,
|
119
|
-
children: rawData[rowIndex][mergedColumns[columnIndex].dataIndex]
|
120
|
-
});
|
121
|
-
}
|
122
|
-
});
|
123
|
-
};
|
124
|
-
return _jsxs(ResizeObserver, {
|
125
|
-
onResize: function onResize(_ref6) {
|
126
|
-
var _width3;
|
127
|
-
var width = _ref6.width;
|
128
|
-
var _width = width;
|
129
|
-
if (typeof _width === 'string' && ((_width3 = _width) === null || _width3 === void 0 ? void 0 : _width3.includes('px'))) {
|
130
|
-
_width = parseInt(width, 10);
|
131
|
-
}
|
132
|
-
setTableWidth(_width);
|
133
|
-
},
|
134
|
-
children: [headerRender ? _jsx("div", {
|
135
|
-
className: "pro-edit-table-header",
|
136
|
-
children: typeof headerRender === 'function' ? headerRender() : headerRender
|
137
|
-
}) : null, _jsx(_Table, _objectSpread(_objectSpread({
|
138
|
-
ref: tableRef,
|
139
|
-
className: className,
|
140
|
-
dataSource: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value : undefined,
|
141
|
-
columns: mergedColumns,
|
142
|
-
rowSelection: renderRowSelection(),
|
143
|
-
rowClassName: rowClassName,
|
144
|
-
components: {
|
145
|
-
body: renderVirtualList
|
146
|
-
},
|
147
|
-
onRow: function onRow() {
|
148
|
-
return {
|
149
|
-
disabled: disabled || virtualKey && !!editingKeys.length,
|
150
|
-
'data-hide': isHideCheckBox,
|
151
|
-
'data-row-draggable': rowDraggable,
|
152
|
-
onClick: function onClick() {}
|
153
|
-
};
|
154
|
-
}
|
155
|
-
}, resetProps), {}, {
|
156
|
-
pagination: false,
|
157
|
-
rowKey: "rowKey",
|
158
|
-
scroll: {
|
159
|
-
x: scroll === null || scroll === void 0 ? void 0 : scroll.x,
|
160
|
-
y: (value === null || value === void 0 ? void 0 : value.length) ? scroll === null || scroll === void 0 ? void 0 : scroll.y : undefined
|
161
|
-
},
|
162
|
-
summary: summary
|
163
|
-
}))]
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { memo } from 'react';
|
3
|
+
var VirtualTable = function VirtualTable() {
|
4
|
+
return _jsx(_Fragment, {
|
5
|
+
children: "\u6682\u65F6\u4E0D\u4F7F\u7528\uFF0C\u53EF\u4EE5\u7B49\u5347\u7EA7antd5\u4F7F\u7528\u5BF9\u5E94\u7684\u80FD\u529B"
|
164
6
|
});
|
165
7
|
};
|
166
8
|
export default /*#__PURE__*/memo(VirtualTable);
|
package/es/ProEditTable/index.js
CHANGED
@@ -18,7 +18,7 @@ import { get, isArray, isBoolean, set } from 'lodash';
|
|
18
18
|
import { useDeepCompareEffect, useLocalStorageState, useSetState } from 'ahooks';
|
19
19
|
import classnames from 'classnames';
|
20
20
|
import { transformColumns } from './utils';
|
21
|
-
import { getRandom, getNamePath, handleScrollToError } from './utils/tools';
|
21
|
+
import { getRandom, getNamePath, handleScrollToError, onPageCheck } from './utils/tools';
|
22
22
|
import { Validator, Summary, RenderToolbar } from './components';
|
23
23
|
import ProForm from '../ProForm';
|
24
24
|
import Empty from '../assets/empty.png';
|
@@ -98,8 +98,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
98
98
|
virtualKey: type === 'single' || mode === 'single' ? getRandom() : '',
|
99
99
|
page: {
|
100
100
|
pageNum: 1,
|
101
|
-
pageSize: 10
|
102
|
-
}
|
101
|
+
pageSize: (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || 10
|
102
|
+
},
|
103
|
+
pageErrorNum: 0
|
103
104
|
}),
|
104
105
|
_useSetState2 = _slicedToArray(_useSetState, 2),
|
105
106
|
state = _useSetState2[0],
|
@@ -110,7 +111,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
110
111
|
virtualKey = state.virtualKey,
|
111
112
|
selectedRowKeys = state.selectedRowKeys,
|
112
113
|
selectedRows = state.selectedRows,
|
113
|
-
page = state.page
|
114
|
+
page = state.page,
|
115
|
+
pageErrorNum = state.pageErrorNum;
|
114
116
|
var virtualRowName = getNamePath(isArray(name) ? name : [name], virtualKey);
|
115
117
|
// 样式处理
|
116
118
|
var _className = classnames({
|
@@ -411,6 +413,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
411
413
|
page: page,
|
412
414
|
formatMessage: formatMessage,
|
413
415
|
locale: locale,
|
416
|
+
pageErrorNum: pageErrorNum,
|
414
417
|
handlePageChange: handlePageChange
|
415
418
|
}
|
416
419
|
})), !isView && (value === null || value === void 0 ? void 0 : value.length) ? toolbarSticky ? _jsx(_Affix, _objectSpread(_objectSpread({
|
@@ -426,6 +429,19 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
426
429
|
}) : null, footerRender ? _jsx("div", {
|
427
430
|
className: "pro-edit-table-footer",
|
428
431
|
children: footerRender
|
432
|
+
}) : null, pagination ? _jsx("div", {
|
433
|
+
id: "pro-edit-table-pagination",
|
434
|
+
onClick: function onClick() {
|
435
|
+
onPageCheck({
|
436
|
+
form: form,
|
437
|
+
name: name,
|
438
|
+
value: value,
|
439
|
+
columns: columns,
|
440
|
+
page: page,
|
441
|
+
pagination: pagination,
|
442
|
+
setState: setState
|
443
|
+
});
|
444
|
+
}
|
429
445
|
}) : null]
|
430
446
|
}), _jsx(Validator, {
|
431
447
|
name: name,
|
@@ -14,6 +14,14 @@
|
|
14
14
|
}
|
15
15
|
}
|
16
16
|
|
17
|
+
.@{ant-prefix}-pagination .@{ant-prefix}-pagination-item .pro-edit-table-pagination-item-badge {
|
18
|
+
position: relative;
|
19
|
+
.@{ant-prefix}-badge {
|
20
|
+
position: absolute;
|
21
|
+
top: -10px;
|
22
|
+
right: -10px;
|
23
|
+
}
|
24
|
+
}
|
17
25
|
|
18
26
|
.pro-edit-table-tooltip {
|
19
27
|
display : inline-flex;
|
@@ -35,3 +35,12 @@ export declare const handleScrollToError: () => void;
|
|
35
35
|
* @returns 深拷贝后的对象,其中的React节点会被保留
|
36
36
|
*/
|
37
37
|
export declare function cloneDeepFilterNode(value: any): any;
|
38
|
+
export declare const onPageCheck: ({ form, name, value, columns, page, pagination, setState, }: {
|
39
|
+
form: any;
|
40
|
+
name: any;
|
41
|
+
value: any;
|
42
|
+
columns: any;
|
43
|
+
page: any;
|
44
|
+
pagination: any;
|
45
|
+
setState: any;
|
46
|
+
}) => Promise<void>;
|
@@ -1,6 +1,12 @@
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
2
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
1
4
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
5
|
+
/* eslint-disable no-await-in-loop */
|
6
|
+
/* eslint-disable no-restricted-syntax */
|
2
7
|
import React from 'react';
|
3
|
-
import {
|
8
|
+
import { tools, validate } from '@zat-design/utils';
|
9
|
+
import { cloneDeep, cloneDeepWith, isString, isObject, isEqual, transform, isFunction, isBoolean, get } from 'lodash';
|
4
10
|
export var getRandom = function getRandom() {
|
5
11
|
return Math.random().toString(36).slice(-6);
|
6
12
|
};
|
@@ -210,4 +216,273 @@ export function cloneDeepFilterNode(value) {
|
|
210
216
|
return val;
|
211
217
|
}
|
212
218
|
});
|
213
|
-
}
|
219
|
+
}
|
220
|
+
var _isNull = function isNull(value) {
|
221
|
+
if (Array.isArray(value) && value.length) {
|
222
|
+
return value.some(function (item) {
|
223
|
+
return _isNull(item);
|
224
|
+
});
|
225
|
+
}
|
226
|
+
return value === '' || value === undefined || value === null || Array.isArray(value) && value.length === 0;
|
227
|
+
};
|
228
|
+
var handleCheckCellValue = /*#__PURE__*/function () {
|
229
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(column, record) {
|
230
|
+
var _column$names, _column$names2, _rules2;
|
231
|
+
var value, _required, _rules, _labelRequired, res, _iterator, _step, rule;
|
232
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
233
|
+
while (1) switch (_context.prev = _context.next) {
|
234
|
+
case 0:
|
235
|
+
value = null;
|
236
|
+
if (column.name) {
|
237
|
+
value = get(record, column.name);
|
238
|
+
}
|
239
|
+
if ((_column$names = column.names) === null || _column$names === void 0 ? void 0 : _column$names.length) {
|
240
|
+
value = column.names.map(function (key) {
|
241
|
+
return get(record, key);
|
242
|
+
});
|
243
|
+
}
|
244
|
+
_required = column.required;
|
245
|
+
_rules = column.rules;
|
246
|
+
_labelRequired = column.labelRequired;
|
247
|
+
if (isFunction(column.required)) {
|
248
|
+
_required = column.required(value, record);
|
249
|
+
}
|
250
|
+
if (isFunction(column.rules)) {
|
251
|
+
_rules = column.rules(value, record);
|
252
|
+
}
|
253
|
+
if (isFunction(column.labelRequired)) {
|
254
|
+
_labelRequired = column.labelRequired(value, record);
|
255
|
+
}
|
256
|
+
if (!(((_column$names2 = column.names) === null || _column$names2 === void 0 ? void 0 : _column$names2.length) && _labelRequired !== null && _labelRequired !== undefined && _isNull(value))) {
|
257
|
+
_context.next = 11;
|
258
|
+
break;
|
259
|
+
}
|
260
|
+
return _context.abrupt("return", false);
|
261
|
+
case 11:
|
262
|
+
if (!(_required && _isNull(value))) {
|
263
|
+
_context.next = 13;
|
264
|
+
break;
|
265
|
+
}
|
266
|
+
return _context.abrupt("return", false);
|
267
|
+
case 13:
|
268
|
+
if (!((_rules2 = _rules) === null || _rules2 === void 0 ? void 0 : _rules2.length)) {
|
269
|
+
_context.next = 44;
|
270
|
+
break;
|
271
|
+
}
|
272
|
+
res = true;
|
273
|
+
_iterator = _createForOfIteratorHelper(_rules);
|
274
|
+
_context.prev = 16;
|
275
|
+
_iterator.s();
|
276
|
+
case 18:
|
277
|
+
if ((_step = _iterator.n()).done) {
|
278
|
+
_context.next = 35;
|
279
|
+
break;
|
280
|
+
}
|
281
|
+
rule = _step.value;
|
282
|
+
if (res) {
|
283
|
+
_context.next = 22;
|
284
|
+
break;
|
285
|
+
}
|
286
|
+
return _context.abrupt("break", 35);
|
287
|
+
case 22:
|
288
|
+
if (rule.required && _isNull(value)) {
|
289
|
+
res = false;
|
290
|
+
}
|
291
|
+
if (!isFunction(rule.validator)) {
|
292
|
+
_context.next = 32;
|
293
|
+
break;
|
294
|
+
}
|
295
|
+
_context.prev = 24;
|
296
|
+
_context.next = 27;
|
297
|
+
return rule.validator('', value);
|
298
|
+
case 27:
|
299
|
+
_context.next = 32;
|
300
|
+
break;
|
301
|
+
case 29:
|
302
|
+
_context.prev = 29;
|
303
|
+
_context.t0 = _context["catch"](24);
|
304
|
+
res = false;
|
305
|
+
case 32:
|
306
|
+
if (rule.type && !validate[rule.type](value)) {
|
307
|
+
res = false;
|
308
|
+
}
|
309
|
+
case 33:
|
310
|
+
_context.next = 18;
|
311
|
+
break;
|
312
|
+
case 35:
|
313
|
+
_context.next = 40;
|
314
|
+
break;
|
315
|
+
case 37:
|
316
|
+
_context.prev = 37;
|
317
|
+
_context.t1 = _context["catch"](16);
|
318
|
+
_iterator.e(_context.t1);
|
319
|
+
case 40:
|
320
|
+
_context.prev = 40;
|
321
|
+
_iterator.f();
|
322
|
+
return _context.finish(40);
|
323
|
+
case 43:
|
324
|
+
return _context.abrupt("return", res);
|
325
|
+
case 44:
|
326
|
+
return _context.abrupt("return", true);
|
327
|
+
case 45:
|
328
|
+
case "end":
|
329
|
+
return _context.stop();
|
330
|
+
}
|
331
|
+
}, _callee, null, [[16, 37, 40, 43], [24, 29]]);
|
332
|
+
}));
|
333
|
+
return function handleCheckCellValue(_x, _x2) {
|
334
|
+
return _ref6.apply(this, arguments);
|
335
|
+
};
|
336
|
+
}();
|
337
|
+
export var onPageCheck = /*#__PURE__*/function () {
|
338
|
+
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;
|
340
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
341
|
+
while (1) switch (_context2.prev = _context2.next) {
|
342
|
+
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) {
|
345
|
+
_context2.next = 75;
|
346
|
+
break;
|
347
|
+
}
|
348
|
+
pageNum = page.pageNum, pageSize = page.pageSize;
|
349
|
+
pageArr = Array.from({
|
350
|
+
length: Math.ceil(tools.calc(value.length, '/', pageSize))
|
351
|
+
}, function (_, i) {
|
352
|
+
return i + 1;
|
353
|
+
});
|
354
|
+
flag = false;
|
355
|
+
errorNum = 0;
|
356
|
+
errorPageNum = 0;
|
357
|
+
_i = 0, _pageArr = pageArr;
|
358
|
+
case 8:
|
359
|
+
if (!(_i < _pageArr.length)) {
|
360
|
+
_context2.next = 60;
|
361
|
+
break;
|
362
|
+
}
|
363
|
+
item = _pageArr[_i];
|
364
|
+
if (!flag) {
|
365
|
+
_context2.next = 12;
|
366
|
+
break;
|
367
|
+
}
|
368
|
+
return _context2.abrupt("break", 60);
|
369
|
+
case 12:
|
370
|
+
errorNum = 0;
|
371
|
+
// 实现思路:截取每一页数据,手动触发每一行数据的校验,通过column配置的rule规则,
|
372
|
+
// 依次校验每一页数据,有错误就跳出循环,跳转到错误页数,并展示错误单元格数量
|
373
|
+
start = tools.calc(item - 1, '*', pageSize);
|
374
|
+
end = tools.calc(start, '+', pageSize);
|
375
|
+
nextValues = value === null || value === void 0 ? void 0 : value.slice(start, end);
|
376
|
+
_iterator2 = _createForOfIteratorHelper(nextValues);
|
377
|
+
_context2.prev = 17;
|
378
|
+
_iterator2.s();
|
379
|
+
case 19:
|
380
|
+
if ((_step2 = _iterator2.n()).done) {
|
381
|
+
_context2.next = 48;
|
382
|
+
break;
|
383
|
+
}
|
384
|
+
record = _step2.value;
|
385
|
+
_iterator3 = _createForOfIteratorHelper(columns);
|
386
|
+
_context2.prev = 22;
|
387
|
+
_iterator3.s();
|
388
|
+
case 24:
|
389
|
+
if ((_step3 = _iterator3.n()).done) {
|
390
|
+
_context2.next = 38;
|
391
|
+
break;
|
392
|
+
}
|
393
|
+
column = _step3.value;
|
394
|
+
_context2.prev = 26;
|
395
|
+
_context2.next = 29;
|
396
|
+
return handleCheckCellValue(column, record);
|
397
|
+
case 29:
|
398
|
+
result = _context2.sent;
|
399
|
+
if (!result) {
|
400
|
+
errorNum += 1;
|
401
|
+
}
|
402
|
+
_context2.next = 36;
|
403
|
+
break;
|
404
|
+
case 33:
|
405
|
+
_context2.prev = 33;
|
406
|
+
_context2.t0 = _context2["catch"](26);
|
407
|
+
errorNum += 1;
|
408
|
+
case 36:
|
409
|
+
_context2.next = 24;
|
410
|
+
break;
|
411
|
+
case 38:
|
412
|
+
_context2.next = 43;
|
413
|
+
break;
|
414
|
+
case 40:
|
415
|
+
_context2.prev = 40;
|
416
|
+
_context2.t1 = _context2["catch"](22);
|
417
|
+
_iterator3.e(_context2.t1);
|
418
|
+
case 43:
|
419
|
+
_context2.prev = 43;
|
420
|
+
_iterator3.f();
|
421
|
+
return _context2.finish(43);
|
422
|
+
case 46:
|
423
|
+
_context2.next = 19;
|
424
|
+
break;
|
425
|
+
case 48:
|
426
|
+
_context2.next = 53;
|
427
|
+
break;
|
428
|
+
case 50:
|
429
|
+
_context2.prev = 50;
|
430
|
+
_context2.t2 = _context2["catch"](17);
|
431
|
+
_iterator2.e(_context2.t2);
|
432
|
+
case 53:
|
433
|
+
_context2.prev = 53;
|
434
|
+
_iterator2.f();
|
435
|
+
return _context2.finish(53);
|
436
|
+
case 56:
|
437
|
+
if (errorNum > 0) {
|
438
|
+
flag = true;
|
439
|
+
errorPageNum = item;
|
440
|
+
}
|
441
|
+
case 57:
|
442
|
+
_i++;
|
443
|
+
_context2.next = 8;
|
444
|
+
break;
|
445
|
+
case 60:
|
446
|
+
if (!(flag && errorNum > 0)) {
|
447
|
+
_context2.next = 74;
|
448
|
+
break;
|
449
|
+
}
|
450
|
+
nextState = {
|
451
|
+
pageErrorNum: errorNum > 0 ? errorNum : 0
|
452
|
+
};
|
453
|
+
if (pageNum !== errorPageNum) {
|
454
|
+
nextState.page = {
|
455
|
+
pageNum: errorPageNum,
|
456
|
+
pageSize: pageSize
|
457
|
+
};
|
458
|
+
}
|
459
|
+
setState(nextState);
|
460
|
+
_context2.prev = 64;
|
461
|
+
_context2.next = 67;
|
462
|
+
return form.validateFields([name], {
|
463
|
+
recursive: true
|
464
|
+
});
|
465
|
+
case 67:
|
466
|
+
_context2.next = 72;
|
467
|
+
break;
|
468
|
+
case 69:
|
469
|
+
_context2.prev = 69;
|
470
|
+
_context2.t3 = _context2["catch"](64);
|
471
|
+
handleScrollToError();
|
472
|
+
case 72:
|
473
|
+
_context2.next = 75;
|
474
|
+
break;
|
475
|
+
case 74:
|
476
|
+
setState({
|
477
|
+
pageErrorNum: 0
|
478
|
+
});
|
479
|
+
case 75:
|
480
|
+
case "end":
|
481
|
+
return _context2.stop();
|
482
|
+
}
|
483
|
+
}, _callee2, null, [[17, 50, 53, 56], [22, 40, 43, 46], [26, 33], [64, 69]]);
|
484
|
+
}));
|
485
|
+
return function onPageCheck(_x3) {
|
486
|
+
return _ref8.apply(this, arguments);
|
487
|
+
};
|
488
|
+
}();
|
@@ -48,12 +48,13 @@ var InputNumber = function InputNumber(props) {
|
|
48
48
|
var _ref2 = ProForm.useFieldProps() || {},
|
49
49
|
isViewCon = _ref2.isView,
|
50
50
|
viewEmpty = _ref2.viewEmpty,
|
51
|
-
|
51
|
+
valueTypeCon = _ref2.valueType,
|
52
52
|
viewType = _ref2.viewType,
|
53
53
|
label = _ref2.label;
|
54
54
|
var initialConfig = useProConfig('InputNumber');
|
55
55
|
var activateRef = useRef(false);
|
56
56
|
var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
|
57
|
+
var valueType = 'valueType' in props ? props.valueType : valueTypeCon; // 组件可直接接收valueType参数, 优先级高
|
57
58
|
var valueProps = {};
|
58
59
|
var formatter = function formatter(value) {
|
59
60
|
var _props$precision;
|