@zat-design/sisyphus-react 3.11.4-beta.4 → 3.11.4-beta.5
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.
@@ -8,12 +8,10 @@ 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: 300,
|
12
12
|
offset: 100,
|
13
13
|
once: true // Load only once upon first entry into the viewport
|
14
14
|
};
|
15
|
-
// 设置step队列
|
16
|
-
var loadedMap = [];
|
17
15
|
var ProStepItem = function ProStepItem(_ref) {
|
18
16
|
var id = _ref.id,
|
19
17
|
title = _ref.title,
|
@@ -25,8 +23,7 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
25
23
|
var _useStep = useStep(),
|
26
24
|
register = _useStep.register,
|
27
25
|
collapse = _useStep.collapse,
|
28
|
-
globalLazyLoad = _useStep.lazyLoad
|
29
|
-
registerMap = _useStep.registerMap;
|
26
|
+
globalLazyLoad = _useStep.lazyLoad;
|
30
27
|
var lazyLoad = stepLazyLoad || globalLazyLoad;
|
31
28
|
useEffect(function () {
|
32
29
|
// Schedule registration to avoid re-render issues
|
@@ -39,24 +36,10 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
39
36
|
}, 0);
|
40
37
|
return function () {
|
41
38
|
clearTimeout(timeoutId);
|
42
|
-
// 清空loadedMap
|
43
|
-
loadedMap.length = 0;
|
44
39
|
};
|
45
40
|
}, [id, title, lazyLoad, restProps, register]);
|
46
41
|
var renderChildren = function renderChildren() {
|
47
|
-
if (
|
48
|
-
loadedMap.push({
|
49
|
-
id: id,
|
50
|
-
title: title
|
51
|
-
});
|
52
|
-
return children;
|
53
|
-
}
|
54
|
-
// 第一个step不设置lasyload,防止懒加载不生效
|
55
|
-
if (lazyLoad && (loadedMap === null || loadedMap === void 0 ? void 0 : loadedMap.length)) {
|
56
|
-
loadedMap.push({
|
57
|
-
id: id,
|
58
|
-
title: title
|
59
|
-
});
|
42
|
+
if (lazyLoad) {
|
60
43
|
var lazyLoadProps = isBoolean(lazyLoad) ? defaultLazyLoadConfig : lazyLoad;
|
61
44
|
return _jsx(LazyLoad, _objectSpread(_objectSpread({}, lazyLoadProps), {}, {
|
62
45
|
classNamePrefix: id,
|
@@ -15,12 +15,10 @@ var _index = require("../../index");
|
|
15
15
|
var _ProCollapse = _interopRequireDefault(require("../../../ProLayout/components/ProCollapse"));
|
16
16
|
var _excluded = ["id", "title", "collapse", "children", "lazyLoad"];
|
17
17
|
var defaultLazyLoadConfig = {
|
18
|
-
height:
|
18
|
+
height: 300,
|
19
19
|
offset: 100,
|
20
20
|
once: true // Load only once upon first entry into the viewport
|
21
21
|
};
|
22
|
-
// 设置step队列
|
23
|
-
var loadedMap = [];
|
24
22
|
var ProStepItem = function ProStepItem(_ref) {
|
25
23
|
var id = _ref.id,
|
26
24
|
title = _ref.title,
|
@@ -32,8 +30,7 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
32
30
|
var _useStep = (0, _index.useStep)(),
|
33
31
|
register = _useStep.register,
|
34
32
|
collapse = _useStep.collapse,
|
35
|
-
globalLazyLoad = _useStep.lazyLoad
|
36
|
-
registerMap = _useStep.registerMap;
|
33
|
+
globalLazyLoad = _useStep.lazyLoad;
|
37
34
|
var lazyLoad = stepLazyLoad || globalLazyLoad;
|
38
35
|
(0, _react.useEffect)(function () {
|
39
36
|
// Schedule registration to avoid re-render issues
|
@@ -46,24 +43,10 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
46
43
|
}, 0);
|
47
44
|
return function () {
|
48
45
|
clearTimeout(timeoutId);
|
49
|
-
// 清空loadedMap
|
50
|
-
loadedMap.length = 0;
|
51
46
|
};
|
52
47
|
}, [id, title, lazyLoad, restProps, register]);
|
53
48
|
var renderChildren = function renderChildren() {
|
54
|
-
if (
|
55
|
-
loadedMap.push({
|
56
|
-
id: id,
|
57
|
-
title: title
|
58
|
-
});
|
59
|
-
return children;
|
60
|
-
}
|
61
|
-
// 第一个step不设置lasyload,防止懒加载不生效
|
62
|
-
if (lazyLoad && (loadedMap === null || loadedMap === void 0 ? void 0 : loadedMap.length)) {
|
63
|
-
loadedMap.push({
|
64
|
-
id: id,
|
65
|
-
title: title
|
66
|
-
});
|
49
|
+
if (lazyLoad) {
|
67
50
|
var lazyLoadProps = (0, _lodash.isBoolean)(lazyLoad) ? defaultLazyLoadConfig : lazyLoad;
|
68
51
|
return (0, _jsxRuntime.jsx)(_reactLazyload.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, lazyLoadProps), {}, {
|
69
52
|
classNamePrefix: id,
|