@widergy/energy-ui 3.1.5 → 3.1.7

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [3.1.7](https://github.com/widergy/energy-ui/compare/v3.1.6...v3.1.7) (2024-02-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fixes undefined utils ([#410](https://github.com/widergy/energy-ui/issues/410)) ([0669d9f](https://github.com/widergy/energy-ui/commit/0669d9fc10be03883342cc9669b8d96729e36069))
7
+
8
+ ## [3.1.6](https://github.com/widergy/energy-ui/compare/v3.1.5...v3.1.6) (2024-02-05)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * uttable select all logic not working ([#408](https://github.com/widergy/energy-ui/issues/408)) ([a61e69b](https://github.com/widergy/energy-ui/commit/a61e69b26afa6f2097ada3dac007bc9c3f2fd6e4))
14
+
1
15
  ## [3.1.5](https://github.com/widergy/energy-ui/compare/v3.1.4...v3.1.5) (2024-01-31)
2
16
 
3
17
 
@@ -117,6 +117,10 @@ const UTTable = _ref => {
117
117
  setPage(newPage);
118
118
  if (onPageChange) onPageChange(newPage);
119
119
  };
120
+ const allDisplayedRowsAreSelected = newSelectedRows => {
121
+ const displayedRows = (0, _utils.getSelectableRowIds)(rows, rowKey, disableRowSelection);
122
+ return displayedRows.every(value => newSelectedRows.includes(value));
123
+ };
120
124
  const selectRow = row => {
121
125
  if (!row[rowKey]) return null;
122
126
  const pageRowsIds = (0, _utils.getSelectableRowIds)(currentRows, rowKey, disableRowSelection);
@@ -127,7 +131,7 @@ const UTTable = _ref => {
127
131
  const rowKeyIndex = selectedRows.indexOf(row[rowKey]);
128
132
  if (rowKeyIndex === -1) newSelectedRows = [...selectedRows, row[rowKey]];else newSelectedRows = selectedRows.filter(el => el !== row[rowKey]);
129
133
  const pageNewSelectedRows = newSelectedRows.filter(newSelectedRow => pageRowsIds.includes(newSelectedRow));
130
- const allSelected = selectAllInCurrentPageOnly ? pageNewSelectedRows.length === pageRowsIds.length : newSelectedRows.length === (0, _utils.getSelectableRowIds)(rows, rowKey, disableRowSelection).length;
134
+ const allSelected = selectAllInCurrentPageOnly ? pageNewSelectedRows.length === pageRowsIds.length : allDisplayedRowsAreSelected(newSelectedRows);
131
135
  if (!allSelected && selectedAll) setSelectedAll(false);
132
136
  if (allSelected && !selectedAll) setSelectedAll(true);
133
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.1.5",
3
+ "version": "3.1.7",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",