@zat-design/sisyphus-react 3.13.14-deta.1 → 3.13.14

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.
@@ -2491,7 +2491,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2491
2491
  width: 45%;
2492
2492
  }
2493
2493
  .pro-address .ant-cascader.no-detail {
2494
- width: 100% !important;
2494
+ width: 100%;
2495
2495
  }
2496
2496
  .pro-address .pro-address-detail {
2497
2497
  width: 55%;
package/dist/less.esm.css CHANGED
@@ -2491,7 +2491,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2491
2491
  width: 45%;
2492
2492
  }
2493
2493
  .pro-address .ant-cascader.no-detail {
2494
- width: 100% !important;
2494
+ width: 100%;
2495
2495
  }
2496
2496
  .pro-address .pro-address-detail {
2497
2497
  width: 55%;
@@ -51,8 +51,9 @@ var FormFooter = function FormFooter(props) {
51
51
  // 使用自定义验证逻辑
52
52
  form.validateFields().then(function () {
53
53
  onOk();
54
- }).catch(function () {
54
+ }).catch(function (error) {
55
55
  // 验证失败,不执行 onOk
56
+ console.log('校验失败', error);
56
57
  });
57
58
  } else {
58
59
  onOk();
@@ -9,7 +9,7 @@
9
9
  width: 45%;
10
10
 
11
11
  &.no-detail {
12
- width: 100% !important;
12
+ width: 100%;
13
13
  }
14
14
  }
15
15
 
@@ -35,7 +35,7 @@ import ConfirmWrapper from './ConfirmWrapper';
35
35
  import ChangedWrapper from './ChangedWrapper';
36
36
  // 这个组件只管渲染, 参数的整理在外部处理
37
37
  var Render = function Render(props) {
38
- var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
38
+ var _ref2, _ref3, _ref4, _ref5, _otherProps$names3;
39
39
  var component = props.component,
40
40
  originComponent = props.originComponent,
41
41
  _props$formItemProps = props.formItemProps,
@@ -447,9 +447,19 @@ var Render = function Render(props) {
447
447
  });
448
448
  }
449
449
  if (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues) {
450
+ var _otherProps$namePath, _otherProps$names2;
451
+ var _names = otherProps.names;
452
+ // FormList中的names字段需要去除前缀
453
+ if ((otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$namePath = otherProps.namePath) === null || _otherProps$namePath === void 0 ? void 0 : _otherProps$namePath.length) && ((_otherProps$names2 = otherProps.names) === null || _otherProps$names2 === void 0 ? void 0 : _otherProps$names2.length)) {
454
+ var _otherProps$namePath2;
455
+ var prefixLength = (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$namePath2 = otherProps.namePath) === null || _otherProps$namePath2 === void 0 ? void 0 : _otherProps$namePath2.length) - 1;
456
+ _names = otherProps.names.map(function (name) {
457
+ return name.slice(prefixLength);
458
+ });
459
+ }
450
460
  child = _jsx(ChangedWrapper, {
451
461
  name: formItemProps.name,
452
- names: otherProps.names,
462
+ names: _names,
453
463
  namesStr: namesStr,
454
464
  diffConfig: diffConfig,
455
465
  form: form,
@@ -482,7 +492,7 @@ var Render = function Render(props) {
482
492
  return renderItem();
483
493
  }
484
494
  })
