Range Selection Limit
Module Extensions
Section titled “Module Extensions”HTMLRevoGridElement (Extended from @revolist/revogrid)
Section titled “HTMLRevoGridElement (Extended from @revolist/revogrid)”interface HTMLRevoGridElement { /** * Direct range selection limit configuration. */ rangeSelectionLimit?: RangeSelectionLimitConfig}AdditionalData (Extended from @revolist/revogrid)
Section titled “AdditionalData (Extended from @revolist/revogrid)”interface AdditionalData { /** * Additional data property for range selection limiting. * @deprecated Use `grid.rangeSelectionLimit` instead. */ rangeSelectionLimit?: RangeSelectionLimitConfig}Plugin API
Section titled “Plugin API”RangeSelectionLimitPlugin
Section titled “RangeSelectionLimitPlugin”Constrains interactive range selection to a single row or column.
The plugin intercepts beforeapplyrange, normalizes the pending range, and
lets the regular RevoGrid setrange flow continue. It does not change data,
create a render layer, or block single-cell focus.
Example
Section titled “Example”import { RangeSelectionLimitPlugin } from '@revolist/revogrid-pro';
const grid = document.createElement('revo-grid');grid.range = true;grid.plugins = [RangeSelectionLimitPlugin];grid.rangeSelectionLimit = { mode: 'column' };Row-only selection
Section titled “Row-only selection”grid.rangeSelectionLimit = { mode: 'row' };Boolean shorthand
Section titled “Boolean shorthand”grid.rangeSelectionLimit = true; // same as { mode: 'column' }grid.rangeSelectionLimit = false; // disabledDependencies
Section titled “Dependencies”- Config integration
additionalData.rangeSelectionLimit: Reads legacy range selection limit configuration from additionalData.rangeSelectionLimit.
class RangeSelectionLimitPlugin { destroy();}limitRangeSelection
Section titled “limitRangeSelection”Normalizes a pending RevoGrid range to match the configured range limit mode.
column mode pins x and x1 to the focused column so the range can only
expand vertically. row mode pins y and y1 to the focused row so the
range can only expand horizontally. Disabled config returns a cloned range.
@param range Pending range emitted by beforeapplyrange.
*
@param focus Current focused cell used as the range anchor.
*
@param config Normalized range selection limit configuration.
*
@returns A range constrained to the configured mode.
*
*
Example:
* ```ts * limitRangeSelection( * { x: 0, y: 0, x1: 5, y1: 8 }, * { x: 2, y: 1 }, * { mode: 'column' }, * ); * // { x: 2, y: 0, x1: 2, y1: 8 } * ``` * *Example:
* ```ts * limitRangeSelection( * { x: 0, y: 0, x1: 5, y1: 8 }, * { x: 2, y: 1 }, * { mode: 'row' }, * ); * // { x: 0, y: 1, x1: 5, y1: 1 } * ```export function limitRangeSelection( range: RangeArea, focus: Cell | null | undefined, config: NormalizedRangeSelectionLimitConfig,): RangeArea;normalizeRangeSelectionLimitConfig
Section titled “normalizeRangeSelectionLimitConfig”Converts public rangeSelectionLimit shorthand into the internal plugin shape.
@param config Public grid or additionalData configuration.
*
@returns Normalized configuration with mode: null when disabled.
*
*
Example:
* ```ts * normalizeRangeSelectionLimitConfig(true); * // { mode: 'column' } * * normalizeRangeSelectionLimitConfig('row'); * // { mode: 'row' } * ```export function normalizeRangeSelectionLimitConfig( config?: RangeSelectionLimitConfig,): NormalizedRangeSelectionLimitConfig;RangeSelectionLimitMode
Section titled “RangeSelectionLimitMode”Built-in range selection limit modes.
Example:
* ```ts * grid.rangeSelectionLimit = 'column'; * grid.rangeSelectionLimit = 'row'; * ```/** * Built-in range selection limit modes. * * @example * ```ts * grid.rangeSelectionLimit = 'column'; * grid.rangeSelectionLimit = 'row'; * ``` */export type RangeSelectionLimitMode = 'column' | 'row';RangeSelectionLimitOptions
Section titled “RangeSelectionLimitOptions”Object form for range selection limit configuration.
Use the object form when you want a stable extension point for future options, such as validator-backed shapes.
Example:
* ```ts * grid.rangeSelectionLimit = { * mode: 'column', * }; * ```/** * Object form for range selection limit configuration. * * Use the object form when you want a stable extension point for future options, * such as validator-backed shapes. * * @example * ```ts * grid.rangeSelectionLimit = { * mode: 'column', * }; * ``` */export type RangeSelectionLimitOptions = { /** * Selection shape limit. * - `column` keeps the focused column fixed and allows row expansion. * - `row` keeps the focused row fixed and allows column expansion. */ mode: RangeSelectionLimitMode;};RangeSelectionLimitConfig
Section titled “RangeSelectionLimitConfig”Public plugin configuration for RangeSelectionLimitPlugin.
Supported shorthand:
trueenables the defaultcolumnmode.falsedisables the plugin behavior.'column'or'row'enables the matching built-in mode.
Example:
* ```ts * import { RangeSelectionLimitPlugin } from '@revolist/revogrid-pro'; * * grid.range = true; * grid.plugins = [RangeSelectionLimitPlugin]; * grid.rangeSelectionLimit = { mode: 'row' }; * ``` * *Example:
* ```ts * grid.rangeSelectionLimit = true; // same as { mode: 'column' } * grid.rangeSelectionLimit = false; // disabled * ```/** * Public plugin configuration for `RangeSelectionLimitPlugin`. * * Supported shorthand: * - `true` enables the default `column` mode. * - `false` disables the plugin behavior. * - `'column'` or `'row'` enables the matching built-in mode. * * @example * ```ts * import { RangeSelectionLimitPlugin } from '@revolist/revogrid-pro'; * * grid.range = true; * grid.plugins = [RangeSelectionLimitPlugin]; * grid.rangeSelectionLimit = { mode: 'row' }; * ``` * * @example * ```ts * grid.rangeSelectionLimit = true; // same as { mode: 'column' } * grid.rangeSelectionLimit = false; // disabled * ``` */export type RangeSelectionLimitConfig = | boolean | RangeSelectionLimitMode | RangeSelectionLimitOptions;NormalizedRangeSelectionLimitConfig
Section titled “NormalizedRangeSelectionLimitConfig”export type NormalizedRangeSelectionLimitConfig = { mode: RangeSelectionLimitMode | null;};