@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
@@ -5,10 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.cloneDeepFilterNode = cloneDeepFilterNode;
8
- exports.splitNames = exports.onDelete = exports.handleScrollToError = exports.getRandom = exports.getNamePath = exports.getDisabled = exports.difference = exports.customValidate = void 0;
8
+ exports.splitNames = exports.onPageCheck = exports.onDelete = exports.handleScrollToError = exports.getRandom = exports.getNamePath = exports.getDisabled = exports.difference = exports.customValidate = void 0;
9
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
10
+ var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
13
  var _react = _interopRequireDefault(require("react"));
14
+ var _utils = require("@zat-design/utils");
11
15
  var _lodash = require("lodash");
16
+ /* eslint-disable no-await-in-loop */
17
+ /* eslint-disable no-restricted-syntax */
18
+
12
19
  var getRandom = exports.getRandom = function getRandom() {
13
20
  return Math.random().toString(36).slice(-6);
14
21
  };
@@ -218,4 +225,273 @@ function cloneDeepFilterNode(value) {
218
225
  return val;
219
226
  }
220
227
  });
221
- }
228
+ }
229
+ var _isNull = function isNull(value) {
230
+ if (Array.isArray(value) && value.length) {
231
+ return value.some(function (item) {
232
+ return _isNull(item);
233
+ });
234
+ }
235
+ return value === '' || value === undefined || value === null || Array.isArray(value) && value.length === 0;
236
+ };
237
+ var handleCheckCellValue = /*#__PURE__*/function () {
238
+ var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(column, record) {
239
+ var _column$names, _column$names2, _rules2;
240
+ var value, _required, _rules, _labelRequired, res, _iterator, _step, rule;
241
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
242
+ while (1) switch (_context.prev = _context.next) {
243
+ case 0:
244
+ value = null;
245
+ if (column.name) {
246
+ value = (0, _lodash.get)(record, column.name);
247
+ }
248
+ if ((_column$names = column.names) === null || _column$names === void 0 ? void 0 : _column$names.length) {
249
+ value = column.names.map(function (key) {
250
+ return (0, _lodash.get)(record, key);
251
+ });
252
+ }
253
+ _required = column.required;
254
+ _rules = column.rules;
255
+ _labelRequired = column.labelRequired;
256
+ if ((0, _lodash.isFunction)(column.required)) {
257
+ _required = column.required(value, record);
258
+ }
259
+ if ((0, _lodash.isFunction)(column.rules)) {
260
+ _rules = column.rules(value, record);
261
+ }
262
+ if ((0, _lodash.isFunction)(column.labelRequired)) {
263
+ _labelRequired = column.labelRequired(value, record);
264
+ }
265
+ if (!(((_column$names2 = column.names) === null || _column$names2 === void 0 ? void 0 : _column$names2.length) && _labelRequired !== null && _labelRequired !== undefined && _isNull(value))) {
266
+ _context.next = 11;
267
+ break;
268
+ }
269
+ return _context.abrupt("return", false);
270
+ case 11:
271
+ if (!(_required && _isNull(value))) {
272
+ _context.next = 13;
273
+ break;
274
+ }
275
+ return _context.abrupt("return", false);
276
+ case 13:
277
+ if (!((_rules2 = _rules) === null || _rules2 === void 0 ? void 0 : _rules2.length)) {
278
+ _context.next = 44;
279
+ break;
280
+ }
281
+ res = true;
282
+ _iterator = (0, _createForOfIteratorHelper2.default)(_rules);
283
+ _context.prev = 16;
284
+ _iterator.s();
285
+ case 18:
286
+ if ((_step = _iterator.n()).done) {
287
+ _context.next = 35;
288
+ break;
289
+ }
290
+ rule = _step.value;
291
+ if (res) {
292
+ _context.next = 22;
293
+ break;
294
+ }
295
+ return _context.abrupt("break", 35);
296
+ case 22:
297
+ if (rule.required && _isNull(value)) {
298
+ res = false;
299
+ }
300
+ if (!(0, _lodash.isFunction)(rule.validator)) {
301
+ _context.next = 32;
302
+ break;
303
+ }
304
+ _context.prev = 24;
305
+ _context.next = 27;
306
+ return rule.validator('', value);
307
+ case 27:
308
+ _context.next = 32;
309
+ break;
310
+ case 29:
311
+ _context.prev = 29;
312
+ _context.t0 = _context["catch"](24);
313
+ res = false;
314
+ case 32:
315
+ if (rule.type && !_utils.validate[rule.type](value)) {
316
+ res = false;
317
+ }
318
+ case 33:
319
+ _context.next = 18;
320
+ break;
321
+ case 35:
322
+ _context.next = 40;
323
+ break;
324
+ case 37:
325
+ _context.prev = 37;
326
+ _context.t1 = _context["catch"](16);
327
+ _iterator.e(_context.t1);
328
+ case 40:
329
+ _context.prev = 40;
330
+ _iterator.f();
331
+ return _context.finish(40);
332
+ case 43:
333
+ return _context.abrupt("return", res);
334
+ case 44:
335
+ return _context.abrupt("return", true);
336
+ case 45:
337
+ case "end":
338
+ return _context.stop();
339
+ }
340
+ }, _callee, null, [[16, 37, 40, 43], [24, 29]]);
341
+ }));
342
+ return function handleCheckCellValue(_x, _x2) {
343
+ return _ref6.apply(this, arguments);
344
+ };
345
+ }();
346
+ var onPageCheck = exports.onPageCheck = /*#__PURE__*/function () {
347
+ 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;
349
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
350
+ while (1) switch (_context2.prev = _context2.next) {
351
+ 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) {
354
+ _context2.next = 75;
355
+ break;
356
+ }
357
+ pageNum = page.pageNum, pageSize = page.pageSize;
358
+ pageArr = Array.from({
359
+ length: Math.ceil(_utils.tools.calc(value.length, '/', pageSize))
360
+ }, function (_, i) {
361
+ return i + 1;
362
+ });
363
+ flag = false;
364
+ errorNum = 0;
365
+ errorPageNum = 0;
366
+ _i = 0, _pageArr = pageArr;
367
+ case 8:
368
+ if (!(_i < _pageArr.length)) {
369
+ _context2.next = 60;
370
+ break;
371
+ }
372
+ item = _pageArr[_i];
373
+ if (!flag) {
374
+ _context2.next = 12;
375
+ break;
376
+ }
377
+ return _context2.abrupt("break", 60);
378
+ case 12:
379
+ errorNum = 0;
380
+ // 实现思路:截取每一页数据,手动触发每一行数据的校验,通过column配置的rule规则,
381
+ // 依次校验每一页数据,有错误就跳出循环,跳转到错误页数,并展示错误单元格数量
382
+ start = _utils.tools.calc(item - 1, '*', pageSize);
383
+ end = _utils.tools.calc(start, '+', pageSize);
384
+ nextValues = value === null || value === void 0 ? void 0 : value.slice(start, end);
385
+ _iterator2 = (0, _createForOfIteratorHelper2.default)(nextValues);
386
+ _context2.prev = 17;
387
+ _iterator2.s();
388
+ case 19:
389
+ if ((_step2 = _iterator2.n()).done) {
390
+ _context2.next = 48;
391
+ break;
392
+ }
393
+ record = _step2.value;
394
+ _iterator3 = (0, _createForOfIteratorHelper2.default)(columns);
395
+ _context2.prev = 22;
396
+ _iterator3.s();
397
+ case 24:
398
+ if ((_step3 = _iterator3.n()).done) {
399
+ _context2.next = 38;
400
+ break;
401
+ }
402
+ column = _step3.value;
403
+ _context2.prev = 26;
404
+ _context2.next = 29;
405
+ return handleCheckCellValue(column, record);
406
+ case 29:
407
+ result = _context2.sent;
408
+ if (!result) {
409
+ errorNum += 1;
410
+ }
411
+ _context2.next = 36;
412
+ break;
413
+ case 33:
414
+ _context2.prev = 33;
415
+ _context2.t0 = _context2["catch"](26);
416
+ errorNum += 1;
417
+ case 36:
418
+ _context2.next = 24;
419
+ break;
420
+ case 38:
421
+ _context2.next = 43;
422
+ break;
423
+ case 40:
424
+ _context2.prev = 40;
425
+ _context2.t1 = _context2["catch"](22);
426
+ _iterator3.e(_context2.t1);
427
+ case 43:
428
+ _context2.prev = 43;
429
+ _iterator3.f();
430
+ return _context2.finish(43);
431
+ case 46:
432
+ _context2.next = 19;
433
+ break;
434
+ case 48:
435
+ _context2.next = 53;
436
+ break;
437
+ case 50:
438
+ _context2.prev = 50;
439
+ _context2.t2 = _context2["catch"](17);
440
+ _iterator2.e(_context2.t2);
441
+ case 53:
442
+ _context2.prev = 53;
443
+ _iterator2.f();
444
+ return _context2.finish(53);
445
+ case 56:
446
+ if (errorNum > 0) {
447
+ flag = true;
448
+ errorPageNum = item;
449
+ }
450
+ case 57:
451
+ _i++;
452
+ _context2.next = 8;
453
+ break;
454
+ case 60:
455
+ if (!(flag && errorNum > 0)) {
456
+ _context2.next = 74;
457
+ break;
458
+ }
459
+ nextState = {
460
+ pageErrorNum: errorNum > 0 ? errorNum : 0
461
+ };
462
+ if (pageNum !== errorPageNum) {
463
+ nextState.page = {
464
+ pageNum: errorPageNum,
465
+ pageSize: pageSize
466
+ };
467
+ }
468
+ setState(nextState);
469
+ _context2.prev = 64;
470
+ _context2.next = 67;
471
+ return form.validateFields([name], {
472
+ recursive: true
473
+ });
474
+ case 67:
475
+ _context2.next = 72;
476
+ break;
477
+ case 69:
478
+ _context2.prev = 69;
479
+ _context2.t3 = _context2["catch"](64);
480
+ handleScrollToError();
481
+ case 72:
482
+ _context2.next = 75;
483
+ break;
484
+ case 74:
485
+ setState({
486
+ pageErrorNum: 0
487
+ });
488
+ case 75:
489
+ case "end":
490
+ return _context2.stop();
491
+ }
492
+ }, _callee2, null, [[17, 50, 53, 56], [22, 40, 43, 46], [26, 33], [64, 69]]);
493
+ }));
494
+ return function onPageCheck(_x3) {
495
+ return _ref8.apply(this, arguments);
496
+ };
497
+ }();
@@ -52,12 +52,13 @@ var InputNumber = function InputNumber(props) {
52
52
  var _ref2 = _ProForm.default.useFieldProps() || {},
53
53
  isViewCon = _ref2.isView,
54
54
  viewEmpty = _ref2.viewEmpty,
55
- valueType = _ref2.valueType,
55
+ valueTypeCon = _ref2.valueType,
56
56
  viewType = _ref2.viewType,
57
57
  label = _ref2.label;
58
58
  var initialConfig = (0, _ProConfigProvider.useProConfig)('InputNumber');
59
59
  var activateRef = (0, _react.useRef)(false);
60
60
  var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
61
+ var valueType = 'valueType' in props ? props.valueType : valueTypeCon; // 组件可直接接收valueType参数, 优先级高
61
62
  var valueProps = {};
62
63
  var formatter = function formatter(value) {
63
64
  var _props$precision;
@@ -63,6 +63,8 @@ var useForm = exports.useForm = function useForm(originForm, options) {
63
63
  _form$getInternalHook,
64
64
  getFields,
65
65
  fieldsList,
66
+ tablePagination,
67
+ _tablePagination$clic,
66
68
  _error$errorFields,
67
69
  _error$errorFields$,
68
70
  _args = arguments;
@@ -101,14 +103,18 @@ var useForm = exports.useForm = function useForm(originForm, options) {
101
103
  case 11:
102
104
  return _context.abrupt("return", _context.sent);
103
105
  case 12:
104
- _context.next = 14;
106
+ tablePagination = document.querySelector('#pro-edit-table-pagination');
107
+ if (tablePagination) {
108
+ tablePagination === null || tablePagination === void 0 ? void 0 : (_tablePagination$clic = tablePagination.click) === null || _tablePagination$clic === void 0 ? void 0 : _tablePagination$clic.call(tablePagination);
109
+ }
110
+ _context.next = 16;
105
111
  return validateFields.apply(void 0, [nameList].concat(rest)).then(function (values) {
106
112
  return nameList ? values : _getFieldsValue();
107
113
  });
108
- case 14:
114
+ case 16:
109
115
  return _context.abrupt("return", _context.sent);
110
- case 17:
111
- _context.prev = 17;
116
+ case 19:
117
+ _context.prev = 19;
112
118
  _context.t0 = _context["catch"](0);
113
119
  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)) {
114
120
  form.scrollToField((_error$errorFields$ = _context.t0.errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
@@ -118,11 +124,11 @@ var useForm = exports.useForm = function useForm(originForm, options) {
118
124
  }
119
125
  (0, _tools.handleScrollToError)();
120
126
  throw _context.t0;
121
- case 22:
127
+ case 24:
122
128
  case "end":
123
129
  return _context.stop();
124
130
  }
125
- }, _callee, null, [[0, 17]]);
131
+ }, _callee, null, [[0, 19]]);
126
132
  }));