485
- }) : renderItem(), (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$names2 = otherProps.names) === null || _otherProps$names2 === void 0 ? void 0 : _otherProps$names2.length) ? otherProps.names.map(function (name) {
495
+ }) : renderItem(), (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$names3 = otherProps.names) === null || _otherProps$names3 === void 0 ? void 0 : _otherProps$names3.length) ? otherProps.names.map(function (name) {
486
496
  return _jsx(_Form.Item, {
487
497
  hidden: true,
488
498
  name: name,
@@ -1,4 +1,7 @@
1
1
  import { useRequest } from 'ahooks';
2
2
  import type { ProTableRequestOptionsType, ProTableServiceType } from '../propsType';
3
+ export declare const SELECTION_ALL = "SELECTION_ALL";
4
+ export declare const CURRENT_PAGE = "CURRENT_PAGE";
5
+ export declare const UNCHECK_ALL = "UNCHECK_ALL";
3
6
  declare function useAntdTable<I, R extends Record<string, any>, S extends ProTableServiceType<I, R>>(service: S, options?: ProTableRequestOptionsType<I, R>, useRequestOptions?: Parameters<typeof useRequest>[1]): any;
4
7
  export default useAntdTable;
@@ -32,6 +32,9 @@ var useDefaultOptions = function useDefaultOptions(options) {
32
32
  });
33
33
  };
34
34
  var previousSearchValues = null;
35
+ export var SELECTION_ALL = 'SELECTION_ALL';
36
+ export var CURRENT_PAGE = 'CURRENT_PAGE';
37
+ export var UNCHECK_ALL = 'UNCHECK_ALL';
35
38
  function useAntdTable(service, options, useRequestOptions) {
36
39
  var _locale$ProTable2, _locale$ProTable3, _locale$ProTable4, _locale$ProTable5, _result$params, _form$getFieldsValue3;
37
40
  var _useSetState = useSetState({
@@ -339,6 +342,92 @@ function useAntdTable(service, options, useRequestOptions) {
339
342
  return _ref4.apply(this, arguments);
340
343
  };
341
344
  }();
345
+ // 内置选择下拉
346
+ var defaultSelections = [{
347
+ key: 'currentPage',
348
+ text: formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTable2 = locale.ProTable) === null || _locale$ProTable2 === void 0 ? void 0 : _locale$ProTable2.selectCurPage, {
349
+ total: (data === null || data === void 0 ? void 0 : data.length) || 0
350
+ }),
351
+ onSelect: function onSelect(changeableRowKeys) {
352
+ setState({
353
+ allSelected: false,
354
+ selectedRecords: _toConsumableArray(data),
355
+ selectedRowKeys: changeableRowKeys
356
+ });
357
+ }
358
+ }, {
359
+ key: 'all',
360
+ text: formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTable3 = locale.ProTable) === null || _locale$ProTable3 === void 0 ? void 0 : _locale$ProTable3.selectAll, {
361
+ total: total
362
+ }),
363
+ onSelect: function () {
364
+ var _onSelect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(changeableRowKeys) {
365
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
366
+ while (1) switch (_context2.prev = _context2.next) {
367
+ case 0:
368
+ setState({
369
+ allSelected: true,
370
+ selectedRecords: _toConsumableArray(data),
371
+ selectedRowKeys: changeableRowKeys
372
+ });
373
+ case 1:
374
+ case "end":
375
+ return _context2.stop();
376
+ }
377
+ }, _callee2);
378
+ }));
379
+ function onSelect(_x) {
380
+ return _onSelect.apply(this, arguments);
381
+ }
382
+ return onSelect;
383
+ }()
384
+ }, {
385
+ key: 'uncheckAll',
386
+ text: locale === null || locale === void 0 ? void 0 : (_locale$ProTable4 = locale.ProTable) === null || _locale$ProTable4 === void 0 ? void 0 : _locale$ProTable4.deselect,
387
+ onSelect: function () {
388
+ var _onSelect2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
389
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
390
+ while (1) switch (_context3.prev = _context3.next) {
391
+ case 0:
392
+ setState({
393
+ allSelected: false,
394
+ selectedRecords: [],
395
+ selectedRowKeys: []
396
+ });
397
+ case 1:
398
+ case "end":
399
+ return _context3.stop();
400
+ }
401
+ }, _callee3);
402
+ }));
403
+ function onSelect() {
404
+ return _onSelect2.apply(this, arguments);
405
+ }
406
+ return onSelect;
407
+ }()
408
+ }];
409
+ var selections = useMemo(function () {
410
+ if (rowSelections === true) {
411
+ return defaultSelections;
412
+ }
413
+ if (Array.isArray(rowSelections)) {
414
+ return rowSelections.map(function (item) {
415
+ if (typeof item === 'string') {
416
+ if (item === CURRENT_PAGE) {
417
+ return defaultSelections[0];
418
+ }
419
+ if (item === SELECTION_ALL) {
420
+ return defaultSelections[1];
421
+ }
422
+ if (item === UNCHECK_ALL) {
423
+ return defaultSelections[2];
424
+ }
425
+ }
426
+ return item;
427
+ });
428
+ }
429
+ return false;
430
+ }, [rowSelections]);
342
431
  var _rowSelection = {
343
432
  fixed: true,
344
433
  type: rowSelectType,
@@ -386,69 +475,7 @@ function useAntdTable(service, options, useRequestOptions) {
386
475
  className: allSelected && rowSelections ? 'checkbox-disabled' : ''
387
476
  };
388
477
  },
