@linzjs/step-ag-grid 29.1.6 → 29.2.0
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/dist/step-ag-grid.esm.js
CHANGED
|
@@ -2826,10 +2826,27 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
2826
2826
|
needsAutoSize.current = false;
|
|
2827
2827
|
}, [autoSizeColumns, gridRenderState, params, rowData, sizeColumns, sizeColumnsToFit]);
|
|
2828
2828
|
const lastOwnerDocumentRef = useRef();
|
|
2829
|
+
const wasVisibleRef = useRef(false);
|
|
2829
2830
|
/**
|
|
2830
2831
|
* Auto-size windows that had deferred auto-size
|
|
2832
|
+
* Reset focus if panel went from invisible to visible.
|
|
2831
2833
|
*/
|
|
2832
2834
|
useInterval(() => {
|
|
2835
|
+
// If grid has become visible after previously being hidden, then refocus the last focused cell.
|
|
2836
|
+
const visible = !!gridDivRef.current?.checkVisibility();
|
|
2837
|
+
if (visible && !wasVisibleRef.current) {
|
|
2838
|
+
wasVisibleRef.current = true;
|
|
2839
|
+
const el = window.__stepaggrid_lastfocuseventtarget;
|
|
2840
|
+
if (el) {
|
|
2841
|
+
// Setting this to null will cause a new refocus event
|
|
2842
|
+
window.__stepaggrid_lastfocuseventtarget = null;
|
|
2843
|
+
// Check element is still part of document
|
|
2844
|
+
if (el.checkVisibility()) {
|
|
2845
|
+
el.focus();
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
wasVisibleRef.current = visible;
|
|
2833
2850
|
// Check if window has been popped out and needs resize
|
|
2834
2851
|
const currentDocument = gridDivRef.current?.ownerDocument;
|
|
2835
2852
|
if (currentDocument !== lastOwnerDocumentRef.current) {
|
|
@@ -3156,7 +3173,7 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3156
3173
|
}
|
|
3157
3174
|
}, [clearHighlightRowClasses]);
|
|
3158
3175
|
const onCellFocused = useCallback((event) => {
|
|
3159
|
-
if (
|
|
3176
|
+
if (event.rowIndex == null) {
|
|
3160
3177
|
return;
|
|
3161
3178
|
}
|
|
3162
3179
|
const api = event.api;
|
|
@@ -3170,15 +3187,16 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3170
3187
|
if (!colDef || typeof colDef === 'string') {
|
|
3171
3188
|
return;
|
|
3172
3189
|
}
|
|
3173
|
-
// Prevent repeated callbacks to cell focus when
|
|
3190
|
+
// Prevent repeated callbacks to cell focus when focus didn't change
|
|
3174
3191
|
const { sourceEvent } = event;
|
|
3175
3192
|
if (sourceEvent) {
|
|
3176
|
-
|
|
3193
|
+
const cell = sourceEvent.target.closest('.ag-cell');
|
|
3194
|
+
if (window.__stepaggrid_lastfocuseventtarget === cell) {
|
|
3177
3195
|
return;
|
|
3178
3196
|
}
|
|
3179
|
-
window.__stepaggrid_lastfocuseventtarget =
|
|
3197
|
+
window.__stepaggrid_lastfocuseventtarget = cell;
|
|
3180
3198
|
}
|
|
3181
|
-
paramsOnCellFocused({ colDef, data });
|
|
3199
|
+
paramsOnCellFocused?.({ colDef, data });
|
|
3182
3200
|
}, [paramsOnCellFocused]);
|
|
3183
3201
|
const onRowDragEnd = useCallback((event) => {
|
|
3184
3202
|
clearHighlightRowClasses();
|