@archbase/components 4.0.28 → 4.0.29
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archbase/components",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.29",
|
|
4
4
|
"description": "UI Components for Archbase React v3 - Form editors, data visualization, and business components",
|
|
5
5
|
"author": "Edson Martins <edsonmartins2005@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -118,9 +118,9 @@
|
|
|
118
118
|
"vis-timeline": "^7.7.3",
|
|
119
119
|
"xlsx": "^0.18.5",
|
|
120
120
|
"yet-another-react-lightbox": "^3.21.0",
|
|
121
|
-
"@archbase/core": "4.0.
|
|
122
|
-
"@archbase/data": "4.0.
|
|
123
|
-
"@archbase/layout": "4.0.
|
|
121
|
+
"@archbase/core": "4.0.29",
|
|
122
|
+
"@archbase/data": "4.0.29",
|
|
123
|
+
"@archbase/layout": "4.0.29"
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
126
|
"@types/d3": "^7.4.3",
|
|
@@ -99,6 +99,7 @@ import {
|
|
|
99
99
|
type GridReadyEvent,
|
|
100
100
|
type SelectionChangedEvent,
|
|
101
101
|
type CellDoubleClickedEvent,
|
|
102
|
+
type CellFocusedEvent,
|
|
102
103
|
type SortChangedEvent,
|
|
103
104
|
type FilterChangedEvent,
|
|
104
105
|
type RowSelectionOptions,
|
|
@@ -663,6 +664,47 @@ function ArchbaseDataGridAG<T extends object = any, ID = any>(
|
|
|
663
664
|
[onSelectedRowsChanged, dataSource]
|
|
664
665
|
);
|
|
665
666
|
|
|
667
|
+
// Cell focus handler — mantém o registro atual (cursor) do DataSource em sincronia
|
|
668
|
+
// com a linha focada, tanto no clique quanto na navegação por teclado (setas).
|
|
669
|
+
// A seleção via checkbox (onSelectionChanged) é independente e continua dirigindo
|
|
670
|
+
// ações em lote; este handler cuida apenas do cursor usado por formulários de edição.
|
|
671
|
+
// Replica o comportamento da grid anterior (evento cellFocusIn do MUI X DataGrid).
|
|
672
|
+
const onCellFocused = useCallback(
|
|
673
|
+
(event: CellFocusedEvent) => {
|
|
674
|
+
if (syncInProgress.current) return;
|
|
675
|
+
if (event.rowIndex == null) return;
|
|
676
|
+
|
|
677
|
+
const node = event.api.getDisplayedRowAtIndex(event.rowIndex);
|
|
678
|
+
const data = node?.data as T | undefined;
|
|
679
|
+
if (!data || !dataSource.gotoRecordByData) return;
|
|
680
|
+
|
|
681
|
+
// Evita sincronizar (e emitir afterScroll) quando o registro focado já é o
|
|
682
|
+
// atual do DataSource — gotoRecordByData emite o evento mesmo sem mudar o
|
|
683
|
+
// cursor, o que geraria eventos redundantes e risco de loop.
|
|
684
|
+
const currentRecord = dataSource.getCurrentRecord?.();
|
|
685
|
+
if (currentRecord) {
|
|
686
|
+
try {
|
|
687
|
+
const currentId = safeGetRowId(currentRecord, getRowId);
|
|
688
|
+
const focusedId = safeGetRowId(data, getRowId);
|
|
689
|
+
if (String(currentId) === String(focusedId)) return;
|
|
690
|
+
} catch {
|
|
691
|
+
// se a comparação falhar, segue com a sincronização
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
syncInProgress.current = true;
|
|
696
|
+
try {
|
|
697
|
+
dataSource.gotoRecordByData(data);
|
|
698
|
+
} catch (error) {
|
|
699
|
+
console.error('[CELL FOCUS] Error syncing with DataSource:', error);
|
|
700
|
+
}
|
|
701
|
+
setTimeout(() => {
|
|
702
|
+
syncInProgress.current = false;
|
|
703
|
+
}, 100);
|
|
704
|
+
},
|
|
705
|
+
[dataSource, getRowId]
|
|
706
|
+
);
|
|
707
|
+
|
|
666
708
|
// Cell double click handler
|
|
667
709
|
const onCellDoubleClicked = useCallback(
|
|
668
710
|
(event: CellDoubleClickedEvent) => {
|
|
@@ -1286,6 +1328,7 @@ function ArchbaseDataGridAG<T extends object = any, ID = any>(
|
|
|
1286
1328
|
rowSelection={rowSelection}
|
|
1287
1329
|
onGridReady={onGridReady}
|
|
1288
1330
|
onSelectionChanged={onSelectionChanged}
|
|
1331
|
+
onCellFocused={onCellFocused}
|
|
1289
1332
|
onCellDoubleClicked={onCellDoubleClicked}
|
|
1290
1333
|
onSortChanged={onSortChanged}
|
|
1291
1334
|
onFilterChanged={onFilterChanged}
|
|
Binary file
|