389
- selections: rowSelections ? [{
390
- key: 'currentPage',
391
- text: formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTable2 = locale.ProTable) === null || _locale$ProTable2 === void 0 ? void 0 : _locale$ProTable2.selectCurPage, {
392
- total: (data === null || data === void 0 ? void 0 : data.length) || 0
393
- }),
394
- onSelect: function onSelect(changeableRowKeys) {
395
- setState({
396
- allSelected: false,
397
- selectedRecords: _toConsumableArray(data),
398
- selectedRowKeys: changeableRowKeys
399
- });
400
- }
401
- }, {
402
- key: 'all',
403
- text: formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTable3 = locale.ProTable) === null || _locale$ProTable3 === void 0 ? void 0 : _locale$ProTable3.selectAll, {
404
- total: total
405
- }),
406
- onSelect: function () {
407
- var _onSelect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(changeableRowKeys) {
408
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
409
- while (1) switch (_context2.prev = _context2.next) {
410
- case 0:
411
- setState({
412
- allSelected: true,
413
- selectedRecords: _toConsumableArray(data),
414
- selectedRowKeys: changeableRowKeys
415
- });
416
- case 1:
417
- case "end":
418
- return _context2.stop();
419
- }
420
- }, _callee2);
421
- }));
422
- function onSelect(_x) {
423
- return _onSelect.apply(this, arguments);
424
- }
425
- return onSelect;
426
- }()
427
- }, {
428
- key: 'uncheckAll',
429
- text: locale === null || locale === void 0 ? void 0 : (_locale$ProTable4 = locale.ProTable) === null || _locale$ProTable4 === void 0 ? void 0 : _locale$ProTable4.deselect,
430
- onSelect: function () {
431
- var _onSelect2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
432
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
433
- while (1) switch (_context3.prev = _context3.next) {
434
- case 0:
435
- setState({
436
- allSelected: false,
437
- selectedRecords: [],
438
- selectedRowKeys: []
439
- });
440
- case 1:
441
- case "end":
442
- return _context3.stop();
443
- }
444
- }, _callee3);
445
- }));
446
- function onSelect() {
447
- return _onSelect2.apply(this, arguments);
448
- }
449
- return onSelect;
450
- }()
451
- }] : false
478
+ selections: selections
452
479
  };
453
480
  var rowSelection = _isObject(returnRowSelection) ? _merge(_rowSelection, returnRowSelection) : _rowSelection;
454
481
  if (_isObject(returnRowSelection) && !_isEqual(rowSelection, _rowSelection)) {
@@ -16,5 +16,8 @@ declare const ProTable: {
16
16
  isView: boolean;
17
17
  };
18
18
  useAntdTable: typeof useAntdTable;
19
+ SELECTION_ALL: string;
20
+ CURRENT_PAGE: string;
21
+ UNCHECK_ALL: string;
19
22
  };
20
23
  export default ProTable;
@@ -19,7 +19,7 @@ import { useDebounceEffect, useDeepCompareEffect, useSetState } from 'ahooks';
19
19
  import classnames from 'classnames';
20
20
  import { useProConfig } from '../index';
21
21
  import { RenderTableHeader, RenderFooter, RenderTabs } from './components';
22
- import useAntdTable from './hooks/useAntdTable';
22
+ import useAntdTable, { CURRENT_PAGE, SELECTION_ALL, UNCHECK_ALL } from './hooks/useAntdTable';
23
23
  import { BaseTable, DraggableTable } from './components/RcTable';
24
24
  import { formatColumn } from './components/FormatColumn';
25
25
  import empty from '../assets/empty.png';
@@ -469,4 +469,7 @@ ProTable.defaultProps = {
469
469
  isView: false
470
470
  };
471
471
  ProTable.useAntdTable = useAntdTable;
472
+ ProTable.SELECTION_ALL = SELECTION_ALL;
473
+ ProTable.CURRENT_PAGE = CURRENT_PAGE;
474
+ ProTable.UNCHECK_ALL = UNCHECK_ALL;
472
475
  export default ProTable;