127
133
  return function _validateFields(_x) {
128
134
  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;
@@ -9,40 +9,68 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
11
  var _react = require("react");
12
+ var _reactLazyload = _interopRequireDefault(require("react-lazyload"));
13
+ var _lodash = require("lodash");
12
14
  var _index = require("../../index");
13
15
  var _ProCollapse = _interopRequireDefault(require("../../../ProLayout/components/ProCollapse"));
14
- var _excluded = ["id", "title", "collapse", "children"];
15
- var _default = exports.default = function _default(_ref) {
16
+ var _excluded = ["id", "title", "collapse", "children", "lazyLoad"];
17
+ var defaultLazyLoadConfig = {
18
+ height: 100,
19
+ offset: 100,
20
+ once: true // Load only once upon first entry into the viewport
21
+ };
22
+ function ProStepItem(_ref) {
16
23
  var id = _ref.id,
17
24
  title = _ref.title,
18
25
  _ref$collapse = _ref.collapse,
19
26
  collapseItem = _ref$collapse === void 0 ? true : _ref$collapse,
20
27
  children = _ref.children,
28
+ lazyLoad = _ref.lazyLoad,
21
29
  restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
22
30
  var _useStep = (0, _index.useStep)(),
23
31
  register = _useStep.register,
24
32
  collapse = _useStep.collapse;
25
33
  (0, _react.useEffect)(function () {
26
- // 子组件更新父组件 延迟状态更新,避免重渲染
34
+ // Schedule registration to avoid re-render issues
27
35
  var timeoutId = setTimeout(function () {
28
- register === null || register === void 0 ? void 0 : register((0, _objectSpread2.default)((0, _objectSpread2.default)({}, restProps), {}, {
36
+ register === null || register === void 0 ? void 0 : register((0, _objectSpread2.default)({
37
+ id: id,
29
38
  title: title,
30
- id: id
31
- }));
39
+ lazyLoad: lazyLoad
40
+ }, restProps));
32
41
  }, 0);
33
42
  return function () {
34
43
  return clearTimeout(timeoutId);
35
44
  };
36
- }, [register]);
45
+ }, [id, title, lazyLoad, restProps, register]);
46
+ var renderChildren = function renderChildren() {
47
+ if (lazyLoad) {
48
+ var lazyLoadProps = (0, _lodash.isBoolean)(lazyLoad) ? defaultLazyLoadConfig : lazyLoad;
49
+ return (0, _jsxRuntime.jsx)(_reactLazyload.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, lazyLoadProps), {}, {
50
+ classNamePrefix: id,
51
+ children: children
52
+ }));
53
+ }
54
+ return children;
55
+ };
56
+ // If there's no `register` function or if collapsing is enabled, wrap in ProCollapse
57
+ if (!register || collapse && collapseItem && title) {
58
+ return (0, _jsxRuntime.jsx)("div", {
59
+ className: "pro-step-item",
60
+ id: id,
61
+ children: (0, _jsxRuntime.jsx)(_ProCollapse.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
62
+ title: title,
63
+ icon: true
64
+ }, restProps), {}, {
65
+ children: renderChildren()
66
+ }))
67
+ });
68
+ }
69
+ // Otherwise, just render children
37
70
  return (0, _jsxRuntime.jsx)("div", {
38
71
  className: "pro-step-item",
39
72
  id: id,
40
- children: !register || collapse && collapseItem && title ? (0, _jsxRuntime.jsx)(_ProCollapse.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
41
- id: id,
42
- title: title,
43
- icon: true
44
- }, restProps), {}, {
45
- children: children
46
- })) : children
73
+ children: renderChildren()
47
74
  });
