@alaarab/ogrid-react 2.0.4 → 2.0.6
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.
|
@@ -51,9 +51,14 @@ export function useDataGridState(params) {
|
|
|
51
51
|
: flatColumns;
|
|
52
52
|
if (!columnOrder?.length)
|
|
53
53
|
return filtered;
|
|
54
|
+
// Build index map for O(1) lookup instead of repeated O(n) indexOf
|
|
55
|
+
const orderMap = new Map();
|
|
56
|
+
for (let i = 0; i < columnOrder.length; i++) {
|
|
57
|
+
orderMap.set(columnOrder[i], i);
|
|
58
|
+
}
|
|
54
59
|
return [...filtered].sort((a, b) => {
|
|
55
|
-
const ia =
|
|
56
|
-
const ib =
|
|
60
|
+
const ia = orderMap.get(a.columnId) ?? -1;
|
|
61
|
+
const ib = orderMap.get(b.columnId) ?? -1;
|
|
57
62
|
if (ia === -1 && ib === -1)
|
|
58
63
|
return 0;
|
|
59
64
|
if (ia === -1)
|
|
@@ -336,7 +341,14 @@ export function useDataGridState(params) {
|
|
|
336
341
|
canPinRight: headerMenuResult.canPinRight,
|
|
337
342
|
canUnpin: headerMenuResult.canUnpin,
|
|
338
343
|
},
|
|
339
|
-
}), [
|
|
344
|
+
}), [
|
|
345
|
+
pinningResult.pinnedColumns, pinningResult.pinColumn, pinningResult.unpinColumn,
|
|
346
|
+
pinningResult.isPinned, pinningResult.computeLeftOffsets, pinningResult.computeRightOffsets,
|
|
347
|
+
headerMenuResult.isOpen, headerMenuResult.openForColumn, headerMenuResult.anchorElement,
|
|
348
|
+
headerMenuResult.open, headerMenuResult.close, headerMenuResult.handlePinLeft,
|
|
349
|
+
headerMenuResult.handlePinRight, headerMenuResult.handleUnpin,
|
|
350
|
+
headerMenuResult.canPinLeft, headerMenuResult.canPinRight, headerMenuResult.canUnpin,
|
|
351
|
+
]);
|
|
340
352
|
return {
|
|
341
353
|
layout: layoutState,
|
|
342
354
|
rowSelection: rowSelectionState,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-react",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "OGrid React – React hooks, headless components, and utilities for OGrid data grids.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -31,19 +31,20 @@
|
|
|
31
31
|
"README.md",
|
|
32
32
|
"LICENSE"
|
|
33
33
|
],
|
|
34
|
+
"sideEffects": false,
|
|
34
35
|
"engines": {
|
|
35
36
|
"node": ">=18"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@alaarab/ogrid-core": "2.0.
|
|
39
|
-
"@tanstack/react-virtual": "^3.
|
|
39
|
+
"@alaarab/ogrid-core": "2.0.6",
|
|
40
|
+
"@tanstack/react-virtual": "^3.13.18"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
43
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@testing-library/jest-dom": "^6.
|
|
46
|
-
"@testing-library/react": "^16.
|
|
46
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
47
|
+
"@testing-library/react": "^16.3.2",
|
|
47
48
|
"@testing-library/user-event": "^14.6.1",
|
|
48
49
|
"@types/react": "^18.3.18",
|
|
49
50
|
"@types/react-dom": "^18.3.5",
|