@@ -609,7 +609,7 @@ export interface ProTableRequestOptionsType<T, R> {
609
609
  * @description 启用选择当前页、选择全部、取消选择下拉菜单
610
610
  * @default false
611
611
  */
612
- rowSelections?: boolean;
612
+ rowSelections?: boolean | object[];
613
613
  /**
614
614
  * 额外参数
615
615
  * @description 无法通过搜索表单设置的值,此值变更时也会重新发起请求,重置表单不会被清空
@@ -58,8 +58,9 @@ var FormFooter = function FormFooter(props) {
58
58
  // 使用自定义验证逻辑
59
59
  form.validateFields().then(function () {
60
60
  onOk();
61
- }).catch(function () {
61
+ }).catch(function (error) {
62
62
  // 验证失败,不执行 onOk
63
+ console.log('校验失败', error);
63
64
  });
64
65
  } else {
65
66
  onOk();
@@ -9,7 +9,7 @@
9
9
  width: 45%;
10
10
 
11
11
  &.no-detail {
12
- width: 100% !important;
12
+ width: 100%;
13
13
  }
14
14
  }
15
15
 
@@ -42,7 +42,7 @@ var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className",
42
42
  /* eslint-disable prefer-destructuring */
43
43
  // 这个组件只管渲染, 参数的整理在外部处理
44
44
  var Render = function Render(props) {
45
- var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
45
+ var _ref2, _ref3, _ref4, _ref5, _otherProps$names3;
46
46
  var component = props.component,
47
47
  originComponent = props.originComponent,
48
48
  _props$formItemProps = props.formItemProps,
@@ -454,9 +454,19 @@ var Render = function Render(props) {
454
454
  });
455
455
  }
456
456
  if (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues) {
457
+ var _otherProps$namePath, _otherProps$names2;
458
+ var _names = otherProps.names;
459
+ // FormList中的names字段需要去除前缀
460
+ if ((otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$namePath = otherProps.namePath) === null || _otherProps$namePath === void 0 ? void 0 : _otherProps$namePath.length) && ((_otherProps$names2 = otherProps.names) === null || _otherProps$names2 === void 0 ? void 0 : _otherProps$names2.length)) {
461
+ var _otherProps$namePath2;
462
+ var prefixLength = (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$namePath2 = otherProps.namePath) === null || _otherProps$namePath2 === void 0 ? void 0 : _otherProps$namePath2.length) - 1;
463
+ _names = otherProps.names.map(function (name) {
464
+ return name.slice(prefixLength);
465
+ });
466
+ }
457
467
  child = (0, _jsxRuntime.jsx)(_ChangedWrapper.default, {
458
468
  name: formItemProps.name,
459
- names: otherProps.names,
469
+ names: _names,
460
470
  namesStr: namesStr,
461
471
  diffConfig: diffConfig,
462
472
  form: form,
@@ -489,7 +499,7 @@ var Render = function Render(props) {
489
499
  return renderItem();
490
500
  }
491
501
  })
