@fle-ui/plus-table 1.2.30-beta.0 → 1.2.30-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/index.js +67 -80
- package/lib/index.js +65 -80
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "antd/es/config-provider/style";
|
|
2
|
+
import _ConfigProvider from "antd/es/config-provider";
|
|
1
3
|
import "antd/es/drawer/style";
|
|
2
4
|
import _Drawer from "antd/es/drawer";
|
|
3
5
|
import "antd/es/checkbox/style";
|
|
@@ -213,7 +215,7 @@ function PlusTable(props, ref) {
|
|
|
213
215
|
}, _callee4, null, [[1, 8, 11, 14]]);
|
|
214
216
|
})), [props.updateSetting, columnsStateMap]);
|
|
215
217
|
var handleReset = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
216
|
-
var _props$resetSetting, res;
|
|
218
|
+
var _props$resetSetting, res, fetchRes;
|
|
217
219
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
218
220
|
while (1) switch (_context5.prev = _context5.next) {
|
|
219
221
|
case 0:
|
|
@@ -222,53 +224,28 @@ function PlusTable(props, ref) {
|
|
|
222
224
|
return (_props$resetSetting = props.resetSetting) === null || _props$resetSetting === void 0 ? void 0 : _props$resetSetting.call(props);
|
|
223
225
|
case 3:
|
|
224
226
|
res = _context5.sent;
|
|
225
|
-
if (!(res === null || res === void 0 ? void 0 : res.success)) {
|
|
226
|
-
_context5.next =
|
|
227
|
+
if (!((res === null || res === void 0 ? void 0 : res.success) && props.fetchSetting)) {
|
|
228
|
+
_context5.next = 9;
|
|
227
229
|
break;
|
|
228
230
|
}
|
|
229
231
|
_context5.next = 7;
|
|
230
|
-
return
|
|
232
|
+
return props.fetchSetting();
|
|
231
233
|
case 7:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
+
fetchRes = _context5.sent;
|
|
235
|
+
setColumnsStateMap(fetchRes);
|
|
234
236
|
case 9:
|
|
235
|
-
_context5.
|
|
237
|
+
_context5.next = 14;
|
|
238
|
+
break;
|
|
239
|
+
case 11:
|
|
240
|
+
_context5.prev = 11;
|
|
236
241
|
_context5.t0 = _context5["catch"](0);
|
|
237
242
|
console.error('重置列设置失败:', _context5.t0);
|
|
238
|
-
case
|
|
243
|
+
case 14:
|
|
239
244
|
case "end":
|
|
240
245
|
return _context5.stop();
|
|
241
246
|
}
|
|
242
|
-
}, _callee5, null, [[0,
|
|
243
|
-
})), [props.resetSetting]);
|
|
244
|
-
// 优化:使用 useCallback 避免重复创建函数
|
|
245
|
-
var init = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
246
|
-
var res;
|
|
247
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
248
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
249
|
-
case 0:
|
|
250
|
-
if (!props.fetchSetting) {
|
|
251
|
-
_context6.next = 11;
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
_context6.prev = 1;
|
|
255
|
-
_context6.next = 4;
|
|
256
|
-
return props.fetchSetting();
|
|
257
|
-
case 4:
|
|
258
|
-
res = _context6.sent;
|
|
259
|
-
setColumnsStateMap(res);
|
|
260
|
-
_context6.next = 11;
|
|
261
|
-
break;
|
|
262
|
-
case 8:
|
|
263
|
-
_context6.prev = 8;
|
|
264
|
-
_context6.t0 = _context6["catch"](1);
|
|
265
|
-
console.error('获取列设置失败:', _context6.t0);
|
|
266
|
-
case 11:
|
|
267
|
-
case "end":
|
|
268
|
-
return _context6.stop();
|
|
269
|
-
}
|
|
270
|
-
}, _callee6, null, [[1, 8]]);
|
|
271
|
-
})), [props.fetchSetting]);
|
|
247
|
+
}, _callee5, null, [[0, 11]]);
|
|
248
|
+
})), [props.resetSetting, props.fetchSetting]);
|
|
272
249
|
var onValuesChange = useCallback(function (changeValue, allValue) {
|
|
273
250
|
try {
|
|
274
251
|
var _drawFormRef$current4;
|
|
@@ -282,9 +259,9 @@ function PlusTable(props, ref) {
|
|
|
282
259
|
}
|
|
283
260
|
}, []);
|
|
284
261
|
var handleSearchAll = useCallback( /*#__PURE__*/function () {
|
|
285
|
-
var
|
|
286
|
-
return _regeneratorRuntime().wrap(function
|
|
287
|
-
while (1) switch (
|
|
262
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(searchConfig) {
|
|
263
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
264
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
288
265
|
case 0:
|
|
289
266
|
try {
|
|
290
267
|
searchConfig.form.submit();
|
|
@@ -293,12 +270,12 @@ function PlusTable(props, ref) {
|
|
|
293
270
|
}
|
|
294
271
|
case 1:
|
|
295
272
|
case "end":
|
|
296
|
-
return
|
|
273
|
+
return _context6.stop();
|
|
297
274
|
}
|
|
298
|
-
},
|
|
275
|
+
}, _callee6);
|
|
299
276
|
}));
|
|
300
277
|
return function (_x4) {
|
|
301
|
-
return
|
|
278
|
+
return _ref6.apply(this, arguments);
|
|
302
279
|
};
|
|
303
280
|
}(), []);
|
|
304
281
|
var handleShowFullChange = useCallback(function (e) {
|
|
@@ -309,35 +286,35 @@ function PlusTable(props, ref) {
|
|
|
309
286
|
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.reload) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current);
|
|
310
287
|
});
|
|
311
288
|
}, []);
|
|
312
|
-
var handleAdvancedFilterClick = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
289
|
+
var handleAdvancedFilterClick = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
313
290
|
var newDrawerState, _searchRef$current5, _drawFormRef$current5, fieldsValue;
|
|
314
|
-
return _regeneratorRuntime().wrap(function
|
|
315
|
-
while (1) switch (
|
|
291
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
292
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
316
293
|
case 0:
|
|
317
|
-
|
|
294
|
+
_context7.prev = 0;
|
|
318
295
|
newDrawerState = !searchDrawer;
|
|
319
296
|
setSearchDrawer(newDrawerState);
|
|
320
297
|
if (!newDrawerState) {
|
|
321
|
-
|
|
298
|
+
_context7.next = 8;
|
|
322
299
|
break;
|
|
323
300
|
}
|
|
324
|
-
|
|
301
|
+
_context7.next = 6;
|
|
325
302
|
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current5 = searchRef.current) === null || _searchRef$current5 === void 0 ? void 0 : _searchRef$current5.getFieldsValue();
|
|
326
303
|
case 6:
|
|
327
|
-
fieldsValue =
|
|
304
|
+
fieldsValue = _context7.sent;
|
|
328
305
|
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current5 = drawFormRef.current) === null || _drawFormRef$current5 === void 0 ? void 0 : _drawFormRef$current5.setFieldsValue(fieldsValue);
|
|
329
306
|
case 8:
|
|
330
|
-
|
|
307
|
+
_context7.next = 13;
|
|
331
308
|
break;
|
|
332
309
|
case 10:
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
console.error('切换高级筛选失败:',
|
|
310
|
+
_context7.prev = 10;
|
|
311
|
+
_context7.t0 = _context7["catch"](0);
|
|
312
|
+
console.error('切换高级筛选失败:', _context7.t0);
|
|
336
313
|
case 13:
|
|
337
314
|
case "end":
|
|
338
|
-
return
|
|
315
|
+
return _context7.stop();
|
|
339
316
|
}
|
|
340
|
-
},
|
|
317
|
+
}, _callee7, null, [[0, 10]]);
|
|
341
318
|
})), [searchDrawer]);
|
|
342
319
|
var handleResetForm = useCallback(function () {
|
|
343
320
|
try {
|
|
@@ -349,9 +326,17 @@ function PlusTable(props, ref) {
|
|
|
349
326
|
console.error('重置表单失败:', error);
|
|
350
327
|
}
|
|
351
328
|
}, []);
|
|
329
|
+
// 修复死循环:只在组件挂载时执行一次,不依赖 init 函数
|
|
352
330
|
useEffect(function () {
|
|
353
|
-
|
|
354
|
-
|
|
331
|
+
// 组件挂载时执行一次初始化
|
|
332
|
+
if (props.fetchSetting) {
|
|
333
|
+
props.fetchSetting().then(function (res) {
|
|
334
|
+
setColumnsStateMap(res);
|
|
335
|
+
}).catch(function (error) {
|
|
336
|
+
console.error('获取列设置失败:', error);
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
}, []); // 空依赖数组,只在挂载时执行一次
|
|
355
340
|
// 优化:使用 useMemo 缓存计算结果
|
|
356
341
|
var dealFetchParams = useCallback(function (params) {
|
|
357
342
|
var fetchParams = {};
|
|
@@ -378,50 +363,51 @@ function PlusTable(props, ref) {
|
|
|
378
363
|
}, [defaultColumnsState, columnsStateMap, handleOnChangeColumn]);
|
|
379
364
|
// 优化:使用 useCallback 缓存请求函数
|
|
380
365
|
var propsRequest = useCallback( /*#__PURE__*/function () {
|
|
381
|
-
var
|
|
366
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params, sort, filter) {
|
|
382
367
|
var _searchRef$current6, _drawFormRef$current7, res1, res2;
|
|
383
|
-
return _regeneratorRuntime().wrap(function
|
|
384
|
-
while (1) switch (
|
|
368
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
369
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
385
370
|
case 0:
|
|
386
|
-
|
|
387
|
-
|
|
371
|
+
_context8.prev = 0;
|
|
372
|
+
_context8.next = 3;
|
|
388
373
|
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current6 = searchRef.current) === null || _searchRef$current6 === void 0 ? void 0 : _searchRef$current6.getFieldsValue();
|
|
389
374
|
case 3:
|
|
390
|
-
res1 =
|
|
391
|
-
|
|
375
|
+
res1 = _context8.sent;
|
|
376
|
+
_context8.next = 6;
|
|
392
377
|
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current7 = drawFormRef.current) === null || _drawFormRef$current7 === void 0 ? void 0 : _drawFormRef$current7.getFieldsValue();
|
|
393
378
|
case 6:
|
|
394
|
-
res2 =
|
|
379
|
+
res2 = _context8.sent;
|
|
395
380
|
if (request) {
|
|
396
|
-
|
|
381
|
+
_context8.next = 9;
|
|
397
382
|
break;
|
|
398
383
|
}
|
|
399
|
-
return
|
|
384
|
+
return _context8.abrupt("return", {});
|
|
400
385
|
case 9:
|
|
401
|
-
|
|
386
|
+
_context8.next = 11;
|
|
402
387
|
return request(_objectSpread(_objectSpread(_objectSpread({}, params), dealFetchParams(_objectSpread(_objectSpread(_objectSpread({}, res1), res2), params))), {}, {
|
|
403
388
|
showFull: showFull
|
|
404
389
|
}), sort, filter);
|
|
405
390
|
case 11:
|
|
406
|
-
return
|
|
391
|
+
return _context8.abrupt("return", _context8.sent);
|
|
407
392
|
case 14:
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
console.error('请求数据失败:',
|
|
411
|
-
return
|
|
393
|
+
_context8.prev = 14;
|
|
394
|
+
_context8.t0 = _context8["catch"](0);
|
|
395
|
+
console.error('请求数据失败:', _context8.t0);
|
|
396
|
+
return _context8.abrupt("return", {});
|
|
412
397
|
case 18:
|
|
413
398
|
case "end":
|
|
414
|
-
return
|
|
399
|
+
return _context8.stop();
|
|
415
400
|
}
|
|
416
|
-
},
|
|
401
|
+
}, _callee8, null, [[0, 14]]);
|
|
417
402
|
}));
|
|
418
403
|
return function (_x5, _x6, _x7) {
|
|
419
|
-
return
|
|
404
|
+
return _ref8.apply(this, arguments);
|
|
420
405
|
};
|
|
421
406
|
}(), [request, dealFetchParams, showFull]);
|
|
422
407
|
// 优化:使用 useMemo 缓存选项配置
|
|
423
408
|
var __options = useMemo(function () {
|
|
424
409
|
var optionsSetting = _typeof(options) === 'object' && _typeof(options.setting) === 'object' ? options.setting : {};
|
|
410
|
+
console.log(action === null || action === void 0 ? void 0 : action.includes('columnSetting'), showDefaultSetting !== true);
|
|
425
411
|
if ((action === null || action === void 0 ? void 0 : action.includes('columnSetting')) && showDefaultSetting !== true) {
|
|
426
412
|
return _objectSpread(_objectSpread({}, options), {}, {
|
|
427
413
|
setting: _objectSpread(_objectSpread({}, optionsSetting), {}, {
|
|
@@ -541,9 +527,10 @@ function PlusTable(props, ref) {
|
|
|
541
527
|
boxSizing: 'border-box'
|
|
542
528
|
};
|
|
543
529
|
}, []);
|
|
544
|
-
console.log('searchConfig', searchConfig);
|
|
545
530
|
return /*#__PURE__*/React.createElement("div", {
|
|
546
531
|
className: "page_plustable__body"
|
|
532
|
+
}, /*#__PURE__*/React.createElement(_ConfigProvider, {
|
|
533
|
+
prefixCls: "ant"
|
|
547
534
|
}, /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
548
535
|
pagination: _objectSpread({
|
|
549
536
|
size: 'default'
|
|
@@ -607,6 +594,6 @@ function PlusTable(props, ref) {
|
|
|
607
594
|
},
|
|
608
595
|
manualRequest: true,
|
|
609
596
|
action: actionRef
|
|
610
|
-
})));
|
|
597
|
+
}))));
|
|
611
598
|
}
|
|
612
599
|
export default /*#__PURE__*/React.forwardRef(PlusTable);
|
package/lib/index.js
CHANGED
|
@@ -217,7 +217,7 @@ function PlusTable(props, ref) {
|
|
|
217
217
|
}, _callee4, null, [[1, 8, 11, 14]]);
|
|
218
218
|
})), [props.updateSetting, columnsStateMap]);
|
|
219
219
|
var handleReset = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
220
|
-
var _props$resetSetting, res;
|
|
220
|
+
var _props$resetSetting, res, fetchRes;
|
|
221
221
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
222
222
|
while (1) switch (_context5.prev = _context5.next) {
|
|
223
223
|
case 0:
|
|
@@ -226,53 +226,28 @@ function PlusTable(props, ref) {
|
|
|
226
226
|
return (_props$resetSetting = props.resetSetting) === null || _props$resetSetting === void 0 ? void 0 : _props$resetSetting.call(props);
|
|
227
227
|
case 3:
|
|
228
228
|
res = _context5.sent;
|
|
229
|
-
if (!(res === null || res === void 0 ? void 0 : res.success)) {
|
|
230
|
-
_context5.next =
|
|
229
|
+
if (!((res === null || res === void 0 ? void 0 : res.success) && props.fetchSetting)) {
|
|
230
|
+
_context5.next = 9;
|
|
231
231
|
break;
|
|
232
232
|
}
|
|
233
233
|
_context5.next = 7;
|
|
234
|
-
return
|
|
234
|
+
return props.fetchSetting();
|
|
235
235
|
case 7:
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
fetchRes = _context5.sent;
|
|
237
|
+
setColumnsStateMap(fetchRes);
|
|
238
238
|
case 9:
|
|
239
|
-
_context5.
|
|
239
|
+
_context5.next = 14;
|
|
240
|
+
break;
|
|
241
|
+
case 11:
|
|
242
|
+
_context5.prev = 11;
|
|
240
243
|
_context5.t0 = _context5["catch"](0);
|
|
241
244
|
console.error('重置列设置失败:', _context5.t0);
|
|
242
|
-
case
|
|
245
|
+
case 14:
|
|
243
246
|
case "end":
|
|
244
247
|
return _context5.stop();
|
|
245
248
|
}
|
|
246
|
-
}, _callee5, null, [[0,
|
|
247
|
-
})), [props.resetSetting]);
|
|
248
|
-
// 优化:使用 useCallback 避免重复创建函数
|
|
249
|
-
var init = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
250
|
-
var res;
|
|
251
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
252
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
253
|
-
case 0:
|
|
254
|
-
if (!props.fetchSetting) {
|
|
255
|
-
_context6.next = 11;
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
_context6.prev = 1;
|
|
259
|
-
_context6.next = 4;
|
|
260
|
-
return props.fetchSetting();
|
|
261
|
-
case 4:
|
|
262
|
-
res = _context6.sent;
|
|
263
|
-
setColumnsStateMap(res);
|
|
264
|
-
_context6.next = 11;
|
|
265
|
-
break;
|
|
266
|
-
case 8:
|
|
267
|
-
_context6.prev = 8;
|
|
268
|
-
_context6.t0 = _context6["catch"](1);
|
|
269
|
-
console.error('获取列设置失败:', _context6.t0);
|
|
270
|
-
case 11:
|
|
271
|
-
case "end":
|
|
272
|
-
return _context6.stop();
|
|
273
|
-
}
|
|
274
|
-
}, _callee6, null, [[1, 8]]);
|
|
275
|
-
})), [props.fetchSetting]);
|
|
249
|
+
}, _callee5, null, [[0, 11]]);
|
|
250
|
+
})), [props.resetSetting, props.fetchSetting]);
|
|
276
251
|
var onValuesChange = (0, _react.useCallback)(function (changeValue, allValue) {
|
|
277
252
|
try {
|
|
278
253
|
var _drawFormRef$current4;
|
|
@@ -286,9 +261,9 @@ function PlusTable(props, ref) {
|
|
|
286
261
|
}
|
|
287
262
|
}, []);
|
|
288
263
|
var handleSearchAll = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
289
|
-
var
|
|
290
|
-
return _regeneratorRuntime().wrap(function
|
|
291
|
-
while (1) switch (
|
|
264
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(searchConfig) {
|
|
265
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
266
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
292
267
|
case 0:
|
|
293
268
|
try {
|
|
294
269
|
searchConfig.form.submit();
|
|
@@ -297,12 +272,12 @@ function PlusTable(props, ref) {
|
|
|
297
272
|
}
|
|
298
273
|
case 1:
|
|
299
274
|
case "end":
|
|
300
|
-
return
|
|
275
|
+
return _context6.stop();
|
|
301
276
|
}
|
|
302
|
-
},
|
|
277
|
+
}, _callee6);
|
|
303
278
|
}));
|
|
304
279
|
return function (_x4) {
|
|
305
|
-
return
|
|
280
|
+
return _ref6.apply(this, arguments);
|
|
306
281
|
};
|
|
307
282
|
}(), []);
|
|
308
283
|
var handleShowFullChange = (0, _react.useCallback)(function (e) {
|
|
@@ -313,35 +288,35 @@ function PlusTable(props, ref) {
|
|
|
313
288
|
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.reload) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current);
|
|
314
289
|
});
|
|
315
290
|
}, []);
|
|
316
|
-
var handleAdvancedFilterClick = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
291
|
+
var handleAdvancedFilterClick = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
317
292
|
var newDrawerState, _searchRef$current5, _drawFormRef$current5, fieldsValue;
|
|
318
|
-
return _regeneratorRuntime().wrap(function
|
|
319
|
-
while (1) switch (
|
|
293
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
294
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
320
295
|
case 0:
|
|
321
|
-
|
|
296
|
+
_context7.prev = 0;
|
|
322
297
|
newDrawerState = !searchDrawer;
|
|
323
298
|
setSearchDrawer(newDrawerState);
|
|
324
299
|
if (!newDrawerState) {
|
|
325
|
-
|
|
300
|
+
_context7.next = 8;
|
|
326
301
|
break;
|
|
327
302
|
}
|
|
328
|
-
|
|
303
|
+
_context7.next = 6;
|
|
329
304
|
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current5 = searchRef.current) === null || _searchRef$current5 === void 0 ? void 0 : _searchRef$current5.getFieldsValue();
|
|
330
305
|
case 6:
|
|
331
|
-
fieldsValue =
|
|
306
|
+
fieldsValue = _context7.sent;
|
|
332
307
|
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current5 = drawFormRef.current) === null || _drawFormRef$current5 === void 0 ? void 0 : _drawFormRef$current5.setFieldsValue(fieldsValue);
|
|
333
308
|
case 8:
|
|
334
|
-
|
|
309
|
+
_context7.next = 13;
|
|
335
310
|
break;
|
|
336
311
|
case 10:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
console.error('切换高级筛选失败:',
|
|
312
|
+
_context7.prev = 10;
|
|
313
|
+
_context7.t0 = _context7["catch"](0);
|
|
314
|
+
console.error('切换高级筛选失败:', _context7.t0);
|
|
340
315
|
case 13:
|
|
341
316
|
case "end":
|
|
342
|
-
return
|
|
317
|
+
return _context7.stop();
|
|
343
318
|
}
|
|
344
|
-
},
|
|
319
|
+
}, _callee7, null, [[0, 10]]);
|
|
345
320
|
})), [searchDrawer]);
|
|
346
321
|
var handleResetForm = (0, _react.useCallback)(function () {
|
|
347
322
|
try {
|
|
@@ -353,9 +328,17 @@ function PlusTable(props, ref) {
|
|
|
353
328
|
console.error('重置表单失败:', error);
|
|
354
329
|
}
|
|
355
330
|
}, []);
|
|
331
|
+
// 修复死循环:只在组件挂载时执行一次,不依赖 init 函数
|
|
356
332
|
(0, _react.useEffect)(function () {
|
|
357
|
-
|
|
358
|
-
|
|
333
|
+
// 组件挂载时执行一次初始化
|
|
334
|
+
if (props.fetchSetting) {
|
|
335
|
+
props.fetchSetting().then(function (res) {
|
|
336
|
+
setColumnsStateMap(res);
|
|
337
|
+
}).catch(function (error) {
|
|
338
|
+
console.error('获取列设置失败:', error);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}, []); // 空依赖数组,只在挂载时执行一次
|
|
359
342
|
// 优化:使用 useMemo 缓存计算结果
|
|
360
343
|
var dealFetchParams = (0, _react.useCallback)(function (params) {
|
|
361
344
|
var fetchParams = {};
|
|
@@ -382,50 +365,51 @@ function PlusTable(props, ref) {
|
|
|
382
365
|
}, [defaultColumnsState, columnsStateMap, handleOnChangeColumn]);
|
|
383
366
|
// 优化:使用 useCallback 缓存请求函数
|
|
384
367
|
var propsRequest = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
385
|
-
var
|
|
368
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params, sort, filter) {
|
|
386
369
|
var _searchRef$current6, _drawFormRef$current7, res1, res2;
|
|
387
|
-
return _regeneratorRuntime().wrap(function
|
|
388
|
-
while (1) switch (
|
|
370
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
371
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
389
372
|
case 0:
|
|
390
|
-
|
|
391
|
-
|
|
373
|
+
_context8.prev = 0;
|
|
374
|
+
_context8.next = 3;
|
|
392
375
|
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current6 = searchRef.current) === null || _searchRef$current6 === void 0 ? void 0 : _searchRef$current6.getFieldsValue();
|
|
393
376
|
case 3:
|
|
394
|
-
res1 =
|
|
395
|
-
|
|
377
|
+
res1 = _context8.sent;
|
|
378
|
+
_context8.next = 6;
|
|
396
379
|
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current7 = drawFormRef.current) === null || _drawFormRef$current7 === void 0 ? void 0 : _drawFormRef$current7.getFieldsValue();
|
|
397
380
|
case 6:
|
|
398
|
-
res2 =
|
|
381
|
+
res2 = _context8.sent;
|
|
399
382
|
if (request) {
|
|
400
|
-
|
|
383
|
+
_context8.next = 9;
|
|
401
384
|
break;
|
|
402
385
|
}
|
|
403
|
-
return
|
|
386
|
+
return _context8.abrupt("return", {});
|
|
404
387
|
case 9:
|
|
405
|
-
|
|
388
|
+
_context8.next = 11;
|
|
406
389
|
return request(_objectSpread(_objectSpread(_objectSpread({}, params), dealFetchParams(_objectSpread(_objectSpread(_objectSpread({}, res1), res2), params))), {}, {
|
|
407
390
|
showFull: showFull
|
|
408
391
|
}), sort, filter);
|
|
409
392
|
case 11:
|
|
410
|
-
return
|
|
393
|
+
return _context8.abrupt("return", _context8.sent);
|
|
411
394
|
case 14:
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
console.error('请求数据失败:',
|
|
415
|
-
return
|
|
395
|
+
_context8.prev = 14;
|
|
396
|
+
_context8.t0 = _context8["catch"](0);
|
|
397
|
+
console.error('请求数据失败:', _context8.t0);
|
|
398
|
+
return _context8.abrupt("return", {});
|
|
416
399
|
case 18:
|
|
417
400
|
case "end":
|
|
418
|
-
return
|
|
401
|
+
return _context8.stop();
|
|
419
402
|
}
|
|
420
|
-
},
|
|
403
|
+
}, _callee8, null, [[0, 14]]);
|
|
421
404
|
}));
|
|
422
405
|
return function (_x5, _x6, _x7) {
|
|
423
|
-
return
|
|
406
|
+
return _ref8.apply(this, arguments);
|
|
424
407
|
};
|
|
425
408
|
}(), [request, dealFetchParams, showFull]);
|
|
426
409
|
// 优化:使用 useMemo 缓存选项配置
|
|
427
410
|
var __options = (0, _react.useMemo)(function () {
|
|
428
411
|
var optionsSetting = _typeof(options) === 'object' && _typeof(options.setting) === 'object' ? options.setting : {};
|
|
412
|
+
console.log(action === null || action === void 0 ? void 0 : action.includes('columnSetting'), showDefaultSetting !== true);
|
|
429
413
|
if ((action === null || action === void 0 ? void 0 : action.includes('columnSetting')) && showDefaultSetting !== true) {
|
|
430
414
|
return _objectSpread(_objectSpread({}, options), {}, {
|
|
431
415
|
setting: _objectSpread(_objectSpread({}, optionsSetting), {}, {
|
|
@@ -545,9 +529,10 @@ function PlusTable(props, ref) {
|
|
|
545
529
|
boxSizing: 'border-box'
|
|
546
530
|
};
|
|
547
531
|
}, []);
|
|
548
|
-
console.log('searchConfig', searchConfig);
|
|
549
532
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
550
533
|
className: "page_plustable__body"
|
|
534
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
535
|
+
prefixCls: "ant"
|
|
551
536
|
}, /*#__PURE__*/_react.default.createElement(_proComponents.ProTable, _extends({
|
|
552
537
|
pagination: _objectSpread({
|
|
553
538
|
size: 'default'
|
|
@@ -611,6 +596,6 @@ function PlusTable(props, ref) {
|
|
|
611
596
|
},
|
|
612
597
|
manualRequest: true,
|
|
613
598
|
action: actionRef
|
|
614
|
-
})));
|
|
599
|
+
}))));
|
|
615
600
|
}
|
|
616
601
|
var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(PlusTable);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fle-ui/plus-table",
|
|
3
|
-
"version": "1.2.30-beta.
|
|
3
|
+
"version": "1.2.30-beta.2",
|
|
4
4
|
"description": "@fle-ui/plus-table",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fle-ui",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@ant-design/pro-utils": "^2.7.0",
|
|
47
47
|
"omit.js": "^2.0.2"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "ab60a41d5686e16eeca491e812594372df8c60f2"
|
|
50
50
|
}
|