48
- };
75
+ }
76
+ var _default = exports.default = ProStepItem;
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
12
  var _lodash = require("lodash");
13
13
  var _react = _interopRequireDefault(require("react"));
14
14
  var _index = require("../../index");
@@ -33,16 +33,34 @@ var findFirstErrorDom = function findFirstErrorDom() {
33
33
  }
34
34
  return null;
35
35
  };
36
+ var getLoadedMap = function getLoadedMap(registerMap) {
37
+ if (!(registerMap === null || registerMap === void 0 ? void 0 : registerMap.current)) {
38
+ return undefined;
39
+ }
40
+ var stepList = Object.values(registerMap === null || registerMap === void 0 ? void 0 : registerMap.current).map(function (item) {
41
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.pick)(item, ['id', 'order', 'title'])), {}, {
42
+ loaded: !document.querySelector(".".concat(item === null || item === void 0 ? void 0 : item.id, "-placeholder"))
43
+ });
44
+ });
45
+ return stepList;
46
+ };
47
+ // Function to check if all modules are loaded
48
+ var areAllModulesLoaded = function areAllModulesLoaded(data) {
49
+ return data.every(function (item) {
50
+ return (item === null || item === void 0 ? void 0 : item.loaded) === true;
51
+ });
52
+ };
36
53
  var _default = exports.default = function _default(_ref) {
37
54
  var children = _ref.children,
38
55
  delayTime = _ref.delayTime,
39
56
  excludes = _ref.excludes,
40
57
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
41
58
  var _useStep = (0, _index.useStep)(),
42
- notify = _useStep.notify;
59
+ notify = _useStep.notify,
60
+ registerMap = _useStep.registerMap;
43
61
  return /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
44
62
  onClick: (0, _lodash.throttle)(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
45
- var values;
63
+ var values, loadedMap;
46
64
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
47
65
  while (1) switch (_context.prev = _context.next) {
48
66
  case 0:
@@ -53,6 +71,7 @@ var _default = exports.default = function _default(_ref) {
53
71
  });
54
72
  case 3:
55
73
  values = _context.sent;
74
+ loadedMap = getLoadedMap(registerMap);
56
75
  setTimeout(function () {
57
76
  var localData = localStorage.getItem('cache-pro-step');
58
77
  var _ref3 = findFirstErrorDom() || {},
@@ -62,10 +81,10 @@ var _default = exports.default = function _default(_ref) {
62
81
  }
63
82
  if (localData !== 'false') {
64
83
  var _children$props, _children$props$onCli;
65
- 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);
84
+ 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);
66
85
  }
67
86
  }, delayTime !== null && delayTime !== void 0 ? delayTime : 0);