492
- }) : renderItem(), (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$names2 = otherProps.names) === null || _otherProps$names2 === void 0 ? void 0 : _otherProps$names2.length) ? otherProps.names.map(function (name) {
502
+ }) : renderItem(), (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$names3 = otherProps.names) === null || _otherProps$names3 === void 0 ? void 0 : _otherProps$names3.length) ? otherProps.names.map(function (name) {
493
503
  return (0, _jsxRuntime.jsx)(_form.default.Item, {
494
504
  hidden: true,
495
505
  name: name,
@@ -1,4 +1,7 @@
1
1
  import { useRequest } from 'ahooks';
2
2
  import type { ProTableRequestOptionsType, ProTableServiceType } from '../propsType';
3
+ export declare const SELECTION_ALL = "SELECTION_ALL";
4
+ export declare const CURRENT_PAGE = "CURRENT_PAGE";
5
+ export declare const UNCHECK_ALL = "UNCHECK_ALL";
3
6
  declare function useAntdTable<I, R extends Record<string, any>, S extends ProTableServiceType<I, R>>(service: S, options?: ProTableRequestOptionsType<I, R>, useRequestOptions?: Parameters<typeof useRequest>[1]): any;
4
7
  export default useAntdTable;
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.default = exports.UNCHECK_ALL = exports.SELECTION_ALL = exports.CURRENT_PAGE = void 0;
9
9
  var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
11
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -40,6 +40,9 @@ var useDefaultOptions = function useDefaultOptions(options) {
40
40
  });
41
41
  };
42
42
  var previousSearchValues = null;
43
+ var SELECTION_ALL = exports.SELECTION_ALL = 'SELECTION_ALL';
44
+ var CURRENT_PAGE = exports.CURRENT_PAGE = 'CURRENT_PAGE';
45
+ var UNCHECK_ALL = exports.UNCHECK_ALL = 'UNCHECK_ALL';
43
46
  function useAntdTable(service, options, useRequestOptions) {
44
47
  var _locale$ProTable2, _locale$ProTable3, _locale$ProTable4, _locale$ProTable5, _result$params, _form$getFieldsValue3;
45
48
  var _useSetState = (0, _ahooks.useSetState)({
@@ -347,6 +350,92 @@ function useAntdTable(service, options, useRequestOptions) {
347
350
  return _ref4.apply(this, arguments);
348
351
  };
349
352
  }();
353
+ // 内置选择下拉
354
+ var defaultSelections = [{
355
+ key: 'currentPage',
356
+ text: (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable2 = _locale.default.ProTable) === null || _locale$ProTable2 === void 0 ? void 0 : _locale$ProTable2.selectCurPage, {
357
+ total: (data === null || data === void 0 ? void 0 : data.length) || 0
358
+ }),
359
+ onSelect: function onSelect(changeableRowKeys) {
360
+ setState({
361
+ allSelected: false,
362
+ selectedRecords: (0, _toConsumableArray2.default)(data),
363
+ selectedRowKeys: changeableRowKeys
364
+ });
365
+ }
366
+ }, {
367
+ key: 'all',
368
+ text: (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable3 = _locale.default.ProTable) === null || _locale$ProTable3 === void 0 ? void 0 : _locale$ProTable3.selectAll, {
369
+ total: total
370
+ }),
371
+ onSelect: function () {
372
+ var _onSelect = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(changeableRowKeys) {
373
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
374
+ while (1) switch (_context2.prev = _context2.next) {
375
+ case 0:
376
+ setState({
377
+ allSelected: true,
378
+ selectedRecords: (0, _toConsumableArray2.default)(data),
379
+ selectedRowKeys: changeableRowKeys
380
+ });
381
+ case 1:
382
+ case "end":
383
+ return _context2.stop();
384
+ }
385
+ }, _callee2);
386
+ }));
387
+ function onSelect(_x) {
388
+ return _onSelect.apply(this, arguments);
389
+ }
390
+ return onSelect;
391
+ }()
392
+ }, {
393
+ key: 'uncheckAll',
394
+ text: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable4 = _locale.default.ProTable) === null || _locale$ProTable4 === void 0 ? void 0 : _locale$ProTable4.deselect,
395
+ onSelect: function () {
396
+ var _onSelect2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3() {
397
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
398
+ while (1) switch (_context3.prev = _context3.next) {
399
+ case 0:
400
+ setState({
401
+ allSelected: false,
402
+ selectedRecords: [],
403
+ selectedRowKeys: []
404
+ });
405
+ case 1:
406
+ case "end":
407
+ return _context3.stop();
408
+ }
409
+ }, _callee3);
410
+ }));
411
+ function onSelect() {
412
+ return _onSelect2.apply(this, arguments);
413
+ }
414
+ return onSelect;
415
+ }()
416
+ }];
417
+ var selections = (0, _react.useMemo)(function () {
418
+ if (rowSelections === true) {
419
+ return defaultSelections;
420
+ }
421
+ if (Array.isArray(rowSelections)) {
422
+ return rowSelections.map(function (item) {
423
+ if (typeof item === 'string') {
424
+ if (item === CURRENT_PAGE) {
425
+ return defaultSelections[0];
426
+ }
427
+ if (item === SELECTION_ALL) {
428
+ return defaultSelections[1];
429
+ }
430
+ if (item === UNCHECK_ALL) {
431
+ return defaultSelections[2];
432
+ }
433
+ }
434
+ return item;
435
+ });
436
+ }
437
+ return false;
438
+ }, [rowSelections]);
350
439
  var _rowSelection = {
351
440
  fixed: true,
352
441
  type: rowSelectType,
@@ -394,69 +483,7 @@ function useAntdTable(service, options, useRequestOptions) {
394
483
  className: allSelected && rowSelections ? 'checkbox-disabled' : ''
395
484
  };
396
485
  },
