@zat-design/sisyphus-react 3.5.3 → 3.5.4-beta.2
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/es/ProEditTable/components/RenderField/index.js +1 -1
- package/es/ProEditTable/index.js +6 -4
- package/es/ProForm/components/Container.js +5 -4
- package/es/ProForm/components/base/DatePicker/index.js +4 -0
- package/es/ProForm/components/combination/ProModalSelect/index.js +20 -14
- package/es/ProForm/utils/index.d.ts +6 -0
- package/es/ProForm/utils/index.js +20 -0
- package/es/ProForm/utils/useShouldUpdate.js +3 -3
- package/es/ProStep/components/Listener/index.js +5 -1
- package/es/ProStep/index.js +110 -58
- package/es/ProTable/propsType.d.ts +1 -0
- package/es/ProTable/useAntdTable.js +22 -3
- package/es/ProTable/utils.js +5 -1
- package/es/ProTreeModal/components/Trigger.js +14 -9
- package/es/ProTreeModal/index.js +8 -0
- package/es/ProTreeModal/propsType.d.ts +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +1 -1
- package/lib/ProEditTable/index.js +6 -4
- package/lib/ProForm/components/Container.js +4 -3
- package/lib/ProForm/components/base/DatePicker/index.js +4 -0
- package/lib/ProForm/components/combination/ProModalSelect/index.js +20 -14
- package/lib/ProForm/utils/index.d.ts +6 -0
- package/lib/ProForm/utils/index.js +21 -1
- package/lib/ProForm/utils/useShouldUpdate.js +3 -3
- package/lib/ProStep/components/Listener/index.js +5 -1
- package/lib/ProStep/index.js +109 -57
- package/lib/ProTable/propsType.d.ts +1 -0
- package/lib/ProTable/useAntdTable.js +22 -3
- package/lib/ProTable/utils.js +5 -1
- package/lib/ProTreeModal/components/Trigger.js +14 -9
- package/lib/ProTreeModal/index.js +9 -0
- package/lib/ProTreeModal/propsType.d.ts +1 -1
- package/package.json +1 -1
|
@@ -530,7 +530,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
530
530
|
}
|
|
531
531
|
Object.assign(_formItemProps, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultTransform()), valueTypeTransform()), namesTransform()), isTrim(type, trim, useProConfig())));
|
|
532
532
|
// 编辑&保存模式,在查看状态下移除表单的rules不做校验
|
|
533
|
-
if (
|
|
533
|
+
if (isView) {
|
|
534
534
|
delete _formItemProps.rules;
|
|
535
535
|
}
|
|
536
536
|
var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed));
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import ProForm from '../ProForm';
|
|
|
22
22
|
import Empty from '../assets/empty.png';
|
|
23
23
|
import locale, { formatMessage } from '../locale';
|
|
24
24
|
var ProEditTable = function ProEditTable(_ref, ref) {
|
|
25
|
-
var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _value
|
|
25
|
+
var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _value$;
|
|
26
26
|
var value = _ref.value,
|
|
27
27
|
onChange = _ref.onChange,
|
|
28
28
|
onDrag = _ref.onDrag,
|
|
@@ -279,9 +279,11 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
279
279
|
// },
|
|
280
280
|
// );
|
|
281
281
|
useEffect(function () {
|
|
282
|
-
var
|
|
282
|
+
var isAllHasKey = value.every(function (item) {
|
|
283
|
+
return item.rowKey;
|
|
284
|
+
});
|
|
283
285
|
// 初始化默认生成row-key
|
|
284
|
-
if ((value === null || value === void 0 ? void 0 : value.length) && !
|
|
286
|
+
if ((value === null || value === void 0 ? void 0 : value.length) && !isAllHasKey) {
|
|
285
287
|
var _originalArr$forEach;
|
|
286
288
|
var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
|
|
287
289
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -328,7 +330,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
328
330
|
}) : null, _jsx(_Table, _objectSpread(_objectSpread({
|
|
329
331
|
ref: tableRef,
|
|
330
332
|
className: _className,
|
|
331
|
-
dataSource: (value === null || value === void 0 ? void 0 : (_value$
|
|
333
|
+
dataSource: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value : undefined,
|
|
332
334
|
columns: _columns,
|
|
333
335
|
rowSelection: renderRowSelection(),
|
|
334
336
|
rowClassName: _rowClassName,
|
|
@@ -2,18 +2,19 @@ import "antd/es/tooltip/style";
|
|
|
2
2
|
import _Tooltip from "antd/es/tooltip";
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
import {
|
|
5
|
+
import { isEmptyArray } from '../utils';
|
|
6
6
|
var Container = function Container(props) {
|
|
7
7
|
var children = props.children,
|
|
8
8
|
tooltip = props.tooltip,
|
|
9
9
|
nowrap = props.nowrap,
|
|
10
10
|
viewEmpty = props.viewEmpty;
|
|
11
|
-
|
|
11
|
+
// 值为false但不为0, 或者值为空数组
|
|
12
|
+
var nullValue = children !== 0 && !children || isEmptyArray(children);
|
|
12
13
|
var _className = classNames({
|
|
13
14
|
'pro-form-view-container': true,
|
|
14
15
|
'pro-form-view-container_nowrap': nowrap !== null && nowrap !== void 0 ? nowrap : tooltip
|
|
15
16
|
});
|
|
16
|
-
if (tooltip && !
|
|
17
|
+
if (tooltip && !nullValue) {
|
|
17
18
|
return _jsx(_Tooltip, {
|
|
18
19
|
placement: "topLeft",
|
|
19
20
|
title: children,
|
|
@@ -25,7 +26,7 @@ var Container = function Container(props) {
|
|
|
25
26
|
}
|
|
26
27
|
return _jsx("div", {
|
|
27
28
|
className: _className,
|
|
28
|
-
children:
|
|
29
|
+
children: nullValue ? viewEmpty : children
|
|
29
30
|
});
|
|
30
31
|
};
|
|
31
32
|
export default Container;
|
|
@@ -92,6 +92,10 @@ var DatePicker = function DatePicker(props) {
|
|
|
92
92
|
if (isObject(_rest.showTime)) {
|
|
93
93
|
_rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
|
|
94
94
|
}
|
|
95
|
+
// 传进来showTime权重最高
|
|
96
|
+
if (isBoolean(rest.showTime)) {
|
|
97
|
+
_rest.showTime = rest.showTime;
|
|
98
|
+
}
|
|
95
99
|
return _jsx(_DatePicker, _objectSpread(_objectSpread(_objectSpread({}, initialConfig), {}, {
|
|
96
100
|
format: _format
|
|
97
101
|
}, _rest), {}, {
|
|
@@ -137,7 +137,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
137
137
|
var _res$data;
|
|
138
138
|
var list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list : res === null || res === void 0 ? void 0 : res.data;
|
|
139
139
|
setState({
|
|
140
|
-
options: list
|
|
140
|
+
options: transformResponse ? transformResponse(res === null || res === void 0 ? void 0 : res.data) : list
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})),
|
|
@@ -301,7 +301,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
301
301
|
while (1) switch (_context2.prev = _context2.next) {
|
|
302
302
|
case 0:
|
|
303
303
|
_context2.prev = 0;
|
|
304
|
-
if (selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) {
|
|
304
|
+
if (!(!(selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) || !(selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length))) {
|
|
305
305
|
_context2.next = 4;
|
|
306
306
|
break;
|
|
307
307
|
}
|
|
@@ -434,7 +434,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
434
434
|
// 初始化回显,当传入initParams时,前端用来回险
|
|
435
435
|
var getInitValues = /*#__PURE__*/function () {
|
|
436
436
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
437
|
-
var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _list, list,
|
|
437
|
+
var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
|
|
438
438
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
439
439
|
while (1) switch (_context4.prev = _context4.next) {
|
|
440
440
|
case 0:
|
|
@@ -459,11 +459,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
459
459
|
case 8:
|
|
460
460
|
res = _context4.sent;
|
|
461
461
|
if (res === null || res === void 0 ? void 0 : res.data) {
|
|
462
|
-
list =
|
|
462
|
+
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
|
|
463
463
|
if (transformResponse) {
|
|
464
464
|
list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
|
|
465
|
-
} else {
|
|
466
|
-
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
|
|
467
465
|
}
|
|
468
466
|
_data = isMultiple ? list : (_list = list) === null || _list === void 0 ? void 0 : _list[0];
|
|
469
467
|
if (_data) {
|
|
@@ -500,7 +498,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
500
498
|
var getDefaultOneValues = /*#__PURE__*/function () {
|
|
501
499
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
502
500
|
var _useRequest$options4, _useRequest$options5;
|
|
503
|
-
var queryBean, page, params, res, _list2, list,
|
|
501
|
+
var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
|
|
504
502
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
505
503
|
while (1) switch (_context5.prev = _context5.next) {
|
|
506
504
|
case 0:
|
|
@@ -518,11 +516,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
518
516
|
case 6:
|
|
519
517
|
res = _context5.sent;
|
|
520
518
|
if (res === null || res === void 0 ? void 0 : res.data) {
|
|
521
|
-
list =
|
|
519
|
+
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.list : res === null || res === void 0 ? void 0 : res.data;
|
|
522
520
|
if (transformResponse) {
|
|
523
521
|
list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
|
|
524
|
-
} else {
|
|
525
|
-
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.list : res === null || res === void 0 ? void 0 : res.data;
|
|
526
522
|
}
|
|
527
523
|
_data2 = isMultiple ? list : (_list2 = list) === null || _list2 === void 0 ? void 0 : _list2[0];
|
|
528
524
|
nextSelectRowKeys = isMultiple ? value : [value];
|
|
@@ -604,7 +600,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
604
600
|
nextState.selectedRows = value;
|
|
605
601
|
}
|
|
606
602
|
} else if (value) {
|
|
607
|
-
|
|
603
|
+
var _list$filter;
|
|
604
|
+
var nextSelectedRowKeys = isMultiple ? value : [value];
|
|
605
|
+
nextState.selectedRowKeys = nextSelectedRowKeys;
|
|
606
|
+
var list = options !== null && options !== void 0 ? options : data;
|
|
607
|
+
nextState.selectedRows = list === null || list === void 0 ? void 0 : (_list$filter = list.filter) === null || _list$filter === void 0 ? void 0 : _list$filter.call(list, function (item) {
|
|
608
|
+
return nextSelectedRowKeys.includes(item[valueKey]);
|
|
609
|
+
});
|
|
608
610
|
}
|
|
609
611
|
setState(nextState);
|
|
610
612
|
}
|
|
@@ -625,7 +627,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
625
627
|
pageSize: 50,
|
|
626
628
|
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)
|
|
627
629
|
} : _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
|
|
628
|
-
|
|
630
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
|
631
|
+
run(nextParams);
|
|
629
632
|
setState({
|
|
630
633
|
isInit: false
|
|
631
634
|
});
|
|
@@ -679,6 +682,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
679
682
|
labelInValue: labelInValue,
|
|
680
683
|
dataSource: options,
|
|
681
684
|
scrollFollowParent: false,
|
|
685
|
+
mode: isMultiple ? 'multiple' : undefined,
|
|
682
686
|
onFocus: function onFocus() {
|
|
683
687
|
if (useRequest) {
|
|
684
688
|
var _useRequest$options9;
|
|
@@ -688,7 +692,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
688
692
|
pageSize: 50,
|
|
689
693
|
queryBean: queryBean
|
|
690
694
|
} : queryBean;
|
|
691
|
-
|
|
695
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
|
696
|
+
run(nextParams);
|
|
692
697
|
setState({
|
|
693
698
|
isInit: false
|
|
694
699
|
});
|
|
@@ -702,7 +707,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
702
707
|
pageSize: 50,
|
|
703
708
|
queryBean: queryBean
|
|
704
709
|
} : queryBean;
|
|
705
|
-
|
|
710
|
+
var nextParams = transformParams ? transformParams(params) : params;
|
|
711
|
+
run(nextParams);
|
|
706
712
|
}, 2000),
|
|
707
713
|
style: {
|
|
708
714
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
|
@@ -43,6 +43,12 @@ export declare const isNotFullArray: (arr: any, length: any, required: any) => b
|
|
|
43
43
|
* @returns boole
|
|
44
44
|
*/
|
|
45
45
|
export declare const isNullArray: (arr: any) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* 判断数组中值是否全部为空 如果值不是数组返回false
|
|
48
|
+
* @param arr 值
|
|
49
|
+
* @returns boole
|
|
50
|
+
*/
|
|
51
|
+
export declare const isEmptyArray: (arr: any) => boolean;
|
|
46
52
|
export declare function toArray<T>(value?: T | T[] | null): T[];
|
|
47
53
|
/**
|
|
48
54
|
* names值合并
|
|
@@ -218,6 +218,26 @@ export var isNullArray = function isNullArray(arr) {
|
|
|
218
218
|
return false;
|
|
219
219
|
});
|
|
220
220
|
};
|
|
221
|
+
/**
|
|
222
|
+
* 判断数组中值是否全部为空 如果值不是数组返回false
|
|
223
|
+
* @param arr 值
|
|
224
|
+
* @returns boole
|
|
225
|
+
*/
|
|
226
|
+
export var isEmptyArray = function isEmptyArray(arr) {
|
|
227
|
+
if (!Array.isArray(arr)) return false;
|
|
228
|
+
return arr.every(function (item) {
|
|
229
|
+
if (item === undefined || item === null) {
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
if (typeof item === 'string' && item.trim().length === 0) {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
if (Array.isArray(item) && item.length === 0) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
});
|
|
240
|
+
};
|
|
221
241
|
export function toArray(value) {
|
|
222
242
|
if (value === undefined || value === null) {
|
|
223
243
|
return [];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
2
|
import { useRef, useState } from 'react';
|
|
4
3
|
import { isFunction, isEqualWith } from 'lodash';
|
|
@@ -165,9 +164,10 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
165
164
|
clearInterval(timerRef.current);
|
|
166
165
|
timerRef.current = setTimeout(function () {
|
|
167
166
|
if (Array.isArray(names)) {
|
|
168
|
-
form.resetFields(
|
|
167
|
+
form.resetFields(names);
|
|
169
168
|
} else {
|
|
170
|
-
|
|
169
|
+
var clearName = formItemProps.namePath ? formItemProps.namePath.slice(0, -1).concat(formItemProps.name) : formItemProps.name;
|
|
170
|
+
form.resetFields([clearName]);
|
|
171
171
|
}
|
|
172
172
|
}, 200);
|
|
173
173
|
} else {
|
|
@@ -11,8 +11,11 @@ export default (function (_ref) {
|
|
|
11
11
|
delayTime = _ref.delayTime,
|
|
12
12
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
13
|
var _useStep = useStep(),
|
|
14
|
-
notify = _useStep.notify
|
|
14
|
+
notify = _useStep.notify,
|
|
15
|
+
loading = _useStep.loading,
|
|
16
|
+
setLoading = _useStep.setLoading;
|
|
15
17
|
return /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
|
|
18
|
+
loading: loading || (props === null || props === void 0 ? void 0 : props.loading),
|
|
16
19
|
onClick: throttle( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
17
20
|
var values;
|
|
18
21
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -24,6 +27,7 @@ export default (function (_ref) {
|
|
|
24
27
|
case 3:
|
|
25
28
|
values = _context.sent;
|
|
26
29
|
setTimeout(function () {
|
|
30
|
+
setLoading(false);
|
|
27
31
|
var localData = localStorage.getItem('cache-pro-step');
|
|
28
32
|
if (localData !== 'false') {
|
|
29
33
|
var _children$props, _children$props$onCli;
|
package/es/ProStep/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
3
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
5
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
7
|
var _excluded = ["children"];
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
9
|
+
import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
10
10
|
import { useEventEmitter, useSetState, useLocalStorageState, useDeepCompareEffect } from 'ahooks';
|
|
11
11
|
import { handleScroll } from './utils';
|
|
12
12
|
import Step from './components/Step';
|
|
@@ -26,14 +26,15 @@ var ProStep = function ProStep(_ref) {
|
|
|
26
26
|
errorCollection = _useSetState2[0],
|
|
27
27
|
setErrorCollection = _useSetState2[1];
|
|
28
28
|
// 注册子节点id与title映射的集合
|
|
29
|
-
var
|
|
30
|
-
_useSetState4 = _slicedToArray(_useSetState3, 2),
|
|
31
|
-
registerMap = _useSetState4[0],
|
|
32
|
-
setRegisterMap = _useSetState4[1];
|
|
29
|
+
var registerMap = useRef({});
|
|
33
30
|
var _useState = useState([]),
|
|
34
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
32
|
anchorIds = _useState2[0],
|
|
36
33
|
setAnchorIds = _useState2[1];
|
|
34
|
+
var _useState3 = useState(false),
|
|
35
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
36
|
+
loading = _useState4[0],
|
|
37
|
+
setLoading = _useState4[1];
|
|
37
38
|
var _useLocalStorageState = useLocalStorageState('cache-pro-step'),
|
|
38
39
|
_useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 2),
|
|
39
40
|
setLocalData = _useLocalStorageState2[1];
|
|
@@ -48,7 +49,7 @@ var ProStep = function ProStep(_ref) {
|
|
|
48
49
|
if (resetProps === null || resetProps === void 0 ? void 0 : resetProps.dataSource) {
|
|
49
50
|
return resetProps === null || resetProps === void 0 ? void 0 : resetProps.dataSource;
|
|
50
51
|
}
|
|
51
|
-
return (_Object$entries = Object.entries(registerMap)) === null || _Object$entries === void 0 ? void 0 : (_Object$entries$map = _Object$entries.map) === null || _Object$entries$map === void 0 ? void 0 : _Object$entries$map.call(_Object$entries, function (_ref2) {
|
|
52
|
+
return (_Object$entries = Object.entries(registerMap.current)) === null || _Object$entries === void 0 ? void 0 : (_Object$entries$map = _Object$entries.map) === null || _Object$entries$map === void 0 ? void 0 : _Object$entries$map.call(_Object$entries, function (_ref2) {
|
|
52
53
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
53
54
|
key = _ref3[0],
|
|
54
55
|
_ref3$ = _ref3[1],
|
|
@@ -64,76 +65,89 @@ var ProStep = function ProStep(_ref) {
|
|
|
64
65
|
}).sort(function (pre, next) {
|
|
65
66
|
return pre.order - next.order;
|
|
66
67
|
});
|
|
67
|
-
}, [resetProps === null || resetProps === void 0 ? void 0 : resetProps.dataSource, registerMap, anchorIds]);
|
|
68
|
+
}, [resetProps === null || resetProps === void 0 ? void 0 : resetProps.dataSource, registerMap.current, anchorIds]);
|
|
68
69
|
// 用来注册form匹配到对应的模块id
|
|
69
70
|
var register = function register(_ref4) {
|
|
71
|
+
var _registerMap$current;
|
|
70
72
|
var id = _ref4.id,
|
|
71
73
|
form = _ref4.form,
|
|
72
74
|
title = _ref4.title,
|
|
73
75
|
validator = _ref4.validator,
|
|
74
76
|
order = _ref4.order,
|
|
75
77
|
disabled = _ref4.disabled;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
order: order
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
78
|
+
var record = {};
|
|
79
|
+
record.title = title;
|
|
80
|
+
record.order = order;
|
|
82
81
|
if (disabled) {
|
|
82
|
+
registerMap.current[id] = record;
|
|
83
83
|
return null;
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
var subEvent = /*#__PURE__*/function () {
|
|
86
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
87
|
+
var num, _form$validateFields, _errors$errorFields;
|
|
88
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
89
|
+
while (1) switch (_context.prev = _context.next) {
|
|
90
|
+
case 0:
|
|
91
|
+
num = 0;
|
|
92
|
+
_context.prev = 1;
|
|
93
|
+
if (!validator) {
|
|
94
|
+
_context.next = 8;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
_context.next = 5;
|
|
98
|
+
return validator === null || validator === void 0 ? void 0 : validator();
|
|
99
|
+
case 5:
|
|
100
|
+
values[id] = _context.sent;
|
|
101
|
+
_context.next = 11;
|
|
94
102
|
break;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
})
|
|
103
|
+
case 8:
|
|
104
|
+
_context.next = 10;
|
|
105
|
+
return form === null || form === void 0 ? void 0 : (_form$validateFields = form.validateFields) === null || _form$validateFields === void 0 ? void 0 : _form$validateFields.call(form);
|
|
106
|
+
case 10:
|
|
107
|
+
values[id] = _context.sent;
|
|
108
|
+
case 11:
|
|
109
|
+
_context.next = 20;
|
|
110
|
+
break;
|
|
111
|
+
case 13:
|
|
112
|
+
_context.prev = 13;
|
|
113
|
+
_context.t0 = _context["catch"](1);
|
|
114
|
+
num = _context.t0 === null || _context.t0 === void 0 ? void 0 : (_errors$errorFields = _context.t0.errorFields) === null || _errors$errorFields === void 0 ? void 0 : _errors$errorFields.length;
|
|
115
|
+
if (num) {
|
|
116
|
+
setLocalData(false);
|
|
117
|
+
console.error(_context.t0);
|
|
118
|
+
}
|
|
119
|
+
setErrorCollection(_defineProperty({}, id, num));
|
|
120
|
+
setLoading(false);
|
|
121
|
+
return _context.abrupt("return", _context.t0);
|
|
122
|
+
case 20:
|
|
123
|
+
return _context.abrupt("return", values[id]);
|
|
124
|
+
case 21:
|
|
125
|
+
case "end":
|
|
126
|
+
return _context.stop();
|
|
127
|
+
}
|
|
128
|
+
}, _callee, null, [[1, 13]]);
|
|
129
|
+
}));
|
|
130
|
+
return function subEvent() {
|
|
131
|
+
return _ref5.apply(this, arguments);
|
|
132
|
+
};
|
|
133
|
+
}();
|
|
134
|
+
record.subEvent = subEvent;
|
|
135
|
+
if (title && !(registerMap === null || registerMap === void 0 ? void 0 : (_registerMap$current = registerMap.current) === null || _registerMap$current === void 0 ? void 0 : _registerMap$current[id])) {
|
|
136
|
+
registerMap.current[id] = record;
|
|
137
|
+
}
|
|
138
|
+
emitter.useSubscription(subEvent);
|
|
126
139
|
};
|
|
127
140
|
var notify = /*#__PURE__*/function () {
|
|
128
141
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
129
142
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
130
143
|
while (1) switch (_context2.prev = _context2.next) {
|
|
131
144
|
case 0:
|
|
132
|
-
|
|
145
|
+
setLoading(true);
|
|
146
|
+
_context2.next = 3;
|
|
133
147
|
return emitter.emit();
|
|
134
|
-
case 2:
|
|
135
|
-
return _context2.abrupt("return", values);
|
|
136
148
|
case 3:
|
|
149
|
+
return _context2.abrupt("return", values);
|
|
150
|
+
case 4:
|
|
137
151
|
case "end":
|
|
138
152
|
return _context2.stop();
|
|
139
153
|
}
|
|
@@ -164,6 +178,41 @@ var ProStep = function ProStep(_ref) {
|
|
|
164
178
|
};
|
|
165
179
|
observer.observe(targetElement, config);
|
|
166
180
|
};
|
|
181
|
+
var triggerTo = /*#__PURE__*/function () {
|
|
182
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(keys) {
|
|
183
|
+
var events, result, nextErrorCollection;
|
|
184
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
185
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
186
|
+
case 0:
|
|
187
|
+
events = [];
|
|
188
|
+
keys === null || keys === void 0 ? void 0 : keys.forEach(function (key) {
|
|
189
|
+
var _registerMap$current2, _registerMap$current3, _registerMap$current4;
|
|
190
|
+
events.push(registerMap === null || registerMap === void 0 ? void 0 : (_registerMap$current2 = registerMap.current) === null || _registerMap$current2 === void 0 ? void 0 : (_registerMap$current3 = _registerMap$current2[key]) === null || _registerMap$current3 === void 0 ? void 0 : (_registerMap$current4 = _registerMap$current3.subEvent) === null || _registerMap$current4 === void 0 ? void 0 : _registerMap$current4.call(_registerMap$current3));
|
|
191
|
+
});
|
|
192
|
+
_context3.next = 4;
|
|
193
|
+
return Promise.all(events);
|
|
194
|
+
case 4:
|
|
195
|
+
result = _context3.sent;
|
|
196
|
+
nextErrorCollection = {};
|
|
197
|
+
result === null || result === void 0 ? void 0 : result.forEach(function (item, index) {
|
|
198
|
+
var _item$errorFields;
|
|
199
|
+
if (item === null || item === void 0 ? void 0 : (_item$errorFields = item.errorFields) === null || _item$errorFields === void 0 ? void 0 : _item$errorFields.length) {
|
|
200
|
+
var _item$errorFields2;
|
|
201
|
+
nextErrorCollection[keys[index]] = item === null || item === void 0 ? void 0 : (_item$errorFields2 = item.errorFields) === null || _item$errorFields2 === void 0 ? void 0 : _item$errorFields2.length;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
setErrorCollection(nextErrorCollection);
|
|
205
|
+
return _context3.abrupt("return", result);
|
|
206
|
+
case 9:
|
|
207
|
+
case "end":
|
|
208
|
+
return _context3.stop();
|
|
209
|
+
}
|
|
210
|
+
}, _callee3);
|
|
211
|
+
}));
|
|
212
|
+
return function triggerTo(_x) {
|
|
213
|
+
return _ref7.apply(this, arguments);
|
|
214
|
+
};
|
|
215
|
+
}();
|
|
167
216
|
useDeepCompareEffect(function () {
|
|
168
217
|
var errorModuleKeys = Object.keys(errorCollection).reverse();
|
|
169
218
|
if (errorModuleKeys === null || errorModuleKeys === void 0 ? void 0 : errorModuleKeys.length) {
|
|
@@ -188,7 +237,10 @@ var ProStep = function ProStep(_ref) {
|
|
|
188
237
|
collapse: collapse,
|
|
189
238
|
register: register,
|
|
190
239
|
notify: notify,
|
|
191
|
-
|
|
240
|
+
triggerTo: triggerTo,
|
|
241
|
+
handleScroll: handleScroll,
|
|
242
|
+
loading: loading,
|
|
243
|
+
setLoading: setLoading
|
|
192
244
|
},
|
|
193
245
|
children: _jsxs("div", {
|
|
194
246
|
className: "pro-step-wrapper",
|
|
@@ -85,6 +85,7 @@ export interface RequestOptions<T, R> {
|
|
|
85
85
|
onPageChange?: (page: PaginationProps) => void;
|
|
86
86
|
transformParams?: (params: any, requestParams: any) => any;
|
|
87
87
|
transformResponse?: (res: any) => ListResponse<R>;
|
|
88
|
+
disabled?: (record: any) => boolean;
|
|
88
89
|
}
|
|
89
90
|
export interface Params<T = any> extends PaginationProps {
|
|
90
91
|
queryBean?: Partial<T>;
|
|
@@ -60,7 +60,8 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
|
60
60
|
crossPageSelect = _useDefaultOptions$cr === void 0 ? false : _useDefaultOptions$cr,
|
|
61
61
|
onPageChange = _useDefaultOptions.onPageChange,
|
|
62
62
|
transformParams = _useDefaultOptions.transformParams,
|
|
63
|
-
transformResponse = _useDefaultOptions.transformResponse
|
|
63
|
+
transformResponse = _useDefaultOptions.transformResponse,
|
|
64
|
+
disabled = _useDefaultOptions.disabled;
|
|
64
65
|
var _ref = useRequestOptions || {},
|
|
65
66
|
defaultParams = _ref.defaultParams,
|
|
66
67
|
manual = _ref.manual;
|
|
@@ -136,12 +137,29 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
|
136
137
|
var filterList = data.filter(function (item) {
|
|
137
138
|
return !selectedRowKeys.includes(item === null || item === void 0 ? void 0 : item[rowKey]);
|
|
138
139
|
});
|
|
139
|
-
|
|
140
|
+
var nextObject = {
|
|
140
141
|
selectedRecords: [].concat(_toConsumableArray(selectedRecords), _toConsumableArray(filterList)),
|
|
141
142
|
selectedRowKeys: [].concat(_toConsumableArray(selectedRowKeys), _toConsumableArray(filterList === null || filterList === void 0 ? void 0 : filterList.map(function (item) {
|
|
142
143
|
return item === null || item === void 0 ? void 0 : item[rowKey];
|
|
143
144
|
})))
|
|
144
|
-
}
|
|
145
|
+
};
|
|
146
|
+
if (typeof disabled === 'function') {
|
|
147
|
+
var _selectedRecords$filt, _nextSelectRecords$ma;
|
|
148
|
+
var _nextObject = nextObject,
|
|
149
|
+
_selectedRecords = _nextObject.selectedRecords;
|
|
150
|
+
var nextSelectRecords = (_selectedRecords$filt = _selectedRecords.filter(function (item) {
|
|
151
|
+
// 去掉禁用的
|
|
152
|
+
return !disabled(item);
|
|
153
|
+
})) !== null && _selectedRecords$filt !== void 0 ? _selectedRecords$filt : [];
|
|
154
|
+
var nextSelectedRowKeys = (_nextSelectRecords$ma = nextSelectRecords.map(function (item) {
|
|
155
|
+
return item === null || item === void 0 ? void 0 : item[rowKey];
|
|
156
|
+
})) !== null && _nextSelectRecords$ma !== void 0 ? _nextSelectRecords$ma : [];
|
|
157
|
+
nextObject = {
|
|
158
|
+
selectedRecords: nextSelectRecords,
|
|
159
|
+
selectedRowKeys: nextSelectedRowKeys
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
setState(nextObject);
|
|
145
163
|
}
|
|
146
164
|
}, [allSelected, data]);
|
|
147
165
|
// 分页变更
|
|
@@ -282,6 +300,7 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
|
282
300
|
}
|
|
283
301
|
}, [curService]);
|
|
284
302
|
useDeepCompareEffect(function () {
|
|
303
|
+
// extraParams改变时重新请求
|
|
285
304
|
if (!manual && extraParams) {
|
|
286
305
|
var newPage = {
|
|
287
306
|
pageNum: 1,
|
package/es/ProTable/utils.js
CHANGED
|
@@ -116,12 +116,16 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
|
|
|
116
116
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
117
117
|
return '-';
|
|
118
118
|
}
|
|
119
|
+
var node = _jsxs(_Space, {
|
|
120
|
+
size: 8,
|
|
121
|
+
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
122
|
+
});
|
|
119
123
|
return _jsx(RenderColumn, {
|
|
120
124
|
valueType: valueType,
|
|
121
125
|
originalValue: originalValue === undefined ? undefined : originalRenderValue,
|
|
122
126
|
ellipsis: ellipsis,
|
|
123
127
|
width: width,
|
|
124
|
-
node:
|
|
128
|
+
node: node,
|
|
125
129
|
value: value,
|
|
126
130
|
currentValue: renderValue,
|
|
127
131
|
originalDiffTip: originalDiffTip,
|