@ucloud-fe/react-components 1.17.0 → 1.17.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.
@@ -416,18 +416,34 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
416
416
  var _this14 = this;
417
417
 
418
418
  (0, _newArrowCheck2.default)(this, _this3);
419
- var rowSelection = _this2.props.rowSelection;
419
+ var _this2$props = _this2.props,
420
+ rowSelection = _this2$props.rowSelection,
421
+ dataSource = _this2$props.dataSource;
420
422
  var parentSelectedRowKeys = _this2.state.parentSelectedRowKeys;
421
423
  if (!rowSelection) return;
422
424
  var selectedRowKeys = [];
423
425
  (0, _each2.default)(selectedRowKeyMap, function (selected, key) {
424
426
  (0, _newArrowCheck2.default)(this, _this14);
425
427
  selected && selectedRowKeys.push(key);
428
+ }.bind(this)); // 计算所有选中的行数据,包括折叠的子项
429
+
430
+ var flatDataSource = _this2.flatDataSource(dataSource);
431
+
432
+ flatDataSource.forEach(function (item) {
433
+ (0, _newArrowCheck2.default)(this, _this14);
434
+
435
+ if (selectedRowKeyMap[item.key]) {
436
+ _this2._selectedRowsMap[item.key] = item.record;
437
+ }
426
438
  }.bind(this));
427
439
 
428
440
  if ((0, _isObject2.default)(rowSelection)) {
429
441
  if (rowSelection.onChange) {
430
- rowSelection.onChange(selectedRowKeys);
442
+ var selectedRows = selectedRowKeys.map(function (key) {
443
+ (0, _newArrowCheck2.default)(this, _this14);
444
+ return _this2._selectedRowsMap[key];
445
+ }.bind(this));
446
+ rowSelection.onChange(selectedRowKeys, selectedRows);
431
447
  }
432
448
 
433
449
  if (!('selectedRowKeys' in rowSelection)) {
@@ -692,10 +708,10 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
692
708
  var _this20 = this;
693
709
 
694
710
  (0, _newArrowCheck2.default)(this, _this3);
695
- var _this2$props = _this2.props,
696
- dataSource = _this2$props.dataSource,
697
- handleSearch = _this2$props.handleSearch,
698
- doNotHandleCondition = _this2$props.doNotHandleCondition;
711
+ var _this2$props2 = _this2.props,
712
+ dataSource = _this2$props2.dataSource,
713
+ handleSearch = _this2$props2.handleSearch,
714
+ doNotHandleCondition = _this2$props2.doNotHandleCondition;
699
715
  var _this2$state2 = _this2.state,
700
716
  order = _this2$state2.order,
701
717
  searchValue = _this2$state2.searchValue;
@@ -1011,10 +1027,10 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1011
1027
  var _this31 = this;
1012
1028
 
1013
1029
  (0, _newArrowCheck2.default)(this, _this3);
1014
- var _this2$props2 = _this2.props,
1015
- dragSorting = _this2$props2.dragSorting,
1016
- expandedRowRender = _this2$props2.expandedRowRender,
1017
- columns = _this2$props2.columns;
1030
+ var _this2$props3 = _this2.props,
1031
+ dragSorting = _this2$props3.dragSorting,
1032
+ expandedRowRender = _this2$props3.expandedRowRender,
1033
+ columns = _this2$props3.columns;
1018
1034
  if (!dragSorting) return false; // 排序暂不支持有展开行配置的table
1019
1035
 
1020
1036
  if (expandedRowRender || columns && columns.findIndex(function (column) {
@@ -1032,13 +1048,13 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1032
1048
  var _this32 = this;
1033
1049
 
1034
1050
  (0, _newArrowCheck2.default)(this, _this3);
1035
- var _this2$props3 = _this2.props,
1036
- columns = _this2$props3.columns,
1037
- rowSelection = _this2$props3.rowSelection,
1038
- columnPlaceholder = _this2$props3.columnPlaceholder,
1039
- locale = _this2$props3.locale,
1040
- dataSource = _this2$props3.dataSource,
1041
- columnResizable = _this2$props3.columnResizable;
1051
+ var _this2$props4 = _this2.props,
1052
+ columns = _this2$props4.columns,
1053
+ rowSelection = _this2$props4.rowSelection,
1054
+ columnPlaceholder = _this2$props4.columnPlaceholder,
1055
+ locale = _this2$props4.locale,
1056
+ dataSource = _this2$props4.dataSource,
1057
+ columnResizable = _this2$props4.columnResizable;
1042
1058
  var _this2$state3 = _this2.state,
1043
1059
  _this2$state3$order = _this2$state3.order,
1044
1060
  currentOrder = _this2$state3$order === void 0 ? {} : _this2$state3$order,
@@ -1587,10 +1603,10 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1587
1603
 
1588
1604
  _this2.onRow = function (record, index) {
1589
1605
  (0, _newArrowCheck2.default)(this, _this3);
1590
- var _this2$props4 = _this2.props,
1591
- _this2$props4$onRow = _this2$props4.onRow,
1592
- onRow = _this2$props4$onRow === void 0 ? noop : _this2$props4$onRow,
1593
- contextMenu = _this2$props4.contextMenu;
1606
+ var _this2$props5 = _this2.props,
1607
+ _this2$props5$onRow = _this2$props5.onRow,
1608
+ onRow = _this2$props5$onRow === void 0 ? noop : _this2$props5$onRow,
1609
+ contextMenu = _this2$props5.contextMenu;
1594
1610
  return _objectSpread(_objectSpread({}, onRow(record, index)), {}, {
1595
1611
  record: record,
1596
1612
  contextMenu: contextMenu
@@ -1618,7 +1634,8 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1618
1634
  columnConfig: _props.defaultColumnConfig,
1619
1635
  searchValue: ''
1620
1636
  };
1621
- _this2.tableId = "uc_table_uid_".concat(uid++); // init pagination
1637
+ _this2.tableId = "uc_table_uid_".concat(uid++);
1638
+ _this2._selectedRowsMap = {}; // init pagination
1622
1639
 
1623
1640
  var _pagination = _props.pagination;
1624
1641
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucloud-fe/react-components",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
4
4
  "title": "UCloud react components",
5
5
  "description": "UCloud react components",
6
6
  "keywords": [