@trackunit/react-table 1.3.185 → 1.3.188
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/index.cjs.js +11 -4
- package/index.esm.js +11 -4
- package/package.json +11 -11
package/index.cjs.js
CHANGED
|
@@ -1314,11 +1314,18 @@ const useTableSelection = ({ data, idKey, defaultSelectedIds, enableRowSelection
|
|
|
1314
1314
|
const [t] = useTranslation();
|
|
1315
1315
|
const [rowSelection, setRowSelection] = react.useState({});
|
|
1316
1316
|
react.useEffect(() => {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1317
|
+
if (!defaultSelectedIds) {
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
const initialSelection = defaultSelectedIds.reduce((selection, id) => {
|
|
1321
|
+
selection[String(id)] = true;
|
|
1322
|
+
return selection;
|
|
1323
|
+
}, {});
|
|
1324
|
+
setRowSelection(prev => {
|
|
1325
|
+
const hasChanged = sharedUtils.objectKeys(prev).length !== sharedUtils.objectKeys(initialSelection).length ||
|
|
1326
|
+
sharedUtils.objectEntries(initialSelection).some(([key, value]) => prev[key] !== value);
|
|
1327
|
+
return hasChanged ? { ...initialSelection } : prev;
|
|
1320
1328
|
});
|
|
1321
|
-
setRowSelection(() => ({ ...initialSelection }));
|
|
1322
1329
|
}, [defaultSelectedIds]);
|
|
1323
1330
|
const toggleRowSelectionState = react.useCallback((id) => {
|
|
1324
1331
|
setRowSelection(prevRowSelection => {
|
package/index.esm.js
CHANGED
|
@@ -1313,11 +1313,18 @@ const useTableSelection = ({ data, idKey, defaultSelectedIds, enableRowSelection
|
|
|
1313
1313
|
const [t] = useTranslation();
|
|
1314
1314
|
const [rowSelection, setRowSelection] = useState({});
|
|
1315
1315
|
useEffect(() => {
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1316
|
+
if (!defaultSelectedIds) {
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
const initialSelection = defaultSelectedIds.reduce((selection, id) => {
|
|
1320
|
+
selection[String(id)] = true;
|
|
1321
|
+
return selection;
|
|
1322
|
+
}, {});
|
|
1323
|
+
setRowSelection(prev => {
|
|
1324
|
+
const hasChanged = objectKeys(prev).length !== objectKeys(initialSelection).length ||
|
|
1325
|
+
objectEntries(initialSelection).some(([key, value]) => prev[key] !== value);
|
|
1326
|
+
return hasChanged ? { ...initialSelection } : prev;
|
|
1319
1327
|
});
|
|
1320
|
-
setRowSelection(() => ({ ...initialSelection }));
|
|
1321
1328
|
}, [defaultSelectedIds]);
|
|
1322
1329
|
const toggleRowSelectionState = useCallback((id) => {
|
|
1323
1330
|
setRowSelection(prevRowSelection => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-table",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.188",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"jest-fetch-mock": "^3.0.3",
|
|
16
16
|
"@tanstack/react-router": "1.114.29",
|
|
17
17
|
"tailwind-merge": "^2.0.0",
|
|
18
|
-
"@trackunit/react-components": "1.4.
|
|
19
|
-
"@trackunit/shared-utils": "1.5.
|
|
20
|
-
"@trackunit/css-class-variance-utilities": "1.3.
|
|
21
|
-
"@trackunit/ui-icons": "1.3.
|
|
22
|
-
"@trackunit/react-table-base-components": "1.3.
|
|
23
|
-
"@trackunit/react-table-pagination": "1.3.
|
|
24
|
-
"@trackunit/react-form-components": "1.3.
|
|
25
|
-
"@trackunit/i18n-library-translation": "1.3.
|
|
26
|
-
"@trackunit/react-core-contexts-api": "1.4.
|
|
27
|
-
"@trackunit/react-test-setup": "1.0.
|
|
18
|
+
"@trackunit/react-components": "1.4.146",
|
|
19
|
+
"@trackunit/shared-utils": "1.5.121",
|
|
20
|
+
"@trackunit/css-class-variance-utilities": "1.3.121",
|
|
21
|
+
"@trackunit/ui-icons": "1.3.122",
|
|
22
|
+
"@trackunit/react-table-base-components": "1.3.166",
|
|
23
|
+
"@trackunit/react-table-pagination": "1.3.121",
|
|
24
|
+
"@trackunit/react-form-components": "1.3.166",
|
|
25
|
+
"@trackunit/i18n-library-translation": "1.3.137",
|
|
26
|
+
"@trackunit/react-core-contexts-api": "1.4.127",
|
|
27
|
+
"@trackunit/react-test-setup": "1.0.11"
|
|
28
28
|
},
|
|
29
29
|
"module": "./index.esm.js",
|
|
30
30
|
"main": "./index.cjs.js",
|