397
- selections: rowSelections ? [{
398
- key: 'currentPage',
399
- text: (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable2 = _locale.default.ProTable) === null || _locale$ProTable2 === void 0 ? void 0 : _locale$ProTable2.selectCurPage, {
400
- total: (data === null || data === void 0 ? void 0 : data.length) || 0
401
- }),
402
- onSelect: function onSelect(changeableRowKeys) {
403
- setState({
404
- allSelected: false,
405
- selectedRecords: (0, _toConsumableArray2.default)(data),
406
- selectedRowKeys: changeableRowKeys
407
- });
408
- }
409
- }, {
410
- key: 'all',
411
- text: (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable3 = _locale.default.ProTable) === null || _locale$ProTable3 === void 0 ? void 0 : _locale$ProTable3.selectAll, {
412
- total: total
413
- }),
414
- onSelect: function () {
415
- var _onSelect = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(changeableRowKeys) {
416
- return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
417
- while (1) switch (_context2.prev = _context2.next) {
418
- case 0:
419
- setState({
420
- allSelected: true,
421
- selectedRecords: (0, _toConsumableArray2.default)(data),
422
- selectedRowKeys: changeableRowKeys
423
- });
424
- case 1:
425
- case "end":
426
- return _context2.stop();
427
- }
428
- }, _callee2);
429
- }));
430
- function onSelect(_x) {
431
- return _onSelect.apply(this, arguments);
432
- }
433
- return onSelect;
434
- }()
435
- }, {
436
- key: 'uncheckAll',
437
- text: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable4 = _locale.default.ProTable) === null || _locale$ProTable4 === void 0 ? void 0 : _locale$ProTable4.deselect,
438
- onSelect: function () {
439
- var _onSelect2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3() {
440
- return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
441
- while (1) switch (_context3.prev = _context3.next) {
442
- case 0:
443
- setState({
444
- allSelected: false,
445
- selectedRecords: [],
446
- selectedRowKeys: []
447
- });
448
- case 1:
449
- case "end":
450
- return _context3.stop();
451
- }
452
- }, _callee3);
453
- }));
454
- function onSelect() {
455
- return _onSelect2.apply(this, arguments);
456
- }
457
- return onSelect;
458
- }()
459
- }] : false
486
+ selections: selections
460
487
  };
461
488
  var rowSelection = (0, _isObject2.default)(returnRowSelection) ? (0, _merge2.default)(_rowSelection, returnRowSelection) : _rowSelection;
462
489
  if ((0, _isObject2.default)(returnRowSelection) && !(0, _isEqual2.default)(rowSelection, _rowSelection)) {
@@ -16,5 +16,8 @@ declare const ProTable: {
16
16
  isView: boolean;
17
17
  };
18
18
  useAntdTable: typeof useAntdTable;
19
+ SELECTION_ALL: string;
20
+ CURRENT_PAGE: string;
21
+ UNCHECK_ALL: string;
19
22
  };
20
23
  export default ProTable;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
@@ -24,7 +25,7 @@ var _ahooks = require("ahooks");
24
25
  var _classnames2 = _interopRequireDefault(require("classnames"));
25
26
  var _index = require("../index");
26
27
  var _components = require("./components");
27
- var _useAntdTable = _interopRequireDefault(require("./hooks/useAntdTable"));
28
+ var _useAntdTable = _interopRequireWildcard(require("./hooks/useAntdTable"));
28
29
  var _RcTable = require("./components/RcTable");
29
30
  var _FormatColumn = require("./components/FormatColumn");
30
31
  var _empty = _interopRequireDefault(require("../assets/empty.png"));
@@ -476,4 +477,7 @@ ProTable.defaultProps = {
476
477
  isView: false
477
478
  };
478
479
  ProTable.useAntdTable = _useAntdTable.default;
480
+ ProTable.SELECTION_ALL = _useAntdTable.SELECTION_ALL;
481
+ ProTable.CURRENT_PAGE = _useAntdTable.CURRENT_PAGE;
482
+ ProTable.UNCHECK_ALL = _useAntdTable.UNCHECK_ALL;
479
483
  var _default = exports.default = ProTable;
@@ -609,7 +609,7 @@ export interface ProTableRequestOptionsType<T, R> {
609
609
  * @description 启用选择当前页、选择全部、取消选择下拉菜单
610
610
  * @default false
611
611
  */
612
- rowSelections?: boolean;
612
+ rowSelections?: boolean | object[];
613
613
  /**
614
614
  * 额外参数
615
615
  * @description 无法通过搜索表单设置的值,此值变更时也会重新发起请求,重置表单不会被清空
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.13.14-deta.1",
3
+ "version": "3.13.14",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",