@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.
Files changed (38) hide show
  1. package/dist/index.esm.css +8 -0
  2. package/dist/less.esm.css +8 -0
  3. package/es/ProEditTable/components/RcTable/BaseTable.js +13 -2
  4. package/es/ProEditTable/components/RcTable/VirtualTable.d.ts +2 -5
  5. package/es/ProEditTable/components/RcTable/VirtualTable.js +5 -163
  6. package/es/ProEditTable/components/RcTable/index.d.ts +1 -1
  7. package/es/ProEditTable/components/RcTable/index.js +1 -1
  8. package/es/ProEditTable/index.js +20 -4
  9. package/es/ProEditTable/propsType.d.ts +1 -0
  10. package/es/ProEditTable/style/index.less +8 -0
  11. package/es/ProEditTable/utils/tools.d.ts +9 -0
  12. package/es/ProEditTable/utils/tools.js +277 -2
  13. package/es/ProForm/components/base/InputNumber/index.js +2 -1
  14. package/es/ProForm/utils/useForm.js +12 -6
  15. package/es/ProStep/components/Item/index.d.ts +3 -3
  16. package/es/ProStep/components/Item/index.js +43 -15
  17. package/es/ProStep/components/Listener/index.js +25 -6
  18. package/es/ProStep/index.d.ts +2 -1
  19. package/es/ProStep/index.js +15 -6
  20. package/es/ProStep/propsType.d.ts +4 -1
  21. package/lib/ProEditTable/components/RcTable/BaseTable.js +11 -2
  22. package/lib/ProEditTable/components/RcTable/VirtualTable.d.ts +2 -5
  23. package/lib/ProEditTable/components/RcTable/VirtualTable.js +3 -161
  24. package/lib/ProEditTable/components/RcTable/index.d.ts +1 -1
  25. package/lib/ProEditTable/index.js +19 -3
  26. package/lib/ProEditTable/propsType.d.ts +1 -0
  27. package/lib/ProEditTable/style/index.less +8 -0
  28. package/lib/ProEditTable/utils/tools.d.ts +9 -0
  29. package/lib/ProEditTable/utils/tools.js +278 -2
  30. package/lib/ProForm/components/base/InputNumber/index.js +2 -1
  31. package/lib/ProForm/utils/useForm.js +12 -6
  32. package/lib/ProStep/components/Item/index.d.ts +3 -3
  33. package/lib/ProStep/components/Item/index.js +43 -15
  34. package/lib/ProStep/components/Listener/index.js +24 -5
  35. package/lib/ProStep/index.d.ts +2 -1
  36. package/lib/ProStep/index.js +15 -6
  37. package/lib/ProStep/propsType.d.ts +4 -1
  38. package/package.json +7 -6
@@ -57,6 +57,8 @@ export var useForm = function useForm(originForm, options) {
57
57
  _form$getInternalHook,
58
58
  getFields,
59
59
  fieldsList,
60
+ tablePagination,
61
+ _tablePagination$clic,
60
62
  _error$errorFields,
61
63
  _error$errorFields$,
62
64
  _args = arguments;
@@ -95,14 +97,18 @@ export var useForm = function useForm(originForm, options) {
95
97
  case 11:
96
98
  return _context.abrupt("return", _context.sent);
97
99
  case 12:
98
- _context.next = 14;
100
+ tablePagination = document.querySelector('#pro-edit-table-pagination');
101
+ if (tablePagination) {
102
+ tablePagination === null || tablePagination === void 0 ? void 0 : (_tablePagination$clic = tablePagination.click) === null || _tablePagination$clic === void 0 ? void 0 : _tablePagination$clic.call(tablePagination);
103
+ }
104
+ _context.next = 16;
99
105
  return validateFields.apply(void 0, [nameList].concat(rest)).then(function (values) {
100
106
  return nameList ? values : _getFieldsValue();
101
107
  });
102
- case 14:
108
+ case 16:
103
109
  return _context.abrupt("return", _context.sent);
104
- case 17:
105
- _context.prev = 17;
110
+ case 19:
111
+ _context.prev = 19;
106
112
  _context.t0 = _context["catch"](0);
107
113
  if (scrollToError && (_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$errorFields = _context.t0.errorFields) === null || _error$errorFields === void 0 ? void 0 : _error$errorFields.length)) {
108
114
  form.scrollToField((_error$errorFields$ = _context.t0.errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
@@ -112,11 +118,11 @@ export var useForm = function useForm(originForm, options) {
112
118
  }
113
119
  handleScrollToError();
114
120
  throw _context.t0;
115
- case 22:
121
+ case 24:
116
122
  case "end":
117
123
  return _context.stop();
118
124
  }
119
- }, _callee, null, [[0, 17]]);
125
+ }, _callee, null, [[0, 19]]);
120
126
  }));
