@zat-design/sisyphus-react 3.11.6 → 3.11.7
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/RcTable/BaseTable.js +19 -9
- package/es/ProEditTable/index.js +24 -15
- package/es/ProEditTable/propsType.d.ts +0 -1
- package/es/ProEditTable/utils/tools.d.ts +2 -2
- package/es/ProEditTable/utils/tools.js +4 -11
- package/es/ProEditTable/utils/useEditTableError.d.ts +7 -0
- package/es/ProEditTable/utils/useEditTableError.js +81 -0
- package/es/ProEnum/hooks/useEnumRequest.js +2 -1
- package/es/ProEnum/index.js +2 -1
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +49 -44
- package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +4 -0
- package/es/ProForm/components/combination/ProRangeLimit/index.js +4 -2
- package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +4 -0
- package/es/ProForm/components/combination/ProTimeLimit/index.js +4 -2
- package/es/ProForm/components/render/RenderFields.d.ts +2 -0
- package/es/ProForm/components/render/RenderFields.js +5 -2
- package/es/ProForm/components/render/propsType.d.ts +4 -0
- package/es/ProSelect/index.js +2 -1
- package/es/ProTable/hooks/useAntdTable.js +9 -2
- package/es/ProTabs/index.js +2 -1
- package/es/ProTree/components/ProTree.js +2 -1
- package/es/ProTree/components/ProTreeSelect/index.js +2 -1
- package/es/ProTreeModal/index.js +2 -1
- package/lib/ProEditTable/components/RcTable/BaseTable.js +19 -9
- package/lib/ProEditTable/index.js +24 -15
- package/lib/ProEditTable/propsType.d.ts +0 -1
- package/lib/ProEditTable/utils/tools.d.ts +2 -2
- package/lib/ProEditTable/utils/tools.js +4 -11
- package/lib/ProEditTable/utils/useEditTableError.d.ts +7 -0
- package/lib/ProEditTable/utils/useEditTableError.js +88 -0
- package/lib/ProEnum/hooks/useEnumRequest.js +2 -1
- package/lib/ProEnum/index.js +2 -1
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -1
- package/lib/ProForm/components/combination/ProModalSelect/index.js +49 -44
- package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +4 -0
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +4 -2
- package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +4 -0
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +4 -2
- package/lib/ProForm/components/render/RenderFields.d.ts +2 -0
- package/lib/ProForm/components/render/RenderFields.js +5 -2
- package/lib/ProForm/components/render/propsType.d.ts +4 -0
- package/lib/ProSelect/index.js +2 -1
- package/lib/ProTable/hooks/useAntdTable.js +9 -2
- package/lib/ProTabs/index.js +2 -1
- package/lib/ProTree/components/ProTree.js +2 -1
- package/lib/ProTree/components/ProTreeSelect/index.js +2 -1
- package/lib/ProTreeModal/index.js +2 -1
- package/package.json +1 -1
@@ -182,6 +182,8 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
182
182
|
}) => React.ReactElement<any, any> | string | undefined | null;
|
183
183
|
viewType?: ViewType;
|
184
184
|
colProps?: ColProps;
|
185
|
+
/** 列宽占比 */
|
186
|
+
span?: number;
|
185
187
|
/** 依赖刷新字段列表 */
|
186
188
|
dependNames?: NamePath[];
|
187
189
|
/**
|
@@ -265,6 +267,8 @@ export interface RenderProps<Values = any> {
|
|
265
267
|
disabledStrictly?: boolean;
|
266
268
|
[name: string]: any;
|
267
269
|
};
|
270
|
+
/** 列宽占比 */
|
271
|
+
span?: number;
|
268
272
|
show?: boolean | ((values: Values, { form, index, namePath, }: {
|
269
273
|
form: FormInstance<Values>;
|
270
274
|
index?: number;
|
package/es/ProSelect/index.js
CHANGED
@@ -160,7 +160,8 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
160
160
|
if (manual || (cacheList === null || cacheList === void 0 ? void 0 : cacheList.length)) {
|
161
161
|
return;
|
162
162
|
}
|
163
|
-
|
163
|
+
var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
164
|
+
fetchFunction.run(params);
|
164
165
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options, defaultDisableValue]);
|
165
166
|
// disable默认值
|
166
167
|
if (defaultDisableValue) {
|
@@ -117,8 +117,7 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
117
117
|
}, [extraParams]);
|
118
118
|
// 调接口
|
119
119
|
var result = useRequest(service, _objectSpread(_objectSpread({
|
120
|
-
debounceWait: 300
|
121
|
-
refreshDeps: [curService, curExtraParams]
|
120
|
+
debounceWait: 300
|
122
121
|
}, useRequestOptions), {}, {
|
123
122
|
defaultParams: [getTransformParams()],
|
124
123
|
onSuccess: function onSuccess(res, params) {
|
@@ -151,6 +150,14 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
151
150
|
selectedRowKeys: []
|
152
151
|
});
|
153
152
|
}, []);
|
153
|
+
/**
|
154
|
+
* 手动触发时,手动调用run
|
155
|
+
*/
|
156
|
+
useEffect(function () {
|
157
|
+
if (!(useRequestOptions === null || useRequestOptions === void 0 ? void 0 : useRequestOptions.manual)) {
|
158
|
+
run(getTransformParams());
|
159
|
+
}
|
160
|
+
}, [useRequestOptions === null || useRequestOptions === void 0 ? void 0 : useRequestOptions.manual, curExtraParams, curService]);
|
154
161
|
useDeepCompareEffect(function () {
|
155
162
|
if (allSelected) {
|
156
163
|
var filterList = data.filter(function (item) {
|
package/es/ProTabs/index.js
CHANGED
@@ -85,10 +85,11 @@ var ProTabs = function ProTabs(props, ref) {
|
|
85
85
|
var _ref = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
86
86
|
defaultParams = _ref.defaultParams,
|
87
87
|
manual = _ref.manual;
|
88
|
+
var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
88
89
|
if (manual || !useRequest) {
|
89
90
|
return;
|
90
91
|
}
|
91
|
-
fetchFunction.run(
|
92
|
+
fetchFunction.run(params);
|
92
93
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
|
93
94
|
useImperativeHandle(ref, function () {
|
94
95
|
return {
|
@@ -174,11 +174,12 @@ var ProTree = function ProTree(props) {
|
|
174
174
|
var _ref = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
175
175
|
defaultParams = _ref.defaultParams,
|
176
176
|
manual = _ref.manual;
|
177
|
+
var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
177
178
|
if (manual) {
|
178
179
|
return;
|
179
180
|
}
|
180
181
|
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
181
|
-
fetchFunction.run(
|
182
|
+
fetchFunction.run(params);
|
182
183
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
|
183
184
|
var handleSignalSelect = function handleSignalSelect(value) {
|
184
185
|
var checkedValues = [];
|
@@ -219,8 +219,9 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
219
219
|
// 如果配置手动加载,不执行请求
|
220
220
|
var _ref4 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
221
221
|
defaultParams = _ref4.defaultParams;
|
222
|
+
var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
222
223
|
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
223
|
-
fetchFunction.run(
|
224
|
+
fetchFunction.run(params);
|
224
225
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, defaultDisableValue]);
|
225
226
|
// disable默认值
|
226
227
|
if (defaultDisableValue) {
|
package/es/ProTreeModal/index.js
CHANGED
@@ -166,11 +166,12 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
166
166
|
var _ref = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
167
167
|
defaultParams = _ref.defaultParams,
|
168
168
|
manual = _ref.manual;
|
169
|
+
var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
169
170
|
if (manual) {
|
170
171
|
return;
|
171
172
|
}
|
172
173
|
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
173
|
-
fetchFunction.run(
|
174
|
+
fetchFunction.run(params);
|
174
175
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
|
175
176
|
useEffect(function () {
|
176
177
|
setState({
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.default = void 0;
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
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
13
|
var _antd = require("antd");
|
14
|
+
var _useEditTableError3 = _interopRequireDefault(require("../../utils/useEditTableError"));
|
13
15
|
var _excluded = ["tableProps"];
|
14
16
|
var BaseTable = function BaseTable(_ref) {
|
15
17
|
var _value$;
|
@@ -33,8 +35,14 @@ var BaseTable = function BaseTable(_ref) {
|
|
33
35
|
page = tableProps.page,
|
34
36
|
formatMessage = tableProps.formatMessage,
|
35
37
|
locale = tableProps.locale,
|
36
|
-
handlePageChange = tableProps.handlePageChange
|
37
|
-
|
38
|
+
handlePageChange = tableProps.handlePageChange;
|
39
|
+
var _useEditTableError = (0, _useEditTableError3.default)({
|
40
|
+
containerNode: tableRef.current,
|
41
|
+
className: 'ant-form-item-explain-error',
|
42
|
+
isEnabled: pagination // 分页时启用
|
43
|
+
}),
|
44
|
+
_useEditTableError2 = (0, _slicedToArray2.default)(_useEditTableError, 1),
|
45
|
+
errorLength = _useEditTableError2[0];
|
38
46
|
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
39
47
|
children: [headerRender ? (0, _jsxRuntime.jsx)("div", {
|
40
48
|
className: "pro-edit-table-header",
|
@@ -55,10 +63,9 @@ var BaseTable = function BaseTable(_ref) {
|
|
55
63
|
};
|
56
64
|
}
|
57
65
|
}, resetProps), {}, {
|
58
|
-
pagination: pagination ? (0, _objectSpread2.default)({
|
59
|
-
|
60
|
-
|
61
|
-
showSizeChanger: false,
|
66
|
+
pagination: pagination ? (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
67
|
+
showSizeChanger: true,
|
68
|
+
pageSizeOptions: [5, 10, 20, 50],
|
62
69
|
showQuickJumper: true,
|
63
70
|
total: value === null || value === void 0 ? void 0 : value.length,
|
64
71
|
showTotal: function showTotal(total) {
|
@@ -69,15 +76,18 @@ var BaseTable = function BaseTable(_ref) {
|
|
69
76
|
});
|
70
77
|
},
|
71
78
|
itemRender: function itemRender(index, type, originalElement) {
|
72
|
-
return type === 'page' && page.pageNum === index &&
|
79
|
+
return type === 'page' && page.pageNum === index && errorLength ? (0, _jsxRuntime.jsxs)("div", {
|
73
80
|
className: "pro-edit-table-pagination-item-badge",
|
74
81
|
children: [(0, _jsxRuntime.jsx)(_antd.Badge, {
|
75
|
-
count:
|
82
|
+
count: errorLength
|
76
83
|
}), originalElement]
|
77
84
|
}) : originalElement;
|
78
85
|
},
|
79
86
|
onChange: handlePageChange
|
80
|
-
}, pagination)
|
87
|
+
}, pagination), {}, {
|
88
|
+
current: page.pageNum,
|
89
|
+
pageSize: page.pageSize
|
90
|
+
}) : false,
|
81
91
|
rowKey: "rowKey",
|
82
92
|
scroll: {
|
83
93
|
x: scroll === null || scroll === void 0 ? void 0 : scroll.x,
|
@@ -102,8 +102,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
102
102
|
page: {
|
103
103
|
pageNum: 1,
|
104
104
|
pageSize: (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || 10
|
105
|
-
}
|
106
|
-
pageErrorNum: 0
|
105
|
+
}
|
107
106
|
}),
|
108
107
|
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
109
108
|
state = _useSetState2[0],
|
@@ -114,8 +113,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
114
113
|
virtualKey = state.virtualKey,
|
115
114
|
selectedRowKeys = state.selectedRowKeys,
|
116
115
|
selectedRows = state.selectedRows,
|
117
|
-
page = state.page
|
118
|
-
pageErrorNum = state.pageErrorNum;
|
116
|
+
page = state.page;
|
119
117
|
var virtualRowName = (0, _tools.getNamePath)((0, _lodash.isArray)(name) ? name : [name], virtualKey);
|
120
118
|
// 样式处理
|
121
119
|
var _className = (0, _classnames.default)({
|
@@ -174,32 +172,44 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
174
172
|
case 0:
|
175
173
|
_context.prev = 0;
|
176
174
|
if (!pagination) {
|
175
|
+
_context.next = 8;
|
176
|
+
break;
|
177
|
+
}
|
178
|
+
if (!(pageSize !== page.pageSize)) {
|
177
179
|
_context.next = 5;
|
178
180
|
break;
|
179
181
|
}
|
180
|
-
|
182
|
+
setState({
|
183
|
+
page: {
|
184
|
+
pageNum: current,
|
185
|
+
pageSize: pageSize
|
186
|
+
}
|
187
|
+
});
|
188
|
+
return _context.abrupt("return");
|
189
|
+
case 5:
|
190
|
+
_context.next = 7;
|
181
191
|
return form.validateFields([name], {
|
182
192
|
recursive: true
|
183
193
|
});
|
184
|
-
case
|
194
|
+
case 7:
|
185
195
|
setState({
|
186
196
|
page: {
|
187
197
|
pageNum: current,
|
188
198
|
pageSize: pageSize !== null && pageSize !== void 0 ? pageSize : page.pageSize
|
189
199
|
}
|
190
200
|
});
|
191
|
-
case
|
192
|
-
_context.next =
|
201
|
+
case 8:
|
202
|
+
_context.next = 13;
|
193
203
|
break;
|
194
|
-
case
|
195
|
-
_context.prev =
|
204
|
+
case 10:
|
205
|
+
_context.prev = 10;
|
196
206
|
_context.t0 = _context["catch"](0);
|
197
207
|
(0, _tools.handleScrollToError)();
|
198
|
-
case
|
208
|
+
case 13:
|
199
209
|
case "end":
|
200
210
|
return _context.stop();
|
201
211
|
}
|
202
|
-
}, _callee, null, [[0,
|
212
|
+
}, _callee, null, [[0, 10]]);
|
203
213
|
}));
|
204
214
|
return function (_x, _x2) {
|
205
215
|
return _ref4.apply(this, arguments);
|
@@ -416,7 +426,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
416
426
|
page: page,
|
417
427
|
formatMessage: _locale.formatMessage,
|
418
428
|
locale: _locale.default,
|
419
|
-
pageErrorNum: pageErrorNum,
|
420
429
|
handlePageChange: handlePageChange
|
421
430
|
}
|
422
431
|
})), !isView && (value === null || value === void 0 ? void 0 : value.length) ? toolbarSticky ? (0, _jsxRuntime.jsx)(_antd.Affix, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
@@ -442,9 +451,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
442
451
|
columns: columns,
|
443
452
|
page: page,
|
444
453
|
pagination: pagination,
|
445
|
-
setState: setState,
|
446
454
|
isView: isView,
|
447
|
-
disabled: disabled
|
455
|
+
disabled: disabled,
|
456
|
+
setState: setState
|
448
457
|
});
|
449
458
|
}
|
450
459
|
}) : null]
|
@@ -38,14 +38,14 @@ export declare function cloneDeepFilterNode(value: any): any;
|
|
38
38
|
/**
|
39
39
|
* 分页校验
|
40
40
|
*/
|
41
|
-
export declare const onPageCheck: ({ form, name, value, columns, page, pagination,
|
41
|
+
export declare const onPageCheck: ({ form, name, value, columns, setState, page, pagination, isView, disabled }: {
|
42
42
|
form: any;
|
43
43
|
name: any;
|
44
44
|
value: any;
|
45
45
|
columns: any;
|
46
|
+
setState: any;
|
46
47
|
page: any;
|
47
48
|
pagination: any;
|
48
|
-
setState: any;
|
49
49
|
isView: any;
|
50
50
|
disabled: any;
|
51
51
|
}) => Promise<void>;
|
@@ -348,13 +348,13 @@ var handleCheckCellValue = /*#__PURE__*/function () {
|
|
348
348
|
*/
|
349
349
|
var onPageCheck = exports.onPageCheck = /*#__PURE__*/function () {
|
350
350
|
var _ref8 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(_ref7) {
|
351
|
-
var form, name, value, columns, page, pagination,
|
351
|
+
var form, name, value, columns, setState, page, pagination, isView, disabled, pageNum, pageSize, pageArr, flag, errorNum, errorPageNum, _i, _pageArr, item, start, end, nextValues, _iterator2, _step2, record, _iterator3, _step3, column, result, nextState;
|
352
352
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
353
353
|
while (1) switch (_context2.prev = _context2.next) {
|
354
354
|
case 0:
|
355
|
-
form = _ref7.form, name = _ref7.name, value = _ref7.value, columns = _ref7.columns,
|
355
|
+
form = _ref7.form, name = _ref7.name, value = _ref7.value, columns = _ref7.columns, setState = _ref7.setState, page = _ref7.page, pagination = _ref7.pagination, isView = _ref7.isView, disabled = _ref7.disabled;
|
356
356
|
if (!(pagination && !isView && !disabled)) {
|
357
|
-
_context2.next =
|
357
|
+
_context2.next = 72;
|
358
358
|
break;
|
359
359
|
}
|
360
360
|
pageNum = page.pageNum, pageSize = page.pageSize;
|
@@ -456,7 +456,7 @@ var onPageCheck = exports.onPageCheck = /*#__PURE__*/function () {
|
|
456
456
|
break;
|
457
457
|
case 60:
|
458
458
|
if (!(flag && errorNum > 0)) {
|
459
|
-
_context2.next =
|
459
|
+
_context2.next = 72;
|
460
460
|
break;
|
461
461
|
}
|
462
462
|
nextState = {
|
@@ -482,13 +482,6 @@ var onPageCheck = exports.onPageCheck = /*#__PURE__*/function () {
|
|
482
482
|
_context2.t3 = _context2["catch"](64);
|
483
483
|
handleScrollToError();
|
484
484
|
case 72:
|
485
|
-
_context2.next = 75;
|
486
|
-
break;
|
487
|
-
case 74:
|
488
|
-
setState({
|
489
|
-
pageErrorNum: 0
|
490
|
-
});
|
491
|
-
case 75:
|
492
485
|
case "end":
|
493
486
|
return _context2.stop();
|
494
487
|
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
interface UseEditTableErrorProps {
|
2
|
+
containerNode: HTMLElement | null;
|
3
|
+
className: string;
|
4
|
+
isEnabled: boolean;
|
5
|
+
}
|
6
|
+
declare const useEditTableError: ({ containerNode, className, isEnabled }: UseEditTableErrorProps) => [number];
|
7
|
+
export default useEditTableError;
|
@@ -0,0 +1,88 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.default = void 0;
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
|
+
var _react = require("react");
|
10
|
+
var _lodash = require("lodash");
|
11
|
+
var useEditTableError = function useEditTableError(_ref) {
|
12
|
+
var containerNode = _ref.containerNode,
|
13
|
+
className = _ref.className,
|
14
|
+
isEnabled = _ref.isEnabled;
|
15
|
+
var _useState = (0, _react.useState)(0),
|
16
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
17
|
+
errorLength = _useState2[0],
|
18
|
+
setErrorLength = _useState2[1];
|
19
|
+
(0, _react.useEffect)(function () {
|
20
|
+
// 如果 isEnabled 为 false 或容器节点不存在,直接跳过监听
|
21
|
+
if (!isEnabled || !containerNode) {
|
22
|
+
return; // 如果未启用监听或容器节点不存在,直接返回
|
23
|
+
}
|
24
|
+
// 防抖处理:将 setErrorLength 函数进行防抖
|
25
|
+
var debouncedSetErrorLength = (0, _lodash.debounce)(function (errorCount) {
|
26
|
+
setErrorLength(errorCount); // 更新错误数量
|
27
|
+
}, 300); // 300ms 后更新状态
|
28
|
+
var observer = new MutationObserver(function (mutations) {
|
29
|
+
mutations.forEach(function (mutation) {
|
30
|
+
// 只处理节点的 class 属性变化
|
31
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
32
|
+
var target = mutation.target;
|
33
|
+
// 检查目标节点是否包含指定的类
|
34
|
+
if (target.classList.contains(className)) {
|
35
|
+
// 查找所有包含 className 的节点
|
36
|
+
var errorNodes = containerNode.querySelectorAll(".".concat(className));
|
37
|
+
// debugger;
|
38
|
+
// 过滤这些节点,只保留那些类名完全为 `ant-form-item-explain-error` 的节点
|
39
|
+
var validErrorNodes = Array.from(errorNodes).filter(function (node) {
|
40
|
+
return node.classList.length === 1 && node.classList.contains('ant-form-item-explain-error');
|
41
|
+
});
|
42
|
+
if (errorLength === 0) {
|
43
|
+
debouncedSetErrorLength(0);
|
44
|
+
}
|
45
|
+
if (errorLength === validErrorNodes.length) {
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
// 使用防抖后的方法更新错误数量
|
49
|
+
debouncedSetErrorLength(validErrorNodes.length);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
// 监听子节点的添加或删除
|
53
|
+
if (mutation.type === 'childList') {
|
54
|
+
// 检查删除的节点是否包含指定的类名
|
55
|
+
mutation.removedNodes.forEach(function (removedNode) {
|
56
|
+
if (removedNode instanceof HTMLElement && removedNode.classList.contains('ant-table-row')) {
|
57
|
+
// 更新错误数量
|
58
|
+
var _errorNodes = containerNode.querySelectorAll(".".concat(className));
|
59
|
+
if (errorLength === 0) {
|
60
|
+
debouncedSetErrorLength(0);
|
61
|
+
}
|
62
|
+
if (errorLength === _errorNodes.length) {
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
// 使用防抖后的方法更新错误数量
|
66
|
+
debouncedSetErrorLength(_errorNodes.length);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
}
|
70
|
+
});
|
71
|
+
});
|
72
|
+
var config = {
|
73
|
+
attributes: true,
|
74
|
+
subtree: true,
|
75
|
+
attributeFilter: ['class'],
|
76
|
+
childList: true
|
77
|
+
};
|
78
|
+
// 启动 MutationObserver
|
79
|
+
observer.observe(containerNode.querySelector('tbody'), config);
|
80
|
+
// 清理 MutationObserver 和防抖定时器
|
81
|
+
return function () {
|
82
|
+
observer.disconnect();
|
83
|
+
debouncedSetErrorLength.cancel(); // 取消防抖定时器
|
84
|
+
};
|
85
|
+
}, [containerNode, className, isEnabled]); // 当 isEnabled 改变时会重新启动或取消监听
|
86
|
+
return [errorLength];
|
87
|
+
};
|
88
|
+
var _default = exports.default = useEditTableError;
|
@@ -263,11 +263,12 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
263
263
|
if (useRequest && (useRequest === null || useRequest === void 0 ? void 0 : useRequest.service)) {
|
264
264
|
var _ref4 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
265
265
|
defaultParams = _ref4.defaultParams;
|
266
|
+
var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
266
267
|
if (requestRefresh) {
|
267
268
|
window.localStorage.removeItem(cacheKey);
|
268
269
|
window.sessionStorage.removeItem(cacheKey);
|
269
270
|
}
|
270
|
-
enumRes.run(
|
271
|
+
enumRes.run(params);
|
271
272
|
// TODO 这段代码目前看起来是没啥用的、没起到作用
|
272
273
|
mergeData();
|
273
274
|
} else if (Object.keys(dataSource)) {
|
package/lib/ProEnum/index.js
CHANGED
@@ -128,8 +128,9 @@ var ProEnum = function ProEnum(props) {
|
|
128
128
|
(0, _ahooks.useDeepCompareEffect)(function () {
|
129
129
|
var _ref3 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
130
130
|
defaultParams = _ref3.defaultParams;
|
131
|
+
var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
131
132
|
if (useRequest === null || useRequest === void 0 ? void 0 : useRequest.service) {
|
132
|
-
run(
|
133
|
+
run(params);
|
133
134
|
}
|
134
135
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
|
135
136
|
var enumLists = (0, _react.useMemo)(function () {
|
@@ -58,6 +58,7 @@ function useRequestList(service, options, useRequestOptions) {
|
|
58
58
|
transformResponse = _useDefaultOptions.transformResponse;
|
59
59
|
var _ref2 = useRequestOptions || {},
|
60
60
|
defaultParams = _ref2.defaultParams;
|
61
|
+
var _defaultParams = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
61
62
|
// 搜索表单里的值
|
62
63
|
var _useState3 = (0, _react.useState)(),
|
63
64
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
@@ -65,7 +66,7 @@ function useRequestList(service, options, useRequestOptions) {
|
|
65
66
|
setSearchValues = _useState4[1];
|
66
67
|
// 当次执行service的请求,包括page参数
|
67
68
|
var params = (0, _react.useMemo)(function () {
|
68
|
-
var _condition = (0, _objectSpread2.default)((0, _objectSpread2.default)({},
|
69
|
+
var _condition = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _defaultParams), searchValues);
|
69
70
|
var tempParams = withPagination ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, page), {}, {
|
70
71
|
queryBean: _condition !== null && _condition !== void 0 ? _condition : {}
|
71
72
|
}) : _condition;
|