es-grid-template 1.8.58 → 1.8.59

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.
@@ -15,7 +15,5 @@ interface UseColumnsConfig<RecordType> {
15
15
  rowKey?: any;
16
16
  onMouseHover?: any;
17
17
  }
18
- declare const useColumns: <RecordType extends AnyObject = AnyObject>(config: UseColumnsConfig<RecordType>) => readonly [
19
- any
20
- ];
18
+ declare const useColumns: <RecordType extends AnyObject = AnyObject>(config: UseColumnsConfig<RecordType>) => readonly [any];
21
19
  export default useColumns;
@@ -65,33 +65,6 @@ const TableBody = ({
65
65
  })))) : /*#__PURE__*/React.createElement(Fragment, null, virtualRows.map(virtualRow => {
66
66
  const row = rows[virtualRow.index];
67
67
  const isEditing = row.id === editingKey;
68
-
69
- // return (
70
- // <tr key={row.id}>
71
- // {row.getVisibleCells().map((cell) => (
72
- // <td
73
- // key={cell.id}
74
- // style={{
75
- // padding: '12px',
76
- // whiteSpace: 'nowrap',
77
- // fontSize: '0.875rem',
78
- // color: '#6b7280',
79
- // border: '1px solid #e5e7eb',
80
- // width: cell.column.getSize(),
81
- // maxWidth: cell.column.getSize(),
82
- // overflow: "hidden",
83
- // ...getCommonPinningStyles(cell.column)
84
- // }}>
85
-
86
- // {cell.column.id}
87
-
88
- // {/* {flexRender(cell.column.columnDef.cell, cell.getContext())} */}
89
-
90
- // </td>
91
- // ))}
92
- // </tr>
93
- // )
94
-
95
68
  return /*#__PURE__*/React.createElement(TableBodyRow, _extends({}, rest, {
96
69
  table: table,
97
70
  tableId: tableId,
@@ -208,7 +208,7 @@ export const toggleRowSelection = props => {
208
208
  isChange: true,
209
209
  type: 'rowSelected',
210
210
  rowData: row.original,
211
- rowsData: checkedRows
211
+ rowsData: selectionSettings?.type === 'single' ? [row] : checkedRows
212
212
  });
213
213
  }
214
214
  return;
@@ -284,8 +284,11 @@ export const toggleRowSelection = props => {
284
284
  } else {
285
285
  // chỉ thêm vào row hiện tại
286
286
 
287
- const isInclude = prevSelected.find(it => it.id === cell.row.id);
288
- if (isInclude) {
287
+ const isInclude = prevSelected.findIndex(it => it.id === cell.row.id);
288
+ if (isInclude > -1) {
289
+ // cập nhật data row hiện tại
290
+
291
+ prevSelected[isInclude] = row;
289
292
  checkedRows = [...prevSelected];
290
293
  } else {
291
294
  checkedRows = [...prevSelected, row];
@@ -76,33 +76,6 @@ const TableBody = ({
76
76
  })))) : /*#__PURE__*/_react.default.createElement(_react.Fragment, null, virtualRows.map(virtualRow => {
77
77
  const row = rows[virtualRow.index];
78
78
  const isEditing = row.id === editingKey;
79
-
80
- // return (
81
- // <tr key={row.id}>
82
- // {row.getVisibleCells().map((cell) => (
83
- // <td
84
- // key={cell.id}
85
- // style={{
86
- // padding: '12px',
87
- // whiteSpace: 'nowrap',
88
- // fontSize: '0.875rem',
89
- // color: '#6b7280',
90
- // border: '1px solid #e5e7eb',
91
- // width: cell.column.getSize(),
92
- // maxWidth: cell.column.getSize(),
93
- // overflow: "hidden",
94
- // ...getCommonPinningStyles(cell.column)
95
- // }}>
96
-
97
- // {cell.column.id}
98
-
99
- // {/* {flexRender(cell.column.columnDef.cell, cell.getContext())} */}
100
-
101
- // </td>
102
- // ))}
103
- // </tr>
104
- // )
105
-
106
79
  return /*#__PURE__*/_react.default.createElement(_TableBodyRow.default, (0, _extends2.default)({}, rest, {
107
80
  table: table,
108
81
  tableId: tableId,
@@ -219,7 +219,7 @@ const toggleRowSelection = props => {
219
219
  isChange: true,
220
220
  type: 'rowSelected',
221
221
  rowData: row.original,
222
- rowsData: checkedRows
222
+ rowsData: selectionSettings?.type === 'single' ? [row] : checkedRows
223
223
  });
224
224
  }
225
225
  return;
@@ -295,8 +295,11 @@ const toggleRowSelection = props => {
295
295
  } else {
296
296
  // chỉ thêm vào row hiện tại
297
297
 
298
- const isInclude = prevSelected.find(it => it.id === cell.row.id);
299
- if (isInclude) {
298
+ const isInclude = prevSelected.findIndex(it => it.id === cell.row.id);
299
+ if (isInclude > -1) {
300
+ // cập nhật data row hiện tại
301
+
302
+ prevSelected[isInclude] = row;
300
303
  checkedRows = [...prevSelected];
301
304
  } else {
302
305
  checkedRows = [...prevSelected, row];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.8.58",
3
+ "version": "1.8.59",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",