@zat-design/sisyphus-react 3.11.4-beta.7 → 3.11.4
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/.vscode/extensions.json +5 -0
- package/dist/index.esm.css +2 -1
- package/dist/less.esm.css +2 -1
- package/es/ProEditTable/style/index.less +2 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +8 -19
- package/es/ProLayout/components/ProCollapse/index.js +2 -4
- package/es/ProStep/components/Item/index.js +10 -13
- package/lib/ProEditTable/style/index.less +2 -1
- package/lib/ProForm/components/combination/ProModalSelect/index.js +6 -17
- package/lib/ProLayout/components/ProCollapse/index.js +2 -4
- package/lib/ProStep/components/Item/index.js +10 -14
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
@@ -4812,7 +4812,8 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
4812
4812
|
margin-left: var(--zaui-space-size-xs, 4px);
|
4813
4813
|
}
|
4814
4814
|
.pro-edit-table-drag table tr th.ant-table-selection-column.ant-table-cell-fix-left {
|
4815
|
-
text-align:
|
4815
|
+
text-align: left;
|
4816
|
+
padding-left: 52px;
|
4816
4817
|
}
|
4817
4818
|
.pro-edit-label {
|
4818
4819
|
display: inline-block;
|
package/dist/less.esm.css
CHANGED
@@ -4812,7 +4812,8 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
4812
4812
|
margin-left: var(--zaui-space-size-xs, 4px);
|
4813
4813
|
}
|
4814
4814
|
.pro-edit-table-drag table tr th.ant-table-selection-column.ant-table-cell-fix-left {
|
4815
|
-
text-align:
|
4815
|
+
text-align: left;
|
4816
|
+
padding-left: 52px;
|
4816
4817
|
}
|
4817
4818
|
.pro-edit-label {
|
4818
4819
|
display: inline-block;
|
@@ -19,15 +19,15 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
19
19
|
import "antd/es/form/style";
|
20
20
|
import _Form from "antd/es/form";
|
21
21
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
22
|
-
var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "afterOpen", "isTooltip", "searchForm", "searchKey", "defaultOne"
|
22
|
+
var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "afterOpen", "isTooltip", "searchForm", "searchKey", "defaultOne"],
|
23
23
|
_excluded2 = ["onOk"],
|
24
24
|
_excluded3 = ["rowKey", "columns", "rowSelection"];
|
25
25
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
26
26
|
import { SearchOutlined } from '@ant-design/icons';
|
27
27
|
import { useDebounceEffect, useDeepCompareEffect, useMount, useSetState } from 'ahooks';
|
28
|
-
import { debounce, isArray, isEqual, isFunction } from 'lodash';
|
28
|
+
import { debounce, isArray, isEqual, isFunction, omit } from 'lodash';
|
29
29
|
import { ReactSVG } from 'react-svg';
|
30
|
-
import React, { forwardRef, useEffect, useImperativeHandle, useMemo
|
30
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useMemo } from 'react';
|
31
31
|
import { ProForm, ProDrawerForm, ProTable, useProConfig, ProSelect } from '../../../../index';
|
32
32
|
import Container from '../../Container';
|
33
33
|
import viewSvg from '../../../../assets/view.svg';
|
@@ -58,7 +58,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
58
58
|
searchForm = props.searchForm,
|
59
59
|
searchKey = props.searchKey,
|
60
60
|
defaultOne = props.defaultOne,
|
61
|
-
otherProps = props.otherProps,
|
62
61
|
restProps = _objectWithoutProperties(props, _excluded);
|
63
62
|
var contentForm = _Form.useFormInstance();
|
64
63
|
if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
|
@@ -106,7 +105,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
106
105
|
columns = _ref4.columns,
|
107
106
|
rowSelection = _ref4.rowSelection,
|
108
107
|
restTableProps = _objectWithoutProperties(_ref4, _excluded3);
|
109
|
-
var preValue = useRef(value);
|
110
108
|
var _useSetState = useSetState({
|
111
109
|
_value: value,
|
112
110
|
isInit: true,
|
@@ -252,7 +250,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
252
250
|
};
|
253
251
|
var handleChangeValue = function handleChangeValue(e) {
|
254
252
|
onChange(e.target.value);
|
255
|
-
preValue.current = e.target.value;
|
256
253
|
if (!readOnly) {
|
257
254
|
setState({
|
258
255
|
_value: e.target.value
|
@@ -261,7 +258,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
261
258
|
};
|
262
259
|
var handleSelectValue = function handleSelectValue(val, option) {
|
263
260
|
onChange(val, option);
|
264
|
-
preValue.current = val;
|
265
261
|
};
|
266
262
|
var handleClick = /*#__PURE__*/function () {
|
267
263
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
@@ -373,7 +369,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
373
369
|
case 14:
|
374
370
|
if (flag) {
|
375
371
|
onChange === null || onChange === void 0 ? void 0 : onChange(labelInValue ? record : getNextValues(record), record);
|
376
|
-
preValue.current = labelInValue ? record : getNextValues(record);
|
377
372
|
// 更新内部展示值
|
378
373
|
setState({
|
379
374
|
_value: record,
|
@@ -502,7 +497,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
502
497
|
nextSelectRowKeys = isMultiple ? value : [value];
|
503
498
|
if (labelInValue) {
|
504
499
|
onChange(_data);
|
505
|
-
preValue.current = _data;
|
506
500
|
}
|
507
501
|
// 更新内部展示值
|
508
502
|
setState({
|
@@ -559,14 +553,10 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
559
553
|
nextSelectRowKeys = isMultiple ? value : [value];
|
560
554
|
if (labelInValue) {
|
561
555
|
onChange(_data2);
|
562
|
-
preValue.current = _data2;
|
563
556
|
} else {
|
564
557
|
onChange(isMultiple ? _data2.map(function (item) {
|
565
558
|
return item[valueKey];
|
566
559
|
}) : _data2[valueKey]);
|
567
|
-
preValue.current = isMultiple ? _data2.map(function (item) {
|
568
|
-
return item[valueKey];
|
569
|
-
}) : _data2[valueKey];
|
570
560
|
}
|
571
561
|
// 更新内部展示值
|
572
562
|
setState({
|
@@ -656,9 +646,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
656
646
|
}
|
657
647
|
}, [JSON.stringify(value), visible, isInit]);
|
658
648
|
useDebounceEffect(function () {
|
659
|
-
if (value && !visible && readOnly
|
649
|
+
if (value && !visible && readOnly) {
|
660
650
|
var _options$some;
|
661
|
-
preValue.current = value;
|
662
651
|
var isHasValue = options === null || options === void 0 ? void 0 : (_options$some = options.some) === null || _options$some === void 0 ? void 0 : _options$some.call(options, function (item) {
|
663
652
|
return item[valueKey] === value;
|
664
653
|
});
|
@@ -730,7 +719,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
730
719
|
size: "small"
|
731
720
|
}) : null,
|
732
721
|
onFocus: function onFocus() {
|
733
|
-
if (useRequest
|
722
|
+
if (useRequest) {
|
734
723
|
var _useRequest$options10;
|
735
724
|
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options10 = useRequest.options) === null || _useRequest$options10 === void 0 ? void 0 : _useRequest$options10.defaultParams) || {};
|
736
725
|
var params = withPagination ? {
|
@@ -757,17 +746,17 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
757
746
|
var nextParams = transformParams ? transformParams(params) : params;
|
758
747
|
run(nextParams);
|
759
748
|
}
|
760
|
-
},
|
749
|
+
}, 1000),
|
761
750
|
style: {
|
762
751
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
763
752
|
}
|
764
|
-
}, restProps)) : _jsx(_Input, _objectSpread({
|
753
|
+
}, omit(restProps, ['otherProps']))) : _jsx(_Input, _objectSpread({
|
765
754
|
value: viewText,
|
766
755
|
onChange: handleChangeValue,
|
767
756
|
disabled: disabled,
|
768
757
|
autoComplete: "off",
|
769
758
|
allowClear: true
|
770
|
-
}, restProps)), isView || disabled ? null : _jsx(_Button, {
|
759
|
+
}, omit(restProps, ['otherProps']))), isView || disabled ? null : _jsx(_Button, {
|
771
760
|
icon: _jsx(ReactSVG, {
|
772
761
|
className: "viewSvg",
|
773
762
|
src: viewSvg,
|
@@ -36,8 +36,7 @@ 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
|
40
|
-
onChange = props.onChange;
|
39
|
+
autoHeight = _props$autoHeight === void 0 ? true : _props$autoHeight;
|
41
40
|
var cls = classNames(_defineProperty({
|
42
41
|
'pro-collapse': true,
|
43
42
|
'pro-collapse-level2': level === '2',
|
@@ -155,8 +154,7 @@ var ProCollapse = function ProCollapse(props) {
|
|
155
154
|
});
|
156
155
|
},
|
157
156
|
expandIconPosition: "end",
|
158
|
-
defaultActiveKey: folding ? [] : ['1']
|
159
|
-
onChange: onChange
|
157
|
+
defaultActiveKey: folding ? [] : ['1']
|
160
158
|
}, collapseProps), {}, {
|
161
159
|
children: renderPanel()
|
162
160
|
}))
|
@@ -3,12 +3,13 @@ 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
|
6
|
+
import LazyLoad from 'react-lazyload';
|
7
7
|
import { isBoolean } from 'lodash';
|
8
8
|
import { useStep } from '../../index';
|
9
|
+
import { getLoadedMap } from '../../utils';
|
9
10
|
import ProCollapse from '../../../ProLayout/components/ProCollapse';
|
10
11
|
var defaultLazyLoadConfig = {
|
11
|
-
height:
|
12
|
+
height: 100,
|
12
13
|
offset: 100,
|
13
14
|
once: true // Load only once upon first entry into the viewport
|
14
15
|
};
|
@@ -23,8 +24,10 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
23
24
|
var _useStep = useStep(),
|
24
25
|
register = _useStep.register,
|
25
26
|
collapse = _useStep.collapse,
|
26
|
-
globalLazyLoad = _useStep.lazyLoad
|
27
|
+
globalLazyLoad = _useStep.lazyLoad,
|
28
|
+
registerMap = _useStep.registerMap;
|
27
29
|
var lazyLoad = stepLazyLoad || globalLazyLoad;
|
30
|
+
var loadedMap = getLoadedMap(registerMap);
|
28
31
|
useEffect(function () {
|
29
32
|
// Schedule registration to avoid re-render issues
|
30
33
|
var timeoutId = setTimeout(function () {
|
@@ -35,11 +38,13 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
35
38
|
}, restProps));
|
36
39
|
}, 0);
|
37
40
|
return function () {
|
38
|
-
clearTimeout(timeoutId);
|
41
|
+
return clearTimeout(timeoutId);
|
39
42
|
};
|
40
43
|
}, [id, title, lazyLoad, restProps, register]);
|
41
44
|
var renderChildren = function renderChildren() {
|
42
|
-
|
45
|
+
var _loadedMap$;
|
46
|
+
// 第一个step不设置lasyload,防止懒加载不生效
|
47
|
+
if (lazyLoad && (loadedMap === null || loadedMap === void 0 ? void 0 : loadedMap.length) && (loadedMap === null || loadedMap === void 0 ? void 0 : (_loadedMap$ = loadedMap[0]) === null || _loadedMap$ === void 0 ? void 0 : _loadedMap$.id) !== id) {
|
43
48
|
var lazyLoadProps = isBoolean(lazyLoad) ? defaultLazyLoadConfig : lazyLoad;
|
44
49
|
return _jsx(LazyLoad, _objectSpread(_objectSpread({}, lazyLoadProps), {}, {
|
45
50
|
classNamePrefix: id,
|
@@ -57,14 +62,6 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
57
62
|
title: title,
|
58
63
|
icon: true
|
59
64
|
}, 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
|
-
},
|
68
65
|
children: renderChildren()
|
69
66
|
}))
|
70
67
|
});
|
@@ -25,7 +25,7 @@ var _Container = _interopRequireDefault(require("../../Container"));
|
|
25
25
|
var _view = _interopRequireDefault(require("../../../../assets/view.svg"));
|
26
26
|
var _useRequestList3 = _interopRequireDefault(require("./hooks/useRequestList"));
|
27
27
|
var _locale = _interopRequireDefault(require("../../../../locale"));
|
28
|
-
var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "afterOpen", "isTooltip", "searchForm", "searchKey", "defaultOne"
|
28
|
+
var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "afterOpen", "isTooltip", "searchForm", "searchKey", "defaultOne"],
|
29
29
|
_excluded2 = ["onOk"],
|
30
30
|
_excluded3 = ["rowKey", "columns", "rowSelection"];
|
31
31
|
var ProModalSelect = function ProModalSelect(props, ref) {
|
@@ -53,7 +53,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
53
53
|
searchForm = props.searchForm,
|
54
54
|
searchKey = props.searchKey,
|
55
55
|
defaultOne = props.defaultOne,
|
56
|
-
otherProps = props.otherProps,
|
57
56
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
58
57
|
var contentForm = _antd.Form.useFormInstance();
|
59
58
|
if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
|
@@ -101,7 +100,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
101
100
|
columns = _ref4.columns,
|
102
101
|
rowSelection = _ref4.rowSelection,
|
103
102
|
restTableProps = (0, _objectWithoutProperties2.default)(_ref4, _excluded3);
|
104
|
-
var preValue = (0, _react.useRef)(value);
|
105
103
|
var _useSetState = (0, _ahooks.useSetState)({
|
106
104
|
_value: value,
|
107
105
|
isInit: true,
|
@@ -247,7 +245,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
247
245
|
};
|
248
246
|
var handleChangeValue = function handleChangeValue(e) {
|
249
247
|
onChange(e.target.value);
|
250
|
-
preValue.current = e.target.value;
|
251
248
|
if (!readOnly) {
|
252
249
|
setState({
|
253
250
|
_value: e.target.value
|
@@ -256,7 +253,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
256
253
|
};
|
257
254
|
var handleSelectValue = function handleSelectValue(val, option) {
|
258
255
|
onChange(val, option);
|
259
|
-
preValue.current = val;
|
260
256
|
};
|
261
257
|
var handleClick = /*#__PURE__*/function () {
|
262
258
|
var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
@@ -368,7 +364,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
368
364
|
case 14:
|
369
365
|
if (flag) {
|
370
366
|
onChange === null || onChange === void 0 ? void 0 : onChange(labelInValue ? record : getNextValues(record), record);
|
371
|
-
preValue.current = labelInValue ? record : getNextValues(record);
|
372
367
|
// 更新内部展示值
|
373
368
|
setState({
|
374
369
|
_value: record,
|
@@ -497,7 +492,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
497
492
|
nextSelectRowKeys = isMultiple ? value : [value];
|
498
493
|
if (labelInValue) {
|
499
494
|
onChange(_data);
|
500
|
-
preValue.current = _data;
|
501
495
|
}
|
502
496
|
// 更新内部展示值
|
503
497
|
setState({
|
@@ -554,14 +548,10 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
554
548
|
nextSelectRowKeys = isMultiple ? value : [value];
|
555
549
|
if (labelInValue) {
|
556
550
|
onChange(_data2);
|
557
|
-
preValue.current = _data2;
|
558
551
|
} else {
|
559
552
|
onChange(isMultiple ? _data2.map(function (item) {
|
560
553
|
return item[valueKey];
|
561
554
|
}) : _data2[valueKey]);
|
562
|
-
preValue.current = isMultiple ? _data2.map(function (item) {
|
563
|
-
return item[valueKey];
|
564
|
-
}) : _data2[valueKey];
|
565
555
|
}
|
566
556
|
// 更新内部展示值
|
567
557
|
setState({
|
@@ -651,9 +641,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
651
641
|
}
|
652
642
|
}, [JSON.stringify(value), visible, isInit]);
|
653
643
|
(0, _ahooks.useDebounceEffect)(function () {
|
654
|
-
if (value && !visible && readOnly
|
644
|
+
if (value && !visible && readOnly) {
|
655
645
|
var _options$some;
|
656
|
-
preValue.current = value;
|
657
646
|
var isHasValue = options === null || options === void 0 ? void 0 : (_options$some = options.some) === null || _options$some === void 0 ? void 0 : _options$some.call(options, function (item) {
|
658
647
|
return item[valueKey] === value;
|
659
648
|
});
|
@@ -725,7 +714,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
725
714
|
size: "small"
|
726
715
|
}) : null,
|
727
716
|
onFocus: function onFocus() {
|
728
|
-
if (useRequest
|
717
|
+
if (useRequest) {
|
729
718
|
var _useRequest$options10;
|
730
719
|
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options10 = useRequest.options) === null || _useRequest$options10 === void 0 ? void 0 : _useRequest$options10.defaultParams) || {};
|
731
720
|
var params = withPagination ? {
|
@@ -752,17 +741,17 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
752
741
|
var nextParams = transformParams ? transformParams(params) : params;
|
753
742
|
run(nextParams);
|
754
743
|
}
|
755
|
-
},
|
744
|
+
}, 1000),
|
756
745
|
style: {
|
757
746
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
758
747
|
}
|
759
|
-
}, restProps)) : (0, _jsxRuntime.jsx)(_antd.Input, (0, _objectSpread3.default)({
|
748
|
+
}, (0, _lodash.omit)(restProps, ['otherProps']))) : (0, _jsxRuntime.jsx)(_antd.Input, (0, _objectSpread3.default)({
|
760
749
|
value: viewText,
|
761
750
|
onChange: handleChangeValue,
|
762
751
|
disabled: disabled,
|
763
752
|
autoComplete: "off",
|
764
753
|
allowClear: true
|
765
|
-
}, restProps)), isView || disabled ? null : (0, _jsxRuntime.jsx)(_antd.Button, {
|
754
|
+
}, (0, _lodash.omit)(restProps, ['otherProps']))), isView || disabled ? null : (0, _jsxRuntime.jsx)(_antd.Button, {
|
766
755
|
icon: (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
|
767
756
|
className: "viewSvg",
|
768
757
|
src: _view.default,
|
@@ -38,8 +38,7 @@ 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
|
42
|
-
onChange = props.onChange;
|
41
|
+
autoHeight = _props$autoHeight === void 0 ? true : _props$autoHeight;
|
43
42
|
var cls = (0, _classnames.default)((0, _defineProperty2.default)({
|
44
43
|
'pro-collapse': true,
|
45
44
|
'pro-collapse-level2': level === '2',
|
@@ -157,8 +156,7 @@ var ProCollapse = function ProCollapse(props) {
|
|
157
156
|
});
|
158
157
|
},
|
159
158
|
expandIconPosition: "end",
|
160
|
-
defaultActiveKey: folding ? [] : ['1']
|
161
|
-
onChange: onChange
|
159
|
+
defaultActiveKey: folding ? [] : ['1']
|
162
160
|
}, collapseProps), {}, {
|
163
161
|
children: renderPanel()
|
164
162
|
}))
|
@@ -1,7 +1,6 @@
|
|
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;
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
@@ -10,13 +9,14 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
10
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
11
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
12
11
|
var _react = require("react");
|
13
|
-
var _reactLazyload =
|
12
|
+
var _reactLazyload = _interopRequireDefault(require("react-lazyload"));
|
14
13
|
var _lodash = require("lodash");
|
15
14
|
var _index = require("../../index");
|
15
|
+
var _utils = require("../../utils");
|
16
16
|
var _ProCollapse = _interopRequireDefault(require("../../../ProLayout/components/ProCollapse"));
|
17
17
|
var _excluded = ["id", "title", "collapse", "children", "lazyLoad"];
|
18
18
|
var defaultLazyLoadConfig = {
|
19
|
-
height:
|
19
|
+
height: 100,
|
20
20
|
offset: 100,
|
21
21
|
once: true // Load only once upon first entry into the viewport
|
22
22
|
};
|
@@ -31,8 +31,10 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
31
31
|
var _useStep = (0, _index.useStep)(),
|
32
32
|
register = _useStep.register,
|
33
33
|
collapse = _useStep.collapse,
|
34
|
-
globalLazyLoad = _useStep.lazyLoad
|
34
|
+
globalLazyLoad = _useStep.lazyLoad,
|
35
|
+
registerMap = _useStep.registerMap;
|
35
36
|
var lazyLoad = stepLazyLoad || globalLazyLoad;
|
37
|
+
var loadedMap = (0, _utils.getLoadedMap)(registerMap);
|
36
38
|
(0, _react.useEffect)(function () {
|
37
39
|
// Schedule registration to avoid re-render issues
|
38
40
|
var timeoutId = setTimeout(function () {
|
@@ -43,11 +45,13 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
43
45
|
}, restProps));
|
44
46
|
}, 0);
|
45
47
|
return function () {
|
46
|
-
clearTimeout(timeoutId);
|
48
|
+
return clearTimeout(timeoutId);
|
47
49
|
};
|
48
50
|
}, [id, title, lazyLoad, restProps, register]);
|
49
51
|
var renderChildren = function renderChildren() {
|
50
|
-
|
52
|
+
var _loadedMap$;
|
53
|
+
// 第一个step不设置lasyload,防止懒加载不生效
|
54
|
+
if (lazyLoad && (loadedMap === null || loadedMap === void 0 ? void 0 : loadedMap.length) && (loadedMap === null || loadedMap === void 0 ? void 0 : (_loadedMap$ = loadedMap[0]) === null || _loadedMap$ === void 0 ? void 0 : _loadedMap$.id) !== id) {
|
51
55
|
var lazyLoadProps = (0, _lodash.isBoolean)(lazyLoad) ? defaultLazyLoadConfig : lazyLoad;
|
52
56
|
return (0, _jsxRuntime.jsx)(_reactLazyload.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, lazyLoadProps), {}, {
|
53
57
|
classNamePrefix: id,
|
@@ -65,14 +69,6 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
65
69
|
title: title,
|
66
70
|
icon: true
|
67
71
|
}, 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
|
-
},
|
76
72
|
children: renderChildren()
|
77
73
|
}))
|
78
74
|
});
|