Skip to content

Range Copy Preview

Computes the exact range-copy values for a temporary drag target.

@param options Source range, target range, row/column types, and providers. * @returns Preview matrix and row/prop lookup, or null when no copy preview can be computed.

export function computeRangeCopyPreviewData(;

Maps a copied source matrix onto a target range using RevoGrid range-copy semantics.

@param matrix Source values ordered row-major. * @param source Source range to exclude from target writes. * @param target Target range to preview. * @param providers Plugin providers used to resolve target columns. * @param colType Column dimension type. * @returns Row/prop lookup for preview rendering.

export function mapRangeCopyMatrixToData(
matrix: unknown[][],
source: RangeArea,
target: RangeArea,
providers: Pick<PluginProviders, 'column'>,
colType: DimensionCols,
): Record<number, DataType>;

export function isInRange(row: number, col: number, range: RangeArea);

export type RangeCopyPreviewComputedData = {
matrix: unknown[][];
data: Record<number, DataType>;
};

RangeCopyPreviewComputeOptions (Extended from index.ts)

Section titled “RangeCopyPreviewComputeOptions (Extended from index.ts)”
export type RangeCopyPreviewComputeOptions = Pick<ChangedRange, 'oldRange' | 'newRange'> & {
type: DimensionRows;
colType: DimensionCols;
providers: PluginProviders;
};

The RangeCopyPreviewPlugin renders ghost values for the exact range copy that RevoGrid will apply when the user drops an autofill/range-copy drag.

Features:

  • Shows copied source values while dragging the fill handle.
  • Uses copy semantics only; it does not infer AutoFill sequences.
  • Keeps preview view-only and never writes to the data store.
  • Clears preview on drop, cancel, source changes, and plugin destruction.
import { RangeCopyPreviewPlugin } from '@revolist/revogrid-pro';
grid.plugins = [RangeCopyPreviewPlugin];
class RangeCopyPreviewPlugin {
destroy();
}