mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
* dbeaver/dbeaver-vscode#83 refactor: data grid * chore: try to fix build scripts * chore: commit artifacts * chore: update yarn.lock * fix: adjust grid auto-sizing * chore: fix prettier * chore: add documentation about typescript crashes * fix: cell menu * fix: grid inline editor styles * fix: cell menu styles * fix: cell items alignment * fix: data sync * feat: support reactive values in grid * chore: try to fix strange build bug * chore: restore original file name * fix: add specific to inline editor styles * fix: remove delete row shortcut (not working) * chore: enable common cache
17 lines
741 B
TypeScript
17 lines
741 B
TypeScript
import { Row, type RenderRowProps } from 'react-data-grid';
|
|
import { DataGridRowContext } from './DataGridRowContext.js';
|
|
import { memo, use, useEffect } from 'react';
|
|
import { useGridReactiveValue } from './useGridReactiveValue.js';
|
|
|
|
export const BaseRow = memo(function BaseRow<TRow, TSummaryRow>(props: RenderRowProps<TRow, TSummaryRow>) {
|
|
const rowContext = use(DataGridRowContext);
|
|
const rowsCount = useGridReactiveValue(rowContext?.onScrollToBottom ? rowContext?.rowCount : undefined);
|
|
|
|
useEffect(() => {
|
|
if (rowsCount === props.rowIdx + 1) {
|
|
rowContext?.onScrollToBottom?.();
|
|
}
|
|
}, [rowsCount]);
|
|
return <Row {...props} />;
|
|
}) as <TRow, TSummaryRow>(props: RenderRowProps<TRow, TSummaryRow>) => React.ReactNode;
|