@zat-design/sisyphus-react 3.11.4-beta.4 → 3.11.4-beta.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.
@@ -36,7 +36,8 @@ var ProCollapse = function ProCollapse(props) {
|
|
36
36
|
className = props.className,
|
37
37
|
icon = props.icon,
|
38
38
|
_props$autoHeight = props.autoHeight,
|
39
|
-
autoHeight = _props$autoHeight === void 0 ? true : _props$autoHeight
|
39
|
+
autoHeight = _props$autoHeight === void 0 ? true : _props$autoHeight,
|
40
|
+
onChange = props.onChange;
|
40
41
|
var cls = classNames(_defineProperty({
|
41
42
|
'pro-collapse': true,
|
42
43
|
'pro-collapse-level2': level === '2',
|
@@ -154,7 +155,8 @@ var ProCollapse = function ProCollapse(props) {
|
|
154
155
|
});
|
155
156
|
},
|
156
157
|
expandIconPosition: "end",
|
157
|
-
defaultActiveKey: folding ? [] : ['1']
|
158
|
+
defaultActiveKey: folding ? [] : ['1'],
|
159
|
+
onChange: onChange
|
158
160
|
}, collapseProps), {}, {
|
159
161
|
children: renderPanel()
|
160
162
|
}))
|
@@ -3,17 +3,15 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
3
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';
|
6
|
+
import LazyLoad, { forceCheck } from 'react-lazyload';
|
7
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: 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,
|
@@ -74,6 +57,14 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
74
57
|
title: title,
|
75
58
|
icon: true
|
76
59
|
}, restProps), {}, {
|
60
|
+
onChange: function onChange(e) {
|
61
|
+
var _restProps$onChange;
|
62
|
+
if (lazyLoad) {
|
63
|
+
forceCheck();
|
64
|
+
}
|
65
|
+
// 默认执行
|
66
|
+
restProps === null || restProps === void 0 ? void 0 : (_restProps$onChange = restProps.onChange) === null || _restProps$onChange === void 0 ? void 0 : _restProps$onChange.call(restProps, e);
|
67
|
+
},
|
77
68
|
children: renderChildren()
|
78
69
|
}))
|
79
70
|
});
|
@@ -38,7 +38,8 @@ var ProCollapse = function ProCollapse(props) {
|
|
38
38
|
className = props.className,
|
39
39
|
icon = props.icon,
|
40
40
|
_props$autoHeight = props.autoHeight,
|
41
|
-
autoHeight = _props$autoHeight === void 0 ? true : _props$autoHeight
|
41
|
+
autoHeight = _props$autoHeight === void 0 ? true : _props$autoHeight,
|
42
|
+
onChange = props.onChange;
|
42
43
|
var cls = (0, _classnames.default)((0, _defineProperty2.default)({
|
43
44
|
'pro-collapse': true,
|
44
45
|
'pro-collapse-level2': level === '2',
|
@@ -156,7 +157,8 @@ var ProCollapse = function ProCollapse(props) {
|
|
156
157
|
});
|
157
158
|
},
|
158
159
|
expandIconPosition: "end",
|
159
|
-
defaultActiveKey: folding ? [] : ['1']
|
160
|
+
defaultActiveKey: folding ? [] : ['1'],
|
161
|
+
onChange: onChange
|
160
162
|
}, collapseProps), {}, {
|
161
163
|
children: renderPanel()
|
162
164
|
}))
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
@@ -9,18 +10,16 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
11
12
|
var _react = require("react");
|
12
|
-
var _reactLazyload =
|
13
|
+
var _reactLazyload = _interopRequireWildcard(require("react-lazyload"));
|
13
14
|
var _lodash = require("lodash");
|
14
15
|
var _index = require("../../index");
|
15
16
|
var _ProCollapse = _interopRequireDefault(require("../../../ProLayout/components/ProCollapse"));
|
16
17
|
var _excluded = ["id", "title", "collapse", "children", "lazyLoad"];
|
17
18
|
var defaultLazyLoadConfig = {
|
18
|
-
height:
|
19
|
+
height: 300,
|
19
20
|
offset: 100,
|
20
21
|
once: true // Load only once upon first entry into the viewport
|
21
22
|
};
|
22
|
-
// 设置step队列
|
23
|
-
var loadedMap = [];
|
24
23
|
var ProStepItem = function ProStepItem(_ref) {
|
25
24
|
var id = _ref.id,
|
26
25
|
title = _ref.title,
|
@@ -32,8 +31,7 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
32
31
|
var _useStep = (0, _index.useStep)(),
|
33
32
|
register = _useStep.register,
|
34
33
|
collapse = _useStep.collapse,
|
35
|
-
globalLazyLoad = _useStep.lazyLoad
|
36
|
-
registerMap = _useStep.registerMap;
|
34
|
+
globalLazyLoad = _useStep.lazyLoad;
|
37
35
|
var lazyLoad = stepLazyLoad || globalLazyLoad;
|
38
36
|
(0, _react.useEffect)(function () {
|
39
37
|
// Schedule registration to avoid re-render issues
|
@@ -46,24 +44,10 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
46
44
|
}, 0);
|
47
45
|
return function () {
|
48
46
|
clearTimeout(timeoutId);
|
49
|
-
// 清空loadedMap
|
50
|
-
loadedMap.length = 0;
|
51
47
|
};
|
52
48
|
}, [id, title, lazyLoad, restProps, register]);
|
53
49
|
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
|
-
});
|
50
|
+
if (lazyLoad) {
|
67
51
|
var lazyLoadProps = (0, _lodash.isBoolean)(lazyLoad) ? defaultLazyLoadConfig : lazyLoad;
|
68
52
|
return (0, _jsxRuntime.jsx)(_reactLazyload.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, lazyLoadProps), {}, {
|
69
53
|
classNamePrefix: id,
|
@@ -81,6 +65,14 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
81
65
|
title: title,
|
82
66
|
icon: true
|
83
67
|
}, restProps), {}, {
|
68
|
+
onChange: function onChange(e) {
|
69
|
+
var _restProps$onChange;
|
70
|
+
if (lazyLoad) {
|
71
|
+
(0, _reactLazyload.forceCheck)();
|
72
|
+
}
|
73
|
+
// 默认执行
|
74
|
+
restProps === null || restProps === void 0 ? void 0 : (_restProps$onChange = restProps.onChange) === null || _restProps$onChange === void 0 ? void 0 : _restProps$onChange.call(restProps, e);
|
75
|
+
},
|
84
76
|
children: renderChildren()
|
85
77
|
}))
|
86
78
|
});
|