@archbase/components 4.0.27 → 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",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"src"
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@mantine/carousel": "9.
|
|
27
|
-
"@mantine/charts": "9.
|
|
28
|
-
"@mantine/code-highlight": "9.
|
|
29
|
-
"@mantine/core": "9.
|
|
30
|
-
"@mantine/dates": "9.
|
|
31
|
-
"@mantine/dropzone": "9.
|
|
32
|
-
"@mantine/form": "9.
|
|
33
|
-
"@mantine/hooks": "9.
|
|
34
|
-
"@mantine/modals": "9.
|
|
35
|
-
"@mantine/notifications": "9.
|
|
26
|
+
"@mantine/carousel": "9.3.0",
|
|
27
|
+
"@mantine/charts": "9.3.0",
|
|
28
|
+
"@mantine/code-highlight": "9.3.0",
|
|
29
|
+
"@mantine/core": "9.3.0",
|
|
30
|
+
"@mantine/dates": "9.3.0",
|
|
31
|
+
"@mantine/dropzone": "9.3.0",
|
|
32
|
+
"@mantine/form": "9.3.0",
|
|
33
|
+
"@mantine/hooks": "9.3.0",
|
|
34
|
+
"@mantine/modals": "9.3.0",
|
|
35
|
+
"@mantine/notifications": "9.3.0",
|
|
36
36
|
"@tabler/icons-react": "^3.26.0",
|
|
37
37
|
"react": "^18.3.0 || ^19.2.0",
|
|
38
38
|
"react-dom": "^18.3.0 || ^19.2.0"
|
|
@@ -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",
|
|
@@ -87,7 +87,10 @@ import { AgGridReact } from 'ag-grid-react';
|
|
|
87
87
|
// Memoize AgGridReact — recommended by AG-Grid's official performance demo. This
|
|
88
88
|
// is by far the biggest scroll-perf win: it skips the full AG-Grid re-render when
|
|
89
89
|
// the parent re-renders but every prop reference is the same.
|
|
90
|
-
|
|
90
|
+
// React.memo apaga o parâmetro genérico de AgGridReact<TData> (TData vira unknown),
|
|
91
|
+
// fazendo columnDefs/getRowId tipados com <T> não baterem. O cast preserva a
|
|
92
|
+
// assinatura genérica original para que TData seja inferido de rowData={rows} (T[]).
|
|
93
|
+
const AgGridReactMemo = React.memo(AgGridReact) as unknown as typeof AgGridReact;
|
|
91
94
|
import {
|
|
92
95
|
AllCommunityModule,
|
|
93
96
|
ModuleRegistry,
|
|
@@ -96,6 +99,7 @@ import {
|
|
|
96
99
|
type GridReadyEvent,
|
|
97
100
|
type SelectionChangedEvent,
|
|
98
101
|
type CellDoubleClickedEvent,
|
|
102
|
+
type CellFocusedEvent,
|
|
99
103
|
type SortChangedEvent,
|
|
100
104
|
type FilterChangedEvent,
|
|
101
105
|
type RowSelectionOptions,
|
|
@@ -660,6 +664,47 @@ function ArchbaseDataGridAG<T extends object = any, ID = any>(
|
|
|
660
664
|
[onSelectedRowsChanged, dataSource]
|
|
661
665
|
);
|
|
662
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
|
+
|
|
663
708
|
// Cell double click handler
|
|
664
709
|
const onCellDoubleClicked = useCallback(
|
|
665
710
|
(event: CellDoubleClickedEvent) => {
|
|
@@ -1283,6 +1328,7 @@ function ArchbaseDataGridAG<T extends object = any, ID = any>(
|
|
|
1283
1328
|
rowSelection={rowSelection}
|
|
1284
1329
|
onGridReady={onGridReady}
|
|
1285
1330
|
onSelectionChanged={onSelectionChanged}
|
|
1331
|
+
onCellFocused={onCellFocused}
|
|
1286
1332
|
onCellDoubleClicked={onCellDoubleClicked}
|
|
1287
1333
|
onSortChanged={onSortChanged}
|
|
1288
1334
|
onFilterChanged={onFilterChanged}
|
|
Binary file
|