68
- case 5:
87
+ case 6:
69
88
  case "end":
70
89
  return _context.stop();
71
90
  }
@@ -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;
@@ -30,10 +30,12 @@ var ProStep = function ProStep(_ref) {
30
30
  var _useState = (0, _react.useState)({}),
31
31
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
32
32
  reRender = _useState2[1];
33
- var _useSetState = (0, _ahooks.useSetState)({}),
33
+ var _useSetState = (0, _ahooks.useSetState)({
34
+ errorCollection: {}
35
+ }),
34
36
  _useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
35
- errorCollection = _useSetState2[0],
36
- setErrorCollection = _useSetState2[1];
37
+ errorCollection = _useSetState2[0].errorCollection,
38
+ setState = _useSetState2[1];
37
39
  // 注册子节点id与title映射的集合
38
40
  var registerMap = (0, _react.useRef)({});
39
41
  var _useLocalStorageState = (0, _ahooks.useLocalStorageState)('cache-pro-step'),
@@ -78,8 +80,10 @@ var ProStep = function ProStep(_ref) {
78
80
  title = _ref4.title,
79
81
  validator = _ref4.validator,
80
82
  order = _ref4.order,
81
- disabled = _ref4.disabled;
83
+ disabled = _ref4.disabled,
84
+ lazyLoad = _ref4.lazyLoad;
82
85
  var record = {};
86
+ record.id = id;
83
87
  record.title = title;
84
88
  record.order = order;
85
89
  if (!registerMap.current[id]) {
@@ -162,7 +166,9 @@ var ProStep = function ProStep(_ref) {
162
166
  errorFields = _ref8.errorFields;
163
167
  nextErrorCollection[id] = (errorFields === null || errorFields === void 0 ? void 0 : errorFields.length) || 0;
164
168
  });
165
- setErrorCollection(nextErrorCollection);
169
+ setState({
170
+ errorCollection: nextErrorCollection
171
+ });
166
172
  return _context2.abrupt("return", res);
167
173
  case 11:
168
174
  case "end":
@@ -197,7 +203,9 @@ var ProStep = function ProStep(_ref) {
197
203
  nextErrorCollection[keys[index]] = item === null || item === void 0 ? void 0 : (_item$errorFields2 = item.errorFields) === null || _item$errorFields2 === void 0 ? void 0 : _item$errorFields2.length;
198
204
  }
199
205
  });