121
127
  return function _validateFields(_x) {
122
128
  return _ref2.apply(this, arguments);
@@ -1,3 +1,3 @@
1
- import { ProStepItem } from '../../propsType';
2
- declare const _default: ({ id, title, collapse: collapseItem, children, ...restProps }: ProStepItem) => import("react/jsx-runtime").JSX.Element;
3
- export default _default;
1
+ import { ProStepItemPropsType } from '../../propsType';
2
+ declare function ProStepItem({ id, title, collapse: collapseItem, children, lazyLoad, ...restProps }: ProStepItemPropsType): import("react/jsx-runtime").JSX.Element;
3
+ export default ProStepItem;
@@ -1,41 +1,69 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["id", "title", "collapse", "children"];
3
+ var _excluded = ["id", "title", "collapse", "children", "lazyLoad"];
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { useEffect } from 'react';
6
+ import LazyLoad from 'react-lazyload';
7
+ import { isBoolean } from 'lodash';
6
8
  import { useStep } from '../../index';
7
9
  import ProCollapse from '../../../ProLayout/components/ProCollapse';
8
- export default (function (_ref) {
10
+ var defaultLazyLoadConfig = {
11
+ height: 100,
12
+ offset: 100,
13
+ once: true // Load only once upon first entry into the viewport
14
+ };
15
+ function ProStepItem(_ref) {
9
16
  var id = _ref.id,
10
17
  title = _ref.title,
11
18
  _ref$collapse = _ref.collapse,
12
19
  collapseItem = _ref$collapse === void 0 ? true : _ref$collapse,
13
20
  children = _ref.children,
21
+ lazyLoad = _ref.lazyLoad,
14
22
  restProps = _objectWithoutProperties(_ref, _excluded);
15
23
  var _useStep = useStep(),
16
24
  register = _useStep.register,
17
25
  collapse = _useStep.collapse;
18
26
  useEffect(function () {
19
- // 子组件更新父组件 延迟状态更新,避免重渲染
27
+ // Schedule registration to avoid re-render issues
20
28
  var timeoutId = setTimeout(function () {
21
- register === null || register === void 0 ? void 0 : register(_objectSpread(_objectSpread({}, restProps), {}, {
29
+ register === null || register === void 0 ? void 0 : register(_objectSpread({
30
+ id: id,
22
31
  title: title,
23
- id: id
24
- }));
32
+ lazyLoad: lazyLoad
33
+ }, restProps));
25
34
  }, 0);
26
35
  return function () {
27
36
  return clearTimeout(timeoutId);
28
37
  };
29
- }, [register]);
38
+ }, [id, title, lazyLoad, restProps, register]);
39
+ var renderChildren = function renderChildren() {
40
+ if (lazyLoad) {
41
+ var lazyLoadProps = isBoolean(lazyLoad) ? defaultLazyLoadConfig : lazyLoad;
42
+ return _jsx(LazyLoad, _objectSpread(_objectSpread({}, lazyLoadProps), {}, {
43
+ classNamePrefix: id,
44
+ children: children
45
+ }));
46
+ }
47
+ return children;
48
+ };
49
+ // If there's no `register` function or if collapsing is enabled, wrap in ProCollapse
50
+ if (!register || collapse && collapseItem && title) {
51
+ return _jsx("div", {
52
+ className: "pro-step-item",
53
+ id: id,
54
+ children: _jsx(ProCollapse, _objectSpread(_objectSpread({
55
+ title: title,
56
+ icon: true
57
+ }, restProps), {}, {
58
+ children: renderChildren()
59
+ }))
60
+ });
61
+ }
62
+ // Otherwise, just render children
30
63
  return _jsx("div", {
31
64
  className: "pro-step-item",
32
65
  id: id,
33
- children: !register || collapse && collapseItem && title ? _jsx(ProCollapse, _objectSpread(_objectSpread({
34
- id: id,
35
- title: title,
36
- icon: true
37
- }, restProps), {}, {
38
- children: children
39
- })) : children
66
+ children: renderChildren()
40
67
  });
41
- });
68
+ }
69
+ export default ProStepItem;
@@ -1,9 +1,9 @@
1
1
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
5
  var _excluded = ["children", "delayTime", "excludes"];
