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