@synerise/ds-table 1.6.3 → 1.6.4
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/CHANGELOG.md +11 -0
- package/README.md +10 -9
- package/dist/TableHeader/TableSelection.js +16 -17
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.6.4](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@1.6.3...@synerise/ds-table@1.6.4) (2025-10-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **table:** updated batch checkbox change logic ([666bb54](https://github.com/synerise/synerise-design/commit/666bb54ed31e6d8417fedc3a9281b81643fd8bbd))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.6.3](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@1.6.2...@synerise/ds-table@1.6.3) (2025-09-30)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-table
|
package/README.md
CHANGED
|
@@ -91,16 +91,17 @@ This type of table requires a specific type of dataSource which has to contain a
|
|
|
91
91
|
| groupType | Type of active grouping | `value` / `ranges` / `interval` / undefined | - |
|
|
92
92
|
|
|
93
93
|
#### RowSelection
|
|
94
|
+
| Property | Description | Type | Default |
|
|
95
|
+
|----------------------------------|--------------------------------------------------------|-----------------------------------------------------------------|---------|
|
|
96
|
+
| fixed | Whether to show selection column as fixed or not | boolean | - |
|
|
97
|
+
| selectedRowKeys | Array of selected row keys | React.ReactText | [] |
|
|
98
|
+
| selections | Selections options available in table title | SelectionItem[] | - |
|
|
99
|
+
| onChange | Callback executed when selection changes | (selectedRowKeys: React.ReactText[], selectedRows: T[]) => void | - |
|
|
100
|
+
| limit | Max length of selection rows array | number | - |
|
|
101
|
+
| independentSelectionExpandedRows | Allows to select parent and child rows independently | boolean | - |
|
|
102
|
+
| checkRowSelectionStatus | Validator function record selection status | (record: T) => SelectionStatus | - |
|
|
103
|
+
| globalSelection | Global selection config (for use with infinite loader) | { isSelected: boolean; onChange: (selected: boolean) => void; } | - |
|
|
94
104
|
|
|
95
|
-
| Property | Description | Type | Default |
|
|
96
|
-
| -------------------------------- | ---------------------------------------------------- | --------------------------------------------------------------- | ------- |
|
|
97
|
-
| fixed | Whether to show selection column as fixed or not | boolean | - |
|
|
98
|
-
| selectedRowKeys | Array of selected row keys | React.ReactText | [] |
|
|
99
|
-
| selections | Selections options available in table title | SelectionItem[] | - |
|
|
100
|
-
| onChange | Callback executed when selection changes | (selectedRowKeys: React.ReactText[], selectedRows: T[]) => void | - |
|
|
101
|
-
| limit | Max length of selection rows array | number | - |
|
|
102
|
-
| independentSelectionExpandedRows | Allows to select parent and child rows independently | boolean | - |
|
|
103
|
-
| checkRowSelectionStatus | Validator function record selection status | (record: T) => SelectionStatus | - |
|
|
104
105
|
|
|
105
106
|
#### SelectionStatus
|
|
106
107
|
|
|
@@ -10,7 +10,7 @@ import { useBulkSelectionCount } from '../hooks/useBulkSelection';
|
|
|
10
10
|
import { useRowKey } from '../hooks/useRowKey';
|
|
11
11
|
import { isRecordSelectable } from '../utils';
|
|
12
12
|
var TableSelection = function TableSelection(_ref) {
|
|
13
|
-
var _selection$
|
|
13
|
+
var _selection$globalSele7;
|
|
14
14
|
var dataSource = _ref.dataSource,
|
|
15
15
|
dataSourceFull = _ref.dataSourceFull,
|
|
16
16
|
selection = _ref.selection,
|
|
@@ -162,15 +162,14 @@ var TableSelection = function TableSelection(_ref) {
|
|
|
162
162
|
var isAllSelected = !disabledBulkSelection && selectableRecordsCount === selectableAndSelectedRecordsCount;
|
|
163
163
|
var isAnySelected = allRecordsCount > 0 && selectedRecordsCount > 0;
|
|
164
164
|
var selectionTooltipTitle = useMemo(function () {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return locale == null ? void 0 : locale.unselectGlobalAll;
|
|
165
|
+
if (selection.globalSelection) {
|
|
166
|
+
return selection.globalSelection.isSelected ? locale == null ? void 0 : locale.unselectGlobalAll : locale == null ? void 0 : locale.selectGlobalAll;
|
|
168
167
|
}
|
|
169
168
|
return isAllSelected ? locale == null ? void 0 : locale.unselectAll : locale == null ? void 0 : locale.selectAllTooltip;
|
|
170
|
-
}, [isAllSelected, locale == null ? void 0 : locale.selectAllTooltip, locale == null ? void 0 : locale.
|
|
169
|
+
}, [isAllSelected, locale == null ? void 0 : locale.selectAllTooltip, locale == null ? void 0 : locale.selectGlobalAll, locale == null ? void 0 : locale.unselectAll, locale == null ? void 0 : locale.unselectGlobalAll, selection.globalSelection]);
|
|
171
170
|
var menuDataSource = useMemo(function () {
|
|
172
|
-
var _selection$
|
|
173
|
-
var isGlobalAllSelected = (_selection$
|
|
171
|
+
var _selection$globalSele4, _selection$selections;
|
|
172
|
+
var isGlobalAllSelected = (_selection$globalSele4 = selection.globalSelection) == null ? void 0 : _selection$globalSele4.isSelected;
|
|
174
173
|
var globalSelectionItem = selection.globalSelection ? [isGlobalAllSelected ? {
|
|
175
174
|
onClick: unselectGlobalAll,
|
|
176
175
|
text: locale == null ? void 0 : locale.unselectGlobalAll
|
|
@@ -215,6 +214,15 @@ var TableSelection = function TableSelection(_ref) {
|
|
|
215
214
|
});
|
|
216
215
|
return [].concat(globalSelectionItem, menuItems || []);
|
|
217
216
|
}, [selection.globalSelection, selection == null ? void 0 : selection.selections, unselectGlobalAll, locale == null ? void 0 : locale.unselectGlobalAll, locale == null ? void 0 : locale.selectGlobalAll, locale == null ? void 0 : locale.selectAll, locale == null ? void 0 : locale.unselectAll, locale == null ? void 0 : locale.selectInvert, selectGlobalAll, isAllSelected, hasSelectionLimit, isAnySelected, selectAll, unselectAll, selectInvert]);
|
|
217
|
+
var handleBatchSelectionChange = function handleBatchSelectionChange() {
|
|
218
|
+
var _selection$globalSele5, _selection$globalSele6;
|
|
219
|
+
var isSelected = (_selection$globalSele5 = (_selection$globalSele6 = selection.globalSelection) == null ? void 0 : _selection$globalSele6.isSelected) != null ? _selection$globalSele5 : isAllSelected;
|
|
220
|
+
if (selection.globalSelection) {
|
|
221
|
+
isSelected ? unselectGlobalAll() : selectGlobalAll();
|
|
222
|
+
} else {
|
|
223
|
+
isSelected ? unselectAll() : selectAll();
|
|
224
|
+
}
|
|
225
|
+
};
|
|
218
226
|
return selection != null && selection.selectedRowKeys ? /*#__PURE__*/React.createElement(S.Selection, {
|
|
219
227
|
"data-popup-container": true
|
|
220
228
|
}, !hasSelectionLimit && /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -223,16 +231,7 @@ var TableSelection = function TableSelection(_ref) {
|
|
|
223
231
|
disabled: disabledBulkSelection,
|
|
224
232
|
"data-testid": "ds-table-batch-selection-button",
|
|
225
233
|
checked: ((_selection$globalSele7 = selection.globalSelection) == null ? void 0 : _selection$globalSele7.isSelected) || isAllSelected,
|
|
226
|
-
onChange:
|
|
227
|
-
var _selection$globalSele8;
|
|
228
|
-
if ((_selection$globalSele8 = selection.globalSelection) != null && _selection$globalSele8.isSelected) {
|
|
229
|
-
unselectGlobalAll();
|
|
230
|
-
} else if (!isAllSelected) {
|
|
231
|
-
selectAll();
|
|
232
|
-
} else {
|
|
233
|
-
unselectAll();
|
|
234
|
-
}
|
|
235
|
-
},
|
|
234
|
+
onChange: handleBatchSelectionChange,
|
|
236
235
|
indeterminate: isIndeterminate
|
|
237
236
|
})), (selection.selections || !!(menuDataSource != null && menuDataSource.length)) && /*#__PURE__*/React.createElement(Dropdown, {
|
|
238
237
|
disabled: disabledBulkSelection || (menuDataSource == null ? void 0 : menuDataSource.length) === 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-table",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "Table UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
76
76
|
"styled-components": "^5.3.3"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "2f453d3ec29744efda93cec90074ceb8fb7e038c"
|
|
79
79
|
}
|