@kmkf-fe-packages/basic-components 2.6.1-beta.3 → 2.6.1-beta.5

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/dist/index.esm.js CHANGED
@@ -26395,11 +26395,46 @@ var index$2 = (function (props) {
26395
26395
  return _ref13.apply(this, arguments);
26396
26396
  };
26397
26397
  }();
26398
- var rowSelection = {
26399
- type: isRadio ? 'radio' : 'checkbox',
26398
+ var rowKey = rowKeyMap[type] || 'billNo';
26399
+ var handleRadioChange = function handleRadioChange(record) {
26400
+ var _value$selectIds;
26401
+ if (disabled) return;
26402
+ var currentKey = String(value === null || value === void 0 ? void 0 : (_value$selectIds = value.selectIds) === null || _value$selectIds === void 0 ? void 0 : _value$selectIds[0]);
26403
+ var rowKeyVal = String(record[rowKey]);
26404
+ if (currentKey && currentKey === rowKeyVal) {
26405
+ _onChange(_objectSpread2(_objectSpread2({}, value), {}, {
26406
+ selectIds: [],
26407
+ selectedRows: []
26408
+ }));
26409
+ } else {
26410
+ _onChange(_objectSpread2(_objectSpread2({}, value), {}, {
26411
+ selectIds: [rowKeyVal],
26412
+ selectedRows: [record]
26413
+ }));
26414
+ }
26415
+ };
26416
+ var radioColumn = isRadio ? {
26417
+ width: 50,
26418
+ fixed: true,
26419
+ render: function render(_, record) {
26420
+ var _value$selectIds2;
26421
+ var checked = String(value === null || value === void 0 ? void 0 : (_value$selectIds2 = value.selectIds) === null || _value$selectIds2 === void 0 ? void 0 : _value$selectIds2[0]) === String(record[rowKey]);
26422
+ return /*#__PURE__*/React.createElement(Radio, {
26423
+ checked: checked,
26424
+ onClick: function onClick(e) {
26425
+ e.preventDefault();
26426
+ handleRadioChange(record);
26427
+ },
26428
+ disabled: disabled
26429
+ });
26430
+ }
26431
+ } : null;
26432
+ var displayColumns = isRadio && radioColumn ? [radioColumn].concat(_toConsumableArray(columns)) : columns;
26433
+ var rowSelection = isRadio ? undefined : {
26434
+ type: 'checkbox',
26400
26435
  selectedRowKeys: (value === null || value === void 0 ? void 0 : value.selectIds) || [],
26401
26436
  fixed: true,
26402
- onChange: function onChange(selectedRowKeys, selectedRows, info) {
26437
+ onChange: function onChange(selectedRowKeys, selectedRows) {
26403
26438
  _onChange(_objectSpread2(_objectSpread2({}, value), {}, {
26404
26439
  selectIds: selectedRowKeys,
26405
26440
  selectedRows: selectedRows
@@ -26445,9 +26480,9 @@ var index$2 = (function (props) {
26445
26480
  allowClear: true
26446
26481
  })), /*#__PURE__*/React.createElement(Table, {
26447
26482
  dataSource: filteredData,
26448
- columns: columns,
26483
+ columns: displayColumns,
26449
26484
  rowSelection: rowSelection,
26450
- rowKey: rowKeyMap[type] || 'billNo',
26485
+ rowKey: rowKey,
26451
26486
  size: "small",
26452
26487
  pagination: false,
26453
26488
  scroll: {
package/dist/index.js CHANGED
@@ -26410,11 +26410,46 @@ var index$2 = (function (props) {
26410
26410
  return _ref13.apply(this, arguments);
26411
26411
  };
26412
26412
  }();
26413
- var rowSelection = {
26414
- type: isRadio ? 'radio' : 'checkbox',
26413
+ var rowKey = rowKeyMap[type] || 'billNo';
26414
+ var handleRadioChange = function handleRadioChange(record) {
26415
+ var _value$selectIds;
26416
+ if (disabled) return;
26417
+ var currentKey = String(value === null || value === void 0 ? void 0 : (_value$selectIds = value.selectIds) === null || _value$selectIds === void 0 ? void 0 : _value$selectIds[0]);
26418
+ var rowKeyVal = String(record[rowKey]);
26419
+ if (currentKey && currentKey === rowKeyVal) {
26420
+ _onChange(_objectSpread2(_objectSpread2({}, value), {}, {
26421
+ selectIds: [],
26422
+ selectedRows: []
26423
+ }));
26424
+ } else {
26425
+ _onChange(_objectSpread2(_objectSpread2({}, value), {}, {
26426
+ selectIds: [rowKeyVal],
26427
+ selectedRows: [record]
26428
+ }));
26429
+ }
26430
+ };
26431
+ var radioColumn = isRadio ? {
26432
+ width: 50,
26433
+ fixed: true,
26434
+ render: function render(_, record) {
26435
+ var _value$selectIds2;
26436
+ var checked = String(value === null || value === void 0 ? void 0 : (_value$selectIds2 = value.selectIds) === null || _value$selectIds2 === void 0 ? void 0 : _value$selectIds2[0]) === String(record[rowKey]);
26437
+ return /*#__PURE__*/React__default['default'].createElement(antd.Radio, {
26438
+ checked: checked,
26439
+ onClick: function onClick(e) {
26440
+ e.preventDefault();
26441
+ handleRadioChange(record);
26442
+ },
26443
+ disabled: disabled
26444
+ });
26445
+ }
26446
+ } : null;
26447
+ var displayColumns = isRadio && radioColumn ? [radioColumn].concat(_toConsumableArray(columns)) : columns;
26448
+ var rowSelection = isRadio ? undefined : {
26449
+ type: 'checkbox',
26415
26450
  selectedRowKeys: (value === null || value === void 0 ? void 0 : value.selectIds) || [],
26416
26451
  fixed: true,
26417
- onChange: function onChange(selectedRowKeys, selectedRows, info) {
26452
+ onChange: function onChange(selectedRowKeys, selectedRows) {
26418
26453
  _onChange(_objectSpread2(_objectSpread2({}, value), {}, {
26419
26454
  selectIds: selectedRowKeys,
26420
26455
  selectedRows: selectedRows
@@ -26460,9 +26495,9 @@ var index$2 = (function (props) {
26460
26495
  allowClear: true
26461
26496
  })), /*#__PURE__*/React__default['default'].createElement(antd.Table, {
26462
26497
  dataSource: filteredData,
26463
- columns: columns,
26498
+ columns: displayColumns,
26464
26499
  rowSelection: rowSelection,
26465
- rowKey: rowKeyMap[type] || 'billNo',
26500
+ rowKey: rowKey,
26466
26501
  size: "small",
26467
26502
  pagination: false,
26468
26503
  scroll: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "2.6.1-beta.3",
3
+ "version": "2.6.1-beta.5",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -20,7 +20,7 @@
20
20
  "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "2.6.1-beta.3",
23
+ "@kmkf-fe-packages/kmkf-utils": "2.6.1-beta.5",
24
24
  "ahooks": "^3.7.4",
25
25
  "ali-react-table": "2.6.1",
26
26
  "bignumber.js": "^9.1.2",
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "b8278a54ccc947841ab3621a391ab8bdd289c411"
69
+ "gitHead": "4b651e9288dade56d396b99a37f94011cf80779b"
70
70
  }