200
- setErrorCollection(nextErrorCollection);
206
+ setState({
207
+ errorCollection: nextErrorCollection
208
+ });
201
209
  return _context3.abrupt("return", result);
202
210
  case 9:
203
211
  case "end":
@@ -227,6 +235,7 @@ var ProStep = function ProStep(_ref) {
227
235
  }, [errorCollection, dataSource]);
228
236
  return (0, _jsxRuntime.jsx)(ProStepContext.Provider, {
229
237
  value: {
238
+ registerMap: registerMap,
230
239
  collapse: collapse,
231
240
  register: register,
232
241
  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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.10.4",
3
+ "version": "3.11.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -61,16 +61,16 @@
61
61
  "@dnd-kit/utilities": "^3.2.1",
62
62
  "@pansy/react-watermark": "^3.1.13",
63
63
  "@zat-design/utils": "1.1.37",
64
- "ahooks": "3.7.4",
65
- "antd": "4.24.8",
64
+ "ahooks": "3.8.4",
65
+ "antd": "4.24.12",
66
66
  "big.js": "^6.2.1",
67
67
  "classnames": "^2.3.1",
68
68
  "lodash": "^4.17.21",
69
69
  "moment": "^2.29.1",
70
70
  "rc-resize-observer": "^1.4.0",
71
- "react-resizable": "^3.0.4",
72
- "react-svg": "^15.1.7",
73
- "react-window": "^1.8.10"
71
+ "react-lazyload": "^3.2.1",
72
+ "react-resizable": "^3.0.5",
73
+ "react-svg": "^15.1.7"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "antd": "^4.24.8",
@@ -88,6 +88,7 @@
88
88
  "@types/lodash": "^4.14.171",
89
89
  "@types/react": "^17.0.53",
90
90
  "@types/react-dom": "^17.0.0",
91
+ "@types/react-lazyload": "^3.2.3",
91
92
  "@types/react-resizable": "^1.7.4",
92
93
  "@typescript-eslint/eslint-plugin": "4.0.1",
93
94
  "@typescript-eslint/parser": "4.0.1",