Skip to content

Core

class CorePlugin {
/**
* Observe attribute changes on the grid element
* @param attrName - The attribute name to observe (supports both kebab-case and camelCase)
* @param callback - Callback function when attribute changes
*
* Note:
* This observer tracks DOM attribute mutations only (e.g. setAttribute).
* It does not react to direct property assignments like grid.someProp = value.
*/
observeAttribute(attrName: string, callback: (value: string | null) => void);
/**
* Stop observing an attribute
* @param attrName - The attribute name to stop observing
*/
unobserveAttribute(attrName: string);
/**
* Set the trimmed state for a column
*/
setColumnTrimmed(trimmed: Record<string, Record<string, boolean | undefined>>, type: DimensionCols);
/**
* Destroy plugin and clean up all observers
*/
destroy();
}

Announces a transient popup opening within one grid. Popup owners subscribed to the same grid close unless they sent the event.

export function announcePopupOpen(
revogrid: HTMLRevoGridElement,
source: PopupOwner,
);

Subscribes a transient popup owner to other popup openings in the same grid.

export function subscribeToPopupOpen(
revogrid: HTMLRevoGridElement,
source: PopupOwner,
close: () => void,
);

export type PopupOwner = object;

Returns the first active row-source owner other than the requesting plugin.

export function findDataGridRowSourceOwner(
plugins: readonly unknown[],
requester?: unknown,
): string | undefined;

Shared runtime contract for plugins that replace the primary rgRow source.

DATA_GRID_ROW_SOURCE_OWNER: typeof DATA_GRID_ROW_SOURCE_OWNER;

interface DataGridRowSourceOwner {
readonly [DATA_GRID_ROW_SOURCE_OWNER]?: string
}

Returns whether a cell template produced visible content.

export function hasCellTemplateContent(rendered: unknown): boolean;

Render a cell template against a synthetic option row.

Object option metadata is merged into the row model, while the target prop is always set from option.value so metadata cannot shadow the selected value.

export function renderSyncedCellTemplate<T = unknown>({
createElement,
cellTemplate,
data,
option,
additionalData,
fallback = option.label,
}: RenderSyncedCellTemplateOptions<T>);

export type CellTemplateSyncOption<T = unknown> = {
value: T;
label: string;
[key: string]: unknown;
};

export type RenderSyncedCellTemplateOptions<T = unknown> = {
createElement: HyperFunc<VNode>;
cellTemplate: NonNullable<ColumnRegular['cellTemplate']>;
data: ColumnDataSchemaModel;
option: CellTemplateSyncOption<T>;
additionalData?: unknown;
fallback?: unknown;
};

Returns whether a keyboard event originated from an editable control.

export function isEditableKeyboardTarget(
event: KeyboardEvent,
revogrid: HTMLRevoGridElement,
): boolean;

Checks whether a document-level keyboard event belongs to this grid.

Core overlays listen on document, so a grid can receive a proxy beforekeydown after an input or other control outside the grid has taken focus. DOM ownership wins over stale provider focus in that case.

export function isGridKeyboardEvent(
event: KeyboardEvent,
revogrid: HTMLRevoGridElement,
providers: Pick<PluginProviders, 'selection'>,
options: GridKeyboardOwnershipOptions = {},
);

Retains one shared beforekeydown ownership guard for a Pro-enabled grid.

Core emits this cancelable proxy from each document-listening overlay. The proxy is the safe boundary to stop stale grid keyboard handling without canceling the original event’s native behavior in an outside control.

export function retainGridKeyboardOwnershipGuard(
revogrid: HTMLRevoGridElement,
providers: Pick<PluginProviders, 'selection'>,
): () => void;

export type GridKeyboardOwnershipOptions = {
/**
* Allows detached or document-targeted integrations to invoke a shortcut
* without a focused selection store. Events from an actual outside control
* are always rejected.
*/
allowDetached?: boolean;
};

Pure positioning helper shared by portalled grid popups.

export function calculateAnchoredPopoverPosition(
anchor: Pick<DOMRect, 'left' | 'right' | 'top' | 'bottom'>,
popup: Pick<DOMRect, 'width' | 'height'>,
viewport: { width: number; height: number },
gap = 4,
inset = 8,
): AnchoredPopoverPosition;

interface AnchoredPopoverPosition {
left: number;
top: number;
placementX: 'left' | 'right';
placementY: 'above' | 'below'
}

Render a RevoGrid cell template inside a Preact-owned UI.

Cell templates receive RevoGrid’s Stencil-style hyperscript function and may use class maps such as class: { badge: true, disabled: false }. Preact does not interpret that convention and would render the object as an invalid class value. This adapter converts the class map to class: 'badge' before delegating to Preact’s h, allowing existing cell templates to be reused in dropdowns, previews, and other Preact trees.

This is only a renderer compatibility bridge. It does not apply formatting or couple its consumers to the Data Grid Formatting plugin.

export function preactTemplateH(
tag: Parameters<typeof h>[0],
properties?: Record<string, unknown> | null,
...children: ComponentChildren[]
);