@zat-design/sisyphus-react 3.11.3 → 3.11.4-beta.1
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.
@@ -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", "otherProps"],
|
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
|
28
|
+
import { debounce, isArray, isEqual, isFunction } from 'lodash';
|
29
29
|
import { ReactSVG } from 'react-svg';
|
30
|
-
import React, { forwardRef, useEffect, useImperativeHandle, useMemo } from 'react';
|
30
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } 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,6 +58,7 @@ 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,
|
61
62
|
restProps = _objectWithoutProperties(props, _excluded);
|
62
63
|
var contentForm = _Form.useFormInstance();
|
63
64
|
if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
|
@@ -105,6 +106,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
105
106
|
columns = _ref4.columns,
|
106
107
|
rowSelection = _ref4.rowSelection,
|
107
108
|
restTableProps = _objectWithoutProperties(_ref4, _excluded3);
|
109
|
+
var preValue = useRef(value);
|
108
110
|
var _useSetState = useSetState({
|
109
111
|
_value: value,
|
110
112
|
isInit: true,
|
@@ -250,6 +252,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
250
252
|
};
|
251
253
|
var handleChangeValue = function handleChangeValue(e) {
|
252
254
|
onChange(e.target.value);
|
255
|
+
preValue.current = e.target.value;
|
253
256
|
if (!readOnly) {
|
254
257
|
setState({
|
255
258
|
_value: e.target.value
|
@@ -258,6 +261,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
258
261
|
};
|
259
262
|
var handleSelectValue = function handleSelectValue(val, option) {
|
260
263
|
onChange(val, option);
|
264
|
+
preValue.current = val;
|
261
265
|
};
|
262
266
|
var handleClick = /*#__PURE__*/function () {
|
263
267
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
@@ -369,6 +373,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
369
373
|
case 14:
|
370
374
|
if (flag) {
|
371
375
|
onChange === null || onChange === void 0 ? void 0 : onChange(labelInValue ? record : getNextValues(record), record);
|
376
|
+
preValue.current = labelInValue ? record : getNextValues(record);
|
372
377
|
// 更新内部展示值
|
373
378
|
setState({
|
374
379
|
_value: record,
|
@@ -497,6 +502,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
497
502
|
nextSelectRowKeys = isMultiple ? value : [value];
|
498
503
|
if (labelInValue) {
|
499
504
|
onChange(_data);
|
505
|
+
preValue.current = _data;
|
500
506
|
}
|
501
507
|
// 更新内部展示值
|
502
508
|
setState({
|
@@ -553,10 +559,14 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
553
559
|
nextSelectRowKeys = isMultiple ? value : [value];
|
554
560
|
if (labelInValue) {
|
555
561
|
onChange(_data2);
|
562
|
+
preValue.current = _data2;
|
556
563
|
} else {
|
557
564
|
onChange(isMultiple ? _data2.map(function (item) {
|
558
565
|
return item[valueKey];
|
559
566
|
}) : _data2[valueKey]);
|
567
|
+
preValue.current = isMultiple ? _data2.map(function (item) {
|
568
|
+
return item[valueKey];
|
569
|
+
}) : _data2[valueKey];
|
560
570
|
}
|
561
571
|
// 更新内部展示值
|
562
572
|
setState({
|
@@ -646,25 +656,28 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
646
656
|
}
|
647
657
|
}, [JSON.stringify(value), visible, isInit]);
|
648
658
|
useDebounceEffect(function () {
|
649
|
-
if (value && !visible && readOnly) {
|
659
|
+
if (value && !visible && readOnly && !isEqual(value, preValue.current)) {
|
650
660
|
var _options$some;
|
661
|
+
preValue.current = value;
|
651
662
|
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) {
|
652
663
|
return item[valueKey] === value;
|
653
664
|
});
|
654
665
|
if (isHasValue) {
|
655
666
|
return;
|
656
667
|
}
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
+
if (useRequest) {
|
669
|
+
// 加定时器 修复依赖数据同步更新未取到问题
|
670
|
+
setTimeout(function () {
|
671
|
+
var _useRequest$options7, _useRequest$options8;
|
672
|
+
var params = withPagination ? {
|
673
|
+
pageNum: 1,
|
674
|
+
pageSize: 50,
|
675
|
+
queryBean: _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.defaultParams), initParams)
|
676
|
+
} : _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
|
677
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
678
|
+
run(nextParams);
|
679
|
+
}, 300);
|
680
|
+
}
|
668
681
|
}
|
669
682
|
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams), JSON.stringify(initParams)]);
|
670
683
|
useDebounceEffect(function () {
|
@@ -733,26 +746,28 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
733
746
|
}
|
734
747
|
},
|
735
748
|
onSearch: debounce(function (val) {
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
749
|
+
if (useRequest) {
|
750
|
+
var _useRequest$options11;
|
751
|
+
var queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options11 = useRequest.options) === null || _useRequest$options11 === void 0 ? void 0 : _useRequest$options11.defaultParams), {}, _defineProperty({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
|
752
|
+
var params = withPagination ? {
|
753
|
+
pageNum: 1,
|
754
|
+
pageSize: 50,
|
755
|
+
queryBean: queryBean
|
756
|
+
} : queryBean;
|
757
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
758
|
+
run(nextParams);
|
759
|
+
}
|
760
|
+
}, 2000),
|
746
761
|
style: {
|
747
762
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
748
763
|
}
|
749
|
-
},
|
764
|
+
}, restProps)) : _jsx(_Input, _objectSpread({
|
750
765
|
value: viewText,
|
751
766
|
onChange: handleChangeValue,
|
752
767
|
disabled: disabled,
|
753
768
|
autoComplete: "off",
|
754
769
|
allowClear: true
|
755
|
-
},
|
770
|
+
}, restProps)), isView || disabled ? null : _jsx(_Button, {
|
756
771
|
icon: _jsx(ReactSVG, {
|
757
772
|
className: "viewSvg",
|
758
773
|
src: viewSvg,
|
package/es/ProStep/index.js
CHANGED
@@ -7,7 +7,7 @@ var _excluded = ["children"];
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
8
8
|
import { createContext, useCallback, useContext, useMemo, useRef, useState } from 'react';
|
9
9
|
import { debounce } from 'lodash';
|
10
|
-
import { useSetState, useLocalStorageState
|
10
|
+
import { useSetState, useLocalStorageState } from 'ahooks';
|
11
11
|
import { handleScroll } from './utils';
|
12
12
|
import Step from './components/Step';
|
13
13
|
import Item from './components/Item';
|
@@ -133,6 +133,22 @@ var ProStep = function ProStep(_ref) {
|
|
133
133
|
record.subEvent = subEvent;
|
134
134
|
registerMap.current[id] = record;
|
135
135
|
};
|
136
|
+
var handleScrollError = function handleScrollError(data) {
|
137
|
+
var errorModuleKeys = Object.keys(data).reverse();
|
138
|
+
if (errorModuleKeys === null || errorModuleKeys === void 0 ? void 0 : errorModuleKeys.length) {
|
139
|
+
var _dataSource$find;
|
140
|
+
var firstErrorModuleKey = (_dataSource$find = dataSource.find(function (item) {
|
141
|
+
var moduleKey = errorModuleKeys.find(function (child) {
|
142
|
+
return child === item.code;
|
143
|
+
});
|
144
|
+
return data[moduleKey];
|
145
|
+
})) === null || _dataSource$find === void 0 ? void 0 : _dataSource$find.code;
|
146
|
+
firstErrorModuleKey && handleScroll(firstErrorModuleKey, {
|
147
|
+
targetOffset: targetOffset,
|
148
|
+
scrollToError: scrollToError
|
149
|
+
});
|
150
|
+
}
|
151
|
+
};
|
136
152
|
var notify = /*#__PURE__*/function () {
|
137
153
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
138
154
|
var _ref7, excludes, triggerIds, events, res, nextErrorCollection;
|
@@ -163,8 +179,9 @@ var ProStep = function ProStep(_ref) {
|
|
163
179
|
setState({
|
164
180
|
errorCollection: nextErrorCollection
|
165
181
|
});
|
182
|
+
handleScrollError(nextErrorCollection);
|
166
183
|
return _context2.abrupt("return", res);
|
167
|
-
case
|
184
|
+
case 12:
|
168
185
|
case "end":
|
169
186
|
return _context2.stop();
|
170
187
|
}
|
@@ -200,8 +217,9 @@ var ProStep = function ProStep(_ref) {
|
|
200
217
|
setState({
|
201
218
|
errorCollection: nextErrorCollection
|
202
219
|
});
|
220
|
+
handleScrollError(nextErrorCollection);
|
203
221
|
return _context3.abrupt("return", result);
|
204
|
-
case
|
222
|
+
case 10:
|
205
223
|
case "end":
|
206
224
|
return _context3.stop();
|
207
225
|
}
|
@@ -211,22 +229,6 @@ var ProStep = function ProStep(_ref) {
|
|
211
229
|
return _ref9.apply(this, arguments);
|
212
230
|
};
|
213
231
|
}();
|
214
|
-
useDeepCompareEffect(function () {
|
215
|
-
var errorModuleKeys = Object.keys(errorCollection).reverse();
|
216
|
-
if (errorModuleKeys === null || errorModuleKeys === void 0 ? void 0 : errorModuleKeys.length) {
|
217
|
-
var _dataSource$find;
|
218
|
-
var firstErrorModuleKey = (_dataSource$find = dataSource.find(function (item) {
|
219
|
-
var moduleKey = errorModuleKeys.find(function (child) {
|
220
|
-
return child === item.code;
|
221
|
-
});
|
222
|
-
return errorCollection[moduleKey];
|
223
|
-
})) === null || _dataSource$find === void 0 ? void 0 : _dataSource$find.code;
|
224
|
-
firstErrorModuleKey && handleScroll(firstErrorModuleKey, {
|
225
|
-
targetOffset: targetOffset,
|
226
|
-
scrollToError: scrollToError
|
227
|
-
});
|
228
|
-
}
|
229
|
-
}, [errorCollection, dataSource]);
|
230
232
|
return _jsx(ProStepContext.Provider, {
|
231
233
|
value: {
|
232
234
|
registerMap: registerMap,
|
@@ -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", "otherProps"],
|
29
29
|
_excluded2 = ["onOk"],
|
30
30
|
_excluded3 = ["rowKey", "columns", "rowSelection"];
|
31
31
|
var ProModalSelect = function ProModalSelect(props, ref) {
|
@@ -53,6 +53,7 @@ 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,
|
56
57
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
57
58
|
var contentForm = _antd.Form.useFormInstance();
|
58
59
|
if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
|
@@ -100,6 +101,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
100
101
|
columns = _ref4.columns,
|
101
102
|
rowSelection = _ref4.rowSelection,
|
102
103
|
restTableProps = (0, _objectWithoutProperties2.default)(_ref4, _excluded3);
|
104
|
+
var preValue = (0, _react.useRef)(value);
|
103
105
|
var _useSetState = (0, _ahooks.useSetState)({
|
104
106
|
_value: value,
|
105
107
|
isInit: true,
|
@@ -245,6 +247,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
245
247
|
};
|
246
248
|
var handleChangeValue = function handleChangeValue(e) {
|
247
249
|
onChange(e.target.value);
|
250
|
+
preValue.current = e.target.value;
|
248
251
|
if (!readOnly) {
|
249
252
|
setState({
|
250
253
|
_value: e.target.value
|
@@ -253,6 +256,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
253
256
|
};
|
254
257
|
var handleSelectValue = function handleSelectValue(val, option) {
|
255
258
|
onChange(val, option);
|
259
|
+
preValue.current = val;
|
256
260
|
};
|
257
261
|
var handleClick = /*#__PURE__*/function () {
|
258
262
|
var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
@@ -364,6 +368,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
364
368
|
case 14:
|
365
369
|
if (flag) {
|
366
370
|
onChange === null || onChange === void 0 ? void 0 : onChange(labelInValue ? record : getNextValues(record), record);
|
371
|
+
preValue.current = labelInValue ? record : getNextValues(record);
|
367
372
|
// 更新内部展示值
|
368
373
|
setState({
|
369
374
|
_value: record,
|
@@ -492,6 +497,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
492
497
|
nextSelectRowKeys = isMultiple ? value : [value];
|
493
498
|
if (labelInValue) {
|
494
499
|
onChange(_data);
|
500
|
+
preValue.current = _data;
|
495
501
|
}
|
496
502
|
// 更新内部展示值
|
497
503
|
setState({
|
@@ -548,10 +554,14 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
548
554
|
nextSelectRowKeys = isMultiple ? value : [value];
|
549
555
|
if (labelInValue) {
|
550
556
|
onChange(_data2);
|
557
|
+
preValue.current = _data2;
|
551
558
|
} else {
|
552
559
|
onChange(isMultiple ? _data2.map(function (item) {
|
553
560
|
return item[valueKey];
|
554
561
|
}) : _data2[valueKey]);
|
562
|
+
preValue.current = isMultiple ? _data2.map(function (item) {
|
563
|
+
return item[valueKey];
|
564
|
+
}) : _data2[valueKey];
|
555
565
|
}
|
556
566
|
// 更新内部展示值
|
557
567
|
setState({
|
@@ -641,25 +651,28 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
641
651
|
}
|
642
652
|
}, [JSON.stringify(value), visible, isInit]);
|
643
653
|
(0, _ahooks.useDebounceEffect)(function () {
|
644
|
-
if (value && !visible && readOnly) {
|
654
|
+
if (value && !visible && readOnly && !(0, _lodash.isEqual)(value, preValue.current)) {
|
645
655
|
var _options$some;
|
656
|
+
preValue.current = value;
|
646
657
|
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) {
|
647
658
|
return item[valueKey] === value;
|
648
659
|
});
|
649
660
|
if (isHasValue) {
|
650
661
|
return;
|
651
662
|
}
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
+
if (useRequest) {
|
664
|
+
// 加定时器 修复依赖数据同步更新未取到问题
|
665
|
+
setTimeout(function () {
|
666
|
+
var _useRequest$options7, _useRequest$options8;
|
667
|
+
var params = withPagination ? {
|
668
|
+
pageNum: 1,
|
669
|
+
pageSize: 50,
|
670
|
+
queryBean: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.defaultParams), initParams)
|
671
|
+
} : (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
|
672
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
673
|
+
run(nextParams);
|
674
|
+
}, 300);
|
675
|
+
}
|
663
676
|
}
|
664
677
|
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams), JSON.stringify(initParams)]);
|
665
678
|
(0, _ahooks.useDebounceEffect)(function () {
|
@@ -728,26 +741,28 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
728
741
|
}
|
729
742
|
},
|
730
743
|
onSearch: (0, _lodash.debounce)(function (val) {
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
744
|
+
if (useRequest) {
|
745
|
+
var _useRequest$options11;
|
746
|
+
var queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options11 = useRequest.options) === null || _useRequest$options11 === void 0 ? void 0 : _useRequest$options11.defaultParams), {}, (0, _defineProperty2.default)({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
|
747
|
+
var params = withPagination ? {
|
748
|
+
pageNum: 1,
|
749
|
+
pageSize: 50,
|
750
|
+
queryBean: queryBean
|
751
|
+
} : queryBean;
|
752
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
753
|
+
run(nextParams);
|
754
|
+
}
|
755
|
+
}, 2000),
|
741
756
|
style: {
|
742
757
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
743
758
|
}
|
744
|
-
},
|
759
|
+
}, restProps)) : (0, _jsxRuntime.jsx)(_antd.Input, (0, _objectSpread3.default)({
|
745
760
|
value: viewText,
|
746
761
|
onChange: handleChangeValue,
|
747
762
|
disabled: disabled,
|
748
763
|
autoComplete: "off",
|
749
764
|
allowClear: true
|
750
|
-
},
|
765
|
+
}, restProps)), isView || disabled ? null : (0, _jsxRuntime.jsx)(_antd.Button, {
|
751
766
|
icon: (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
|
752
767
|
className: "viewSvg",
|
753
768
|
src: _view.default,
|
package/lib/ProStep/index.js
CHANGED
@@ -140,6 +140,22 @@ var ProStep = function ProStep(_ref) {
|
|
140
140
|
record.subEvent = subEvent;
|
141
141
|
registerMap.current[id] = record;
|
142
142
|
};
|
143
|
+
var handleScrollError = function handleScrollError(data) {
|
144
|
+
var errorModuleKeys = Object.keys(data).reverse();
|
145
|
+
if (errorModuleKeys === null || errorModuleKeys === void 0 ? void 0 : errorModuleKeys.length) {
|
146
|
+
var _dataSource$find;
|
147
|
+
var firstErrorModuleKey = (_dataSource$find = dataSource.find(function (item) {
|
148
|
+
var moduleKey = errorModuleKeys.find(function (child) {
|
149
|
+
return child === item.code;
|
150
|
+
});
|
151
|
+
return data[moduleKey];
|
152
|
+
})) === null || _dataSource$find === void 0 ? void 0 : _dataSource$find.code;
|
153
|
+
firstErrorModuleKey && (0, _utils.handleScroll)(firstErrorModuleKey, {
|
154
|
+
targetOffset: targetOffset,
|
155
|
+
scrollToError: scrollToError
|
156
|
+
});
|
157
|
+
}
|
158
|
+
};
|
143
159
|
var notify = /*#__PURE__*/function () {
|
144
160
|
var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(params) {
|
145
161
|
var _ref7, excludes, triggerIds, events, res, nextErrorCollection;
|
@@ -170,8 +186,9 @@ var ProStep = function ProStep(_ref) {
|
|
170
186
|
setState({
|
171
187
|
errorCollection: nextErrorCollection
|
172
188
|
});
|
189
|
+
handleScrollError(nextErrorCollection);
|
173
190
|
return _context2.abrupt("return", res);
|
174
|
-
case
|
191
|
+
case 12:
|
175
192
|
case "end":
|
176
193
|
return _context2.stop();
|
177
194
|
}
|
@@ -207,8 +224,9 @@ var ProStep = function ProStep(_ref) {
|
|
207
224
|
setState({
|
208
225
|
errorCollection: nextErrorCollection
|
209
226
|
});
|
227
|
+
handleScrollError(nextErrorCollection);
|
210
228
|
return _context3.abrupt("return", result);
|
211
|
-
case
|
229
|
+
case 10:
|
212
230
|
case "end":
|
213
231
|
return _context3.stop();
|
214
232
|
}
|
@@ -218,22 +236,6 @@ var ProStep = function ProStep(_ref) {
|
|
218
236
|
return _ref9.apply(this, arguments);
|
219
237
|
};
|
220
238
|
}();
|
221
|
-
(0, _ahooks.useDeepCompareEffect)(function () {
|
222
|
-
var errorModuleKeys = Object.keys(errorCollection).reverse();
|
223
|
-
if (errorModuleKeys === null || errorModuleKeys === void 0 ? void 0 : errorModuleKeys.length) {
|
224
|
-
var _dataSource$find;
|
225
|
-
var firstErrorModuleKey = (_dataSource$find = dataSource.find(function (item) {
|
226
|
-
var moduleKey = errorModuleKeys.find(function (child) {
|
227
|
-
return child === item.code;
|
228
|
-
});
|
229
|
-
return errorCollection[moduleKey];
|
230
|
-
})) === null || _dataSource$find === void 0 ? void 0 : _dataSource$find.code;
|
231
|
-
firstErrorModuleKey && (0, _utils.handleScroll)(firstErrorModuleKey, {
|
232
|
-
targetOffset: targetOffset,
|
233
|
-
scrollToError: scrollToError
|
234
|
-
});
|
235
|
-
}
|
236
|
-
}, [errorCollection, dataSource]);
|
237
239
|
return (0, _jsxRuntime.jsx)(ProStepContext.Provider, {
|
238
240
|
value: {
|
239
241
|
registerMap: registerMap,
|
package/package.json
CHANGED