6
- import { throttle } from 'lodash';
6
+ import { throttle, pick } from 'lodash';
7
7
  import React from 'react';
8
8
  import { useStep } from '../../index';
9
9
  var checkErrorList = function checkErrorList(arr) {
@@ -26,16 +26,34 @@ var findFirstErrorDom = function findFirstErrorDom() {
26
26
  }
27
27
  return null;
28
28
  };
29
+ var getLoadedMap = function getLoadedMap(registerMap) {
30
+ if (!(registerMap === null || registerMap === void 0 ? void 0 : registerMap.current)) {
31
+ return undefined;
32
+ }
33
+ var stepList = Object.values(registerMap === null || registerMap === void 0 ? void 0 : registerMap.current).map(function (item) {
34
+ return _objectSpread(_objectSpread({}, pick(item, ['id', 'order', 'title'])), {}, {
35
+ loaded: !document.querySelector(".".concat(item === null || item === void 0 ? void 0 : item.id, "-placeholder"))
36
+ });
37
+ });
38
+ return stepList;
39
+ };
40
+ // Function to check if all modules are loaded
41
+ var areAllModulesLoaded = function areAllModulesLoaded(data) {
42
+ return data.every(function (item) {
43
+ return (item === null || item === void 0 ? void 0 : item.loaded) === true;
44
+ });
45
+ };
29
46
  export default (function (_ref) {
30
47
  var children = _ref.children,
31
48
  delayTime = _ref.delayTime,
32
49
  excludes = _ref.excludes,
33
50
  props = _objectWithoutProperties(_ref, _excluded);
34
51
  var _useStep = useStep(),
35
- notify = _useStep.notify;
52
+ notify = _useStep.notify,
53
+ registerMap = _useStep.registerMap;
36
54
  return /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
37
55
  onClick: throttle(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
38
- var values;
56
+ var values, loadedMap;
39
57
  return _regeneratorRuntime().wrap(function _callee$(_context) {
40
58
  while (1) switch (_context.prev = _context.next) {
41
59
  case 0:
@@ -46,6 +64,7 @@ export default (function (_ref) {
46
64
  });
47
65
  case 3:
48
66
  values = _context.sent;
67
+ loadedMap = getLoadedMap(registerMap);
49
68
  setTimeout(function () {
50
69
  var localData = localStorage.getItem('cache-pro-step');
51
70
  var _ref3 = findFirstErrorDom() || {},
@@ -55,10 +74,10 @@ export default (function (_ref) {
55
74
  }
56
75
  if (localData !== 'false') {
57
76
  var _children$props, _children$props$onCli;
58
- children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : (_children$props$onCli = _children$props.onClick) === null || _children$props$onCli === void 0 ? void 0 : _children$props$onCli.call(_children$props, values);
77
+ children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : (_children$props$onCli = _children$props.onClick) === null || _children$props$onCli === void 0 ? void 0 : _children$props$onCli.call(_children$props, values, areAllModulesLoaded(loadedMap), loadedMap);
59
78
  }
60
79
  }, delayTime !== null && delayTime !== void 0 ? delayTime : 0);
61
- case 5:
80
+ case 6:
62
81
  case "end":
63
82
  return _context.stop();
64
83
  }
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import Item from './components/Item';
2
3
  import { ProStepPropsType } from './propsType';
3
4
  import './style/index.less';
4
5
  export declare const ProStepContext: import("react").Context<any>;
@@ -6,7 +7,7 @@ export declare const useStep: () => any;
6
7
  declare const ProStep: {
7
8
  ({ children, ...resetProps }: ProStepPropsType): import("react/jsx-runtime").JSX.Element;
8
9
  useStep: () => any;
9
- Item: ({ id, title, collapse: collapseItem, children, ...restProps }: import("./propsType").ProStepItem) => import("react/jsx-runtime").JSX.Element;
10
+ Item: typeof Item;
10
11
  Listener: ({ children, delayTime, excludes, ...props }: any) => import("react").DetailedReactHTMLElement<any, HTMLElement>;
11
12
  };
12
13
  export default ProStep;
@@ -23,10 +23,12 @@ var ProStep = function ProStep(_ref) {
23
23
  var _useState = useState({}),
24
24
  _useState2 = _slicedToArray(_useState, 2),
25
25
  reRender = _useState2[1];
26
- var _useSetState = useSetState({}),
26
+ var _useSetState = useSetState({
27
+ errorCollection: {}
28
+ }),
27
29
  _useSetState2 = _slicedToArray(_useSetState, 2),
28
- errorCollection = _useSetState2[0],
29
- setErrorCollection = _useSetState2[1];
30
+ errorCollection = _useSetState2[0].errorCollection,
31
+ setState = _useSetState2[1];
30
32
  // 注册子节点id与title映射的集合
31
33
  var registerMap = useRef({});
32
34
  var _useLocalStorageState = useLocalStorageState('cache-pro-step'),
@@ -71,8 +73,10 @@ var ProStep = function ProStep(_ref) {
71
73
  title = _ref4.title,
72
74
  validator = _ref4.validator,
73
75
  order = _ref4.order,
74
- disabled = _ref4.disabled;
76
+ disabled = _ref4.disabled,
77
+ lazyLoad = _ref4.lazyLoad;
75
78
  var record = {};
79
+ record.id = id;
76
80
  record.title = title;
77
81
  record.order = order;
78
82
  if (!registerMap.current[id]) {
@@ -155,7 +159,9 @@ var ProStep = function ProStep(_ref) {
155
159
  errorFields = _ref8.errorFields;
156
160
  nextErrorCollection[id] = (errorFields === null || errorFields === void 0 ? void 0 : errorFields.length) || 0;
157
161
  });
158
- setErrorCollection(nextErrorCollection);
162
+ setState({
163
+ errorCollection: nextErrorCollection
164
+ });
159
165
  return _context2.abrupt("return", res);
160
166
  case 11:
161
167
  case "end":
@@ -190,7 +196,9 @@ var ProStep = function ProStep(_ref) {
190
196
  nextErrorCollection[keys[index]] = item === null || item === void 0 ? void 0 : (_item$errorFields2 = item.errorFields) === null || _item$errorFields2 === void 0 ? void 0 : _item$errorFields2.length;
191
197
  }
192
198
  });
193
- setErrorCollection(nextErrorCollection);
199
+ setState({
200
+ errorCollection: nextErrorCollection
201
+ });
194
202
  return _context3.abrupt("return", result);
195
203
  case 9:
196
204
  case "end":
@@ -220,6 +228,7 @@ var ProStep = function ProStep(_ref) {
220
228
  }, [errorCollection, dataSource]);
221
229
  return _jsx(ProStepContext.Provider, {
222
230
  value: {
231
+ registerMap: registerMap,
223
232
  collapse: collapse,
224
233
  register: register,
225
234
  notify: notify,
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { LazyLoadProps } from 'react-lazyload';
2
3
  export interface ItemType {
3
4
  name: string;
4
5
  code: string;
@@ -22,10 +23,12 @@ export interface ProStepPropsType {
22
23
  /** @name 是否滚动到第一个报错 */
23
24
  scrollToError?: boolean;
24
25
  }
25
- export interface ProStepItem {
26
+ export interface ProStepItemPropsType {
26
27
  id: string;
27
28
  title?: string;
28
29
  collapse?: boolean;
29
30
  order?: number;
31
+ /** 模块可视区域懒加载 */
32
+ lazyLoad?: boolean | LazyLoadProps;
30
33
  [key: string]: any;
31
34
  }
@@ -8,8 +8,8 @@ exports.default = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
- var _antd = require("antd");
12
11
  var _react = require("react");
12
+ var _antd = require("antd");
13
13
  var _excluded = ["tableProps"];
14
14
  var BaseTable = function BaseTable(_ref) {
15
15
  var _value$;
@@ -33,7 +33,8 @@ var BaseTable = function BaseTable(_ref) {
33
33
  page = tableProps.page,
34
34
  formatMessage = tableProps.formatMessage,
35
35
  locale = tableProps.locale,
36
- handlePageChange = tableProps.handlePageChange;
36
+ handlePageChange = tableProps.handlePageChange,
37
+ pageErrorNum = tableProps.pageErrorNum;
37
38
  return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
38
39
  children: [headerRender ? (0, _jsxRuntime.jsx)("div", {
39
40
  className: "pro-edit-table-header",
@@ -67,6 +68,14 @@ var BaseTable = function BaseTable(_ref) {
67
68
  total: total
68
69
  });
69
70
  },
71
+ itemRender: function itemRender(index, type, originalElement) {
72
+ return type === 'page' && page.pageNum === index && pageErrorNum ? (0, _jsxRuntime.jsxs)("div", {
73
+ className: "pro-edit-table-pagination-item-badge",
74
+ children: [(0, _jsxRuntime.jsx)(_antd.Badge, {
75
+ count: pageErrorNum
76
+ }), originalElement]
77
+ }) : originalElement;
78
+ },
70
79
  onChange: handlePageChange
71
80
  }, pagination) : false,
72
81
  rowKey: "rowKey",
@@ -1,6 +1,3 @@
1
- import React from 'react';
2
- declare const _default: React.MemoExoticComponent<({ tableProps, ...resetProps }: {
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,172 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.default = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
7
  var _jsxRuntime = require("react/jsx-runtime");
12
- var _antd = require("antd");
13
8
  var _react = require("react");
14
- var _classnames = _interopRequireDefault(require("classnames"));
15
- var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer"));
16
- var _reactWindow = require("react-window");
17
- var _excluded = ["tableProps"];
18
- var VirtualTable = function VirtualTable(_ref) {
19
- var _value$;
20
- var tableProps = _ref.tableProps,
21
- resetProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
22
- var value = tableProps.value,
23
- headerRender = tableProps.headerRender,
24
- tableRef = tableProps.tableRef,
25
- className = tableProps.className,
26
- columns = tableProps.columns,
27
- renderRowSelection = tableProps.renderRowSelection,
28
- rowClassName = tableProps.rowClassName,
29
- disabled = tableProps.disabled,
30
- virtualKey = tableProps.virtualKey,
31
- editingKeys = tableProps.editingKeys,
32
- isHideCheckBox = tableProps.isHideCheckBox,
33
- rowDraggable = tableProps.rowDraggable,
34
- scroll = tableProps.scroll,
35
- summary = tableProps.summary;
36
- var _useState = (0, _react.useState)(0),
37
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
38
- tableWidth = _useState2[0],
39
- setTableWidth = _useState2[1];
40
- var widthColumnCount = columns.filter(function (_ref2) {
41
- var width = _ref2.width;
42
- return !width;
43
- }).length;
44
- var mergedColumns = columns.map(function (column) {
45
- if (column.width) {
46
- return column;
47
- }
48
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, column), {}, {
49
- width: Math.floor(tableWidth / widthColumnCount)
50
- });
51
- });
52
- var gridRef = (0, _react.useRef)();
53
- var _useState3 = (0, _react.useState)(function () {
54
- var obj = {};
55
- Object.defineProperty(obj, 'scrollLeft', {
56
- get: function get() {
57
- if (gridRef.current) {
58
- var _gridRef$current, _gridRef$current$stat;
59
- 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;
60
- }
61
- return null;
62
- },
63
- set: function set(scrollLeft) {
64
- if (gridRef.current) {
65
- gridRef.current.scrollTo({
66
- scrollLeft: scrollLeft
67
- });
68
- }
69
- }
70
- });
71
- return obj;
72
- }),
73
- _useState4 = (0, _slicedToArray2.default)(_useState3, 1),
74
- connectObject = _useState4[0];
75
- var resetVirtualGrid = function resetVirtualGrid() {
76
- var _gridRef$current2;
77
- (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.resetAfterIndices({
78
- columnIndex: 0,
79
- shouldForceUpdate: true
80
- });
81
- };
82
- (0, _react.useEffect)(function () {
83
- return resetVirtualGrid;
84
- }, [tableWidth]);
85
- var renderVirtualList = function renderVirtualList(rawData, _ref3) {
86
- var scrollbarSize = _ref3.scrollbarSize,
87
- ref = _ref3.ref,
88
- _onScroll = _ref3.onScroll;
89
- ref.current = connectObject;
90
- var totalHeight = rawData.length * 54;
91
- return (0, _jsxRuntime.jsx)(_reactWindow.VariableSizeGrid, {
92
- ref: gridRef,
93
- className: "virtual-grid",
94
- columnCount: mergedColumns.length,
95
- columnWidth: function columnWidth(index) {
96
- var _width2;
97
- var width = mergedColumns[index].width;
98
- var _width = width;
99
- if (typeof _width === 'string' && ((_width2 = _width) === null || _width2 === void 0 ? void 0 : _width2.includes('px'))) {
100
- _width = parseInt(width, 10);
101
- }
102
- return totalHeight > scroll.y && index === mergedColumns.length - 1 ? _width - scrollbarSize - 1 : _width;
103
- },
104
- height: scroll.y,
105
- rowCount: rawData.length,
106
- rowHeight: function rowHeight() {
107
- return 54;
108
- },
109
- width: tableWidth,
110
- onScroll: function onScroll(_ref4) {
111
- var scrollLeft = _ref4.scrollLeft;
112
- _onScroll({
113
- scrollLeft: scrollLeft
114
- });
115
- },
116
- children: function children(_ref5) {
117
- var columnIndex = _ref5.columnIndex,
118
- rowIndex = _ref5.rowIndex,
119
- style = _ref5.style;
120
- return (0, _jsxRuntime.jsx)("div", {
121
- className: (0, _classnames.default)('virtual-table-cell', {
122
- 'virtual-table-cell-last': columnIndex === mergedColumns.length - 1
123
- }),
124
- style: style,
125
- children: rawData[rowIndex][mergedColumns[columnIndex].dataIndex]
126
- });
127
- }
128
- });
129
- };
130
- return (0, _jsxRuntime.jsxs)(_rcResizeObserver.default, {
131
- onResize: function onResize(_ref6) {
132
- var _width3;
133
- var width = _ref6.width;
134
- var _width = width;
135
- if (typeof _width === 'string' && ((_width3 = _width) === null || _width3 === void 0 ? void 0 : _width3.includes('px'))) {
136
- _width = parseInt(width, 10);
137
- }
138
- setTableWidth(_width);
139
- },
140
- children: [headerRender ? (0, _jsxRuntime.jsx)("div", {
141
- className: "pro-edit-table-header",
142
- children: typeof headerRender === 'function' ? headerRender() : headerRender
143
- }) : null, (0, _jsxRuntime.jsx)(_antd.Table, (0, _objectSpread2.default)((0, _objectSpread2.default)({
144
- ref: tableRef,
145
- className: className,
146
- dataSource: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value : undefined,
147
- columns: mergedColumns,
148
- rowSelection: renderRowSelection(),
149
- rowClassName: rowClassName,
150
- components: {
151
- body: renderVirtualList
152
- },
153
- onRow: function onRow() {
154
- return {
155
- disabled: disabled || virtualKey && !!editingKeys.length,
156
- 'data-hide': isHideCheckBox,
157
- 'data-row-draggable': rowDraggable,
158
- onClick: function onClick() {}
159
- };
160
- }
161
- }, resetProps), {}, {
162
- pagination: false,
163
- rowKey: "rowKey",
164
- scroll: {
165
- x: scroll === null || scroll === void 0 ? void 0 : scroll.x,
166
- y: (value === null || value === void 0 ? void 0 : value.length) ? scroll === null || scroll === void 0 ? void 0 : scroll.y : undefined
167
- },
168
- summary: summary
169
- }))]
9
+ var VirtualTable = function VirtualTable() {
10
+ return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
11
+ children: "\u6682\u65F6\u4E0D\u4F7F\u7528\uFF0C\u53EF\u4EE5\u7B49\u5347\u7EA7antd5\u4F7F\u7528\u5BF9\u5E94\u7684\u80FD\u529B"
170
12
  });
171
13
  };
172
14
  var _default = exports.default = /*#__PURE__*/(0, _react.memo)(VirtualTable);
@@ -2,5 +2,5 @@
2
2
  export { default as BaseTable } from './BaseTable';
3
3
  /** 拖拽表格 */
4
4
  export { default as DraggableTable } from './DraggableTable';
5
- /** 虚拟列表表格 */
5
+ /** 虚拟列表表格, 暂时移除 */
6
6
  export { default as VirtualTable } from './VirtualTable';
@@ -101,8 +101,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
101
101
  virtualKey: type === 'single' || mode === 'single' ? (0, _tools.getRandom)() : '',
102
102
  page: {
103
103
  pageNum: 1,
104
- pageSize: 10
105
- }
104
+ pageSize: (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || 10
105
+ },
106
+ pageErrorNum: 0
106
107
  }),
107
108
  _useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
108
109
  state = _useSetState2[0],
@@ -113,7 +114,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
113
114
  virtualKey = state.virtualKey,
114
115
  selectedRowKeys = state.selectedRowKeys,
115
116
  selectedRows = state.selectedRows,
116
- page = state.page;
117
+ page = state.page,
118
+ pageErrorNum = state.pageErrorNum;
117
119
  var virtualRowName = (0, _tools.getNamePath)((0, _lodash.isArray)(name) ? name : [name], virtualKey);
118
120
  // 样式处理
119
121
  var _className = (0, _classnames.default)({
@@ -414,6 +416,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
414
416
  page: page,
415
417
  formatMessage: _locale.formatMessage,
416
418
  locale: _locale.default,
419
+ pageErrorNum: pageErrorNum,
417
420
  handlePageChange: handlePageChange
418
421
  }
419
422
  })), !isView && (value === null || value === void 0 ? void 0 : value.length) ? toolbarSticky ? (0, _jsxRuntime.jsx)(_antd.Affix, (0, _objectSpread2.default)((0, _objectSpread2.default)({
@@ -429,6 +432,19 @@ var ProEditTable = function ProEditTable(_ref, ref) {
429
432
  }) : null, footerRender ? (0, _jsxRuntime.jsx)("div", {
430
433
  className: "pro-edit-table-footer",
431
434
  children: footerRender
435
+ }) : null, pagination ? (0, _jsxRuntime.jsx)("div", {
436
+ id: "pro-edit-table-pagination",
437
+ onClick: function onClick() {
438
+ (0, _tools.onPageCheck)({
439
+ form: form,
440
+ name: name,
441
+ value: value,
442
+ columns: columns,
443
+ page: page,
444
+ pagination: pagination,
445
+ setState: setState
446
+ });
447
+ }
432
448
  }) : null]
433
449
  }), (0, _jsxRuntime.jsx)(_components.Validator, {
434
450
  name: name,
@@ -124,6 +124,7 @@ export interface State {
124
124
  pageNum: number;
125
125
  pageSize: number;
126
126
  };
127
+ pageErrorNum: number;
127
128
  }
128
129
  export interface ProEditTableRefProps {
129
130
  getInternalState: () => State;
@@ -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>;