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