Skip to content

Data Grid Context Menu

HTMLRevoGridElement (Extended from global)

Section titled “HTMLRevoGridElement (Extended from global)”
interface HTMLRevoGridElement {
dataGridContextMenu?: false | DataGridContextMenuConfig;
'data-grid-context-menu'?: false | DataGridContextMenuConfig
}

HTMLRevoGridElementEventMap (Extended from global)

Section titled “HTMLRevoGridElementEventMap (Extended from global)”
interface HTMLRevoGridElementEventMap {
[DATA_GRID_CONTEXT_MENU_COMMAND_EVENT]: DataGridContextMenuCommandDetail;
[DATA_GRID_CONTEXT_MENU_ERROR_EVENT]: DataGridContextMenuErrorDetail
}

AdditionalData (Extended from @revolist/revogrid)

Section titled “AdditionalData (Extended from @revolist/revogrid)”
interface AdditionalData {
/** Legacy configuration path. Prefer `grid.dataGridContextMenu`. */
dataGridContextMenu?: false | DataGridContextMenuConfig
}
DATA_GRID_CONTEXT_MENU_SURFACE_ITEM_IDS: { readonly cell: readonly DataGridContextMenuItemId[]; readonly rowHeader: readonly DataGridContextMenuItemId[]; readonly rowGroup: readonly DataGridContextMenuItemId[]; readonly columnHeader: readonly DataGridContextMenuItemId[]; readonly columnGroupHeader: readonly DataGridContextMenuItemId[]; };

Task-oriented context-menu defaults for cells, rows, row groups, columns, and column groups. The preset is opt-in: add this plugin to grid.plugins. It composes before application and other plugin menu contributions.

  • Auto-installed ContextMenuPlugin: Uses ContextMenuPlugin for popup composition and interaction.
  • Auto-installed ColumnDialogPlugin: Uses ColumnDialogPlugin and its ColumnHidePlugin dependency for column management.
  • Auto-installed DataGridFormattingPlugin: Uses DataGridFormattingPlugin for spreadsheet-style formatting.
  • Auto-installed DataGridCellInspectorPlugin: Uses DataGridCellInspectorPlugin for read-only cell and column inspection.
  • Config integration grid.dataGridContextMenu, additionalData.dataGridContextMenu: Reads the direct dataGridContextMenu property and legacy additionalData fallback.
class DataGridContextMenuPlugin {
/** Resolve the semantic context and current configured items without opening a popup. */
getItems(menu: ContextMenuOpenContext);
/** Resolve the task-oriented semantic surface for a low-level menu context. */
getContext(menu: ContextMenuOpenContext): DataGridContextMenuContext<T>;
destroy(): void;
}

export type DataGridContextMenuSurface =
| 'cell'
| 'rowHeader'
| 'rowGroup'
| 'columnHeader'
| 'columnGroupHeader';

export type DataGridContextMenuItemId =
| 'menu.copy'
| 'menu.rows'
| 'menu.filter'
| 'menu.export'
| 'menu.sort'
| 'menu.grouping'
| 'menu.pin'
| 'menu.move'
| 'menu.size'
| 'menu.schema'
| 'menu.format'
| 'cell.edit'
| 'cell.inspect'
| 'cell.clear'
| 'clipboard.cut'
| 'clipboard.copy'
| 'clipboard.copyCell'
| 'clipboard.copyWithHeaders'
| 'clipboard.paste'
| 'row.copy'
| 'row.copyWithHeaders'
| 'row.clear'
| 'row.insertAbove'
| 'row.insertBelow'
| 'row.duplicate'
| 'row.delete'
| 'row.pinTop'
| 'row.pinBottom'
| 'row.unpin'
| 'rowGroup.toggle'
| 'rowGroup.expandAll'
| 'rowGroup.collapseAll'
| 'rowGroup.selectDescendants'
| 'rowGroup.copy'
| 'rowGroup.copyWithHeaders'
| 'rowGroup.exportCsv'
| 'rowGroup.removeField'
| 'rowGroup.clearGrouping'
| 'filter.keepOnly'
| 'filter.exclude'
| 'filter.open'
| 'filter.clear'
| 'column.copy'
| 'column.copyWithHeader'
| 'column.inspect'
| 'column.sortAscending'
| 'column.sortDescending'
| 'column.clearSort'
| 'column.filterOpen'
| 'column.filterClear'
| 'column.groupBy'
| 'column.ungroup'
| 'column.pinLeft'
| 'column.pinRight'
| 'column.unpin'
| 'column.moveLeft'
| 'column.moveRight'
| 'column.moveStart'
| 'column.moveEnd'
| 'column.autoSize'
| 'column.autoSizeAll'
| 'column.resetWidth'
| 'column.hide'
| 'column.manage'
| 'column.insertLeft'
| 'column.insertRight'
| 'column.duplicate'
| 'column.delete'
| 'column.exportCsv'
| 'columnGroup.toggle'
| 'columnGroup.autoSize'
| 'columnGroup.hide'
| 'format.automatic'
| 'format.number'
| 'format.currency'
| 'format.accounting'
| 'format.percent'
| 'format.scientific'
| 'format.date'
| 'format.datetime'
| 'format.time'
| 'format.more'
| 'format.clear'
| 'export.selectionCsv'
| 'export.rowsCsv'
| 'export.allCsv'
| 'export.allExcel';

Stable ids for actionable built-in leaves. Submenu containers never execute.

/** Stable ids for actionable built-in leaves. Submenu containers never execute. */
export type DataGridContextMenuCommandId = Exclude<
DataGridContextMenuItemId,
`menu.${string}`
>;

interface DataGridContextMenuRow {
readonly type: DimensionRows;
/** Visible viewport index. Undefined when a selected source row is filtered or collapsed. */
readonly virtualIndex?: number;
readonly physicalIndex: number;
/** Index in the authored source before grouping rows were projected. */
readonly sourceIndex: number;
readonly model: T
}

interface DataGridContextMenuContext {
readonly surface: DataGridContextMenuSurface;
readonly menu: ContextMenuOpenContext;
readonly rows: readonly DataGridContextMenuRow<T>[];
readonly range?: RangeArea;
readonly rowType?: DimensionRows;
readonly columnType?: DimensionCols;
/** Invocation-time index in the resolved column store before visibility projection. */
readonly columnPhysicalIndex?: number;
/** Invocation-time rendered width from the active column dimension. */
readonly columnSize?: number;
readonly column?: ColumnRegular;
readonly columns: readonly ColumnRegular[];
readonly columnGroup?: ContextMenuColumnGroup;
/** Grid-level readonly state. Per-cell readonly is resolved from column schema. */
readonly readonly: boolean
}

export type DataGridContextMenuStateResolver<T extends DataType = DataType> =
| boolean
| ((context: DataGridContextMenuContext<T>) => boolean);

export type DataGridContextMenuItemsFactory<T extends DataType = DataType> = (
context: DataGridContextMenuContext<T>,
) => readonly ContextMenuItem[];

export type DataGridContextMenuItemsResolver<T extends DataType = DataType> = (
context: DataGridContextMenuContext<T>,
defaultItems: readonly ContextMenuItem[],
) => readonly ContextMenuItem[];

export type DataGridContextMenuCommandHandler<T extends DataType = DataType> = (
context: DataGridContextMenuContext<T>,
) => void | Promise<void>;

export type DataGridCreateRowAction =
| 'insertAbove'
| 'insertBelow'
| 'duplicate';

interface DataGridCreateRowContext {
readonly action: DataGridCreateRowAction;
readonly sourceRow?: T;
readonly context: DataGridContextMenuContext<T>
}

export type DataGridColumnSchemaAction =
| 'insertLeft'
| 'insertRight'
| 'duplicate';

interface DataGridColumnSchemaContext {
readonly action: DataGridColumnSchemaAction;
readonly sourceColumn: ColumnRegular;
readonly context: DataGridContextMenuContext<T>
}

interface DataGridColumnSchemaConfig {
/** Must return a column with an application-owned, unique `prop`. */
createColumn(
context: DataGridColumnSchemaContext<T>,
): ColumnRegular | null | undefined
}

interface DataGridContextMenuLocaleText {
readonly ariaLabel: string;
readonly unavailable: string;
readonly labels: Record<DataGridContextMenuItemId, string>;
readonly states: {
readonly rowGroupExpand: string;
readonly rowGroupCollapse: string;
readonly rowGroupDeselectDescendants: string;
readonly columnGroupExpand: string;
readonly columnGroupCollapse: string;
}
}

interface DataGridContextMenuConfig {
/** Enable or disable complete semantic surfaces. */
readonly areas?: Partial<Record<DataGridContextMenuSurface, boolean>>;
/** Keep application-provided row/column context-menu items. Defaults to true. */
readonly includeHostItems?: boolean;
/** Hide individual generated items by stable id. */
readonly hiddenItems?: Partial<Record<
DataGridContextMenuItemId,
DataGridContextMenuStateResolver<T>
>>;
/** Disable individual generated items by stable id. */
readonly disabledItems?: Partial<Record<
DataGridContextMenuItemId,
DataGridContextMenuStateResolver<T>
>>;
/** Extra items appended after the resolved generated defaults. */
readonly items?: readonly ContextMenuItem[] | DataGridContextMenuItemsFactory<T>;
/** Replace or transform the generated defaults for the current surface. */
readonly getItems?: DataGridContextMenuItemsResolver<T>;
/** Label and accessible-name overrides. */
readonly localeText?: Partial<Omit<DataGridContextMenuLocaleText, 'labels' | 'states'>> & {
readonly labels?: Partial<Record<DataGridContextMenuItemId, string>>;
readonly states?: Partial<DataGridContextMenuLocaleText['states']>;
};
/** Defaults to hiding capability-dependent items. */
readonly unavailableItems?: 'hide' | 'disable';
/** Replace the default implementation for individual built-in commands. */
readonly commandHandlers?: Partial<Record<
DataGridContextMenuCommandId,
DataGridContextMenuCommandHandler<T>
>>;
/** Creates authored rows for insertion and duplication. */
readonly createRow?: (context: DataGridCreateRowContext<T>) => T;
/** Enables local row pin/unpin commands. Defaults to false. */
readonly rowPinning?: boolean;
/** Enables application-owned column schema commands. Defaults to false. */
readonly columnSchema?: false | DataGridColumnSchemaConfig<T>;
/** Spreadsheet-style cell and column formatting. Set to false to hide it. */
readonly formatting?: false | DataGridFormattingConfig<T>;
/** Read-only cell and column inspection. Full row and column data are opt-in. */
readonly inspection?: false | DataGridCellInspectorConfig<T>
}

export type DataGridContextMenuColumnProp = ColumnProp;

interface DataGridContextMenuCommandDetail {
readonly id: DataGridContextMenuCommandId;
readonly context: DataGridContextMenuContext<T>
}

DataGridContextMenuErrorDetail (Extended from index.ts)

Section titled “DataGridContextMenuErrorDetail (Extended from index.ts)”
interface DataGridContextMenuErrorDetail {
readonly error: unknown
}

DATA_GRID_CONTEXT_MENU_COMMAND_EVENT: string;

DATA_GRID_CONTEXT_MENU_ERROR_EVENT: string;

export function ownsDataGridProjectedRows(
plugin: unknown,
): plugin is DataGridContextMenuExternalRowOwner;

Cross-package marker for plugins that own a projected row lifecycle.

The universal menu may still contribute copy, export, and view commands, but local cell/row mutations require an application command handler while a marked owner is active.

DATA_GRID_CONTEXT_MENU_EXTERNAL_ROW_OWNER: typeof DATA_GRID_CONTEXT_MENU_EXTERNAL_ROW_OWNER;

interface DataGridContextMenuExternalRowOwner {
readonly [DATA_GRID_CONTEXT_MENU_EXTERNAL_ROW_OWNER]: true
}

export function createDataGridContextMenuLocale(
config?: DataGridContextMenuConfig['localeText'],
): DataGridContextMenuLocaleText;

DATA_GRID_CONTEXT_MENU_LOCALE: {
ariaLabel: string;
unavailable: string;
labels: { 'menu.copy': string; 'menu.rows': string; 'menu.filter': string; 'menu.export': string; 'menu.sort': string; 'menu.grouping': string; 'menu.pin': string; 'menu.move': string; 'menu.size': string; 'menu.schema': string; 'menu.format': string; 'cell.edit': string; 'cell.inspect': string; 'cell.clear': string; 'clipboard.cut': string; 'clipboard.copy': string; 'clipboard.copyCell': string; 'clipboard.copyWithHeaders': string; 'clipboard.paste': string; 'row.copy': string; 'row.copyWithHeaders': string; 'row.clear': string; 'row.insertAbove': string; 'row.insertBelow': string; 'row.duplicate': string; 'row.delete': string; 'row.pinTop': string; 'row.pinBottom': string; 'row.unpin': string; 'rowGroup.toggle': string; 'rowGroup.expandAll': string; 'rowGroup.collapseAll': string; 'rowGroup.selectDescendants': string; 'rowGroup.copy': string; 'rowGroup.copyWithHeaders': string; 'rowGroup.exportCsv': string; 'rowGroup.removeField': string; 'rowGroup.clearGrouping': string; 'filter.keepOnly': string; 'filter.exclude': string; 'filter.open': string; 'filter.clear': string; 'column.copy': string; 'column.copyWithHeader': string; 'column.inspect': string; 'column.sortAscending': string; 'column.sortDescending': string; 'column.clearSort': string; 'column.filterOpen': string; 'column.filterClear': string; 'column.groupBy': string; 'column.ungroup': string; 'column.pinLeft': string; 'column.pinRight': string; 'column.unpin': string; 'column.moveLeft': string; 'column.moveRight': string; 'column.moveStart': string; 'column.moveEnd': string; 'column.autoSize': string; 'column.autoSizeAll': string; 'column.resetWidth': string; 'column.hide': string; 'column.manage': string; 'column.insertLeft': string; 'column.insertRight': string; 'column.duplicate': string; 'column.delete': string; 'column.exportCsv': string; 'columnGroup.toggle': string; 'columnGroup.autoSize': string; 'columnGroup.hide': string; 'format.automatic': string; 'format.number': string; 'format.currency': string; 'format.accounting': string; 'format.percent': string; 'format.scientific': string; 'format.date': string; 'format.datetime': string; 'format.time': string; 'format.more': string; 'format.clear': string; 'export.selectionCsv': string; 'export.rowsCsv': string; 'export.allCsv': string; 'export.allExcel': string; };
states: { rowGroupExpand: string; rowGroupCollapse: string; rowGroupDeselectDescendants: string; columnGroupExpand: string; columnGroupCollapse: string; };
};

Compose independently resolved surface, selection, row, and column targets.

export function resolveDataGridContextMenuContext(
menu: ContextMenuOpenContext,
): DataGridContextMenuContext;

export function isDataGridContextMenuGroupExpanded(
context: DataGridContextMenuContext,
): boolean;

export function getVisibleColumns(providers: PluginProviders): ColumnRegular[];

export function resolveDataGridContextMenuSurface(
menu: ContextMenuOpenContext,
): DataGridContextMenuSurface;

Owns the command lifecycle only. Individual command behavior and capability checks live in the focused modules under commands/.

class DataGridContextMenuCommands {
isAvailable(
id: DataGridContextMenuCommandId,
context: DataGridContextMenuContext<T>,
): boolean;
getAvailability(
id: DataGridContextMenuCommandId,
context: DataGridContextMenuContext<T>,
): DataGridContextMenuCommandAvailability;
isColumnGroupCollapsed(context: DataGridContextMenuContext<T>): boolean;
areRowGroupDescendantsSelected(context: DataGridContextMenuContext<T>): boolean;
async execute(
id: DataGridContextMenuCommandId,
context: DataGridContextMenuContext<T>,
): Promise<void>;
}

Apply configuration around the generated items for one semantic surface.

export function buildDataGridContextMenuItems<T extends DataType = DataType>(
context: DataGridContextMenuContext<T>,
config: DataGridContextMenuConfig<T>,
commands: DataGridContextMenuCommands<T>,
): ContextMenuItem[];

export function createCellCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function serializeTsv(
matrix: readonly (readonly DataFormat[])[],
): string;

export function parseTsv(value: string): string[][];

export function parseHtmlTable(value: string): string[][] | null;

export function canWriteClipboard(): boolean;

export function canReadClipboard(): boolean;

export async function writeClipboardTransfer(
transfer: DataTransfer,
fallbackText: string,
): Promise<void>;

export async function readClipboardTransfer(): Promise<DataTransfer>;

export function createClipboardEvent(transfer: DataTransfer): ClipboardEvent;

export function createClipboardCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function createColumnGroupCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function isColumnGroupCollapsed<T extends DataType>(
context: DataGridContextMenuContext<T>,
runtime: DataGridContextMenuCommandRuntime<T>,
): boolean;

export function createColumnPositionCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function createColumnSchemaCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function createColumnSizingCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function createColumnStateCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function cloneColumnTree(
columns: readonly AuthoredColumn[],
): AuthoredColumn[];

export function flattenColumnTree(
columns: readonly AuthoredColumn[],
): ColumnRegular[];

export function findColumn(
columns: AuthoredColumn[],
prop: ColumnProp,
): FoundColumn | undefined;

export function removeColumn(
columns: AuthoredColumn[],
prop: ColumnProp,
): boolean;

export type AuthoredColumn = ColumnGrouping | ColumnRegular;

interface FoundColumn {
parent: AuthoredColumn[];
index: number;
column: ColumnRegular
}

export function createColumnVisibilityCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

The only place where independent built-in command domains are composed.

export function createCommandRegistry<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

interface VisibleColumnLocation {
type: DimensionCols;
index: number;
physicalIndex: number
}

Shared access to grid-owned state used by independent command domains.

class DataGridContextMenuCommandRuntime {
getPlugin<C>(plugin: new (...args: any[]) => C): C | undefined;
hasHandler(id: DataGridContextMenuCommandId): boolean;
hasRemoteRows(): boolean;
actionContext(context: DataGridContextMenuContext<T>): ContextMenuActionContext;
sourceFor(type: DimensionRows): T[];
visibleSourceFor(type: DimensionRows): T[];
projectedSourceFor(type: DimensionRows): T[];
setSource(type: DimensionRows, source: T[]): void;
/** Resolve a projected/grouped target back to the application-authored row. */
authoredRow(row: DataGridContextMenuRow<T>): T | undefined;
authoredColumns(): AuthoredColumn[];
setColumns(columns: AuthoredColumn[]): void;
allVisibleColumns(): ColumnRegular[];
findVisibleColumn(prop: ColumnProp): VisibleColumnLocation | undefined;
removeCustomSizes(
type: DimensionRows | DimensionCols,
indexes: readonly number[],
): void;
hasCustomSize(type: DimensionRows | DimensionCols, index: number): boolean;
}

export function mergeCommandDefinitions<T extends DataType>(
...groups: DataGridContextMenuCommandDefinitions<T>[]
): DataGridContextMenuCommandDefinitions<T>;

export type DataGridContextMenuCommandAvailability =
| 'available'
| 'disabled'
| 'hidden'
| 'unavailable';

interface DataGridContextMenuCommandDefinition {
isAvailable(
context: DataGridContextMenuContext<T>,
runtime: DataGridContextMenuCommandRuntime<T>,
): boolean;
getState?(
context: DataGridContextMenuContext<T>,
runtime: DataGridContextMenuCommandRuntime<T>,
): Exclude<DataGridContextMenuCommandAvailability, 'unavailable'>;
execute(
context: DataGridContextMenuContext<T>,
runtime: DataGridContextMenuCommandRuntime<T>,
): void | Promise<void>
}

export type DataGridContextMenuCommandDefinitions<T extends DataType = DataType> =
Partial<Record<DataGridContextMenuCommandId, DataGridContextMenuCommandDefinition<T>>>;

export function createCellMatrix<T extends DataType>(
runtime: DataGridContextMenuCommandRuntime<T>,
context: DataGridContextMenuContext<T>,
headers: boolean,
): DataFormat[][];

export function createRowMatrix<T extends DataType>(
runtime: DataGridContextMenuCommandRuntime<T>,
context: DataGridContextMenuContext<T>,
headers: boolean,
): DataFormat[][];

export function createColumnMatrix<T extends DataType>(
runtime: DataGridContextMenuCommandRuntime<T>,
context: DataGridContextMenuContext<T>,
headers: boolean,
): DataFormat[][];

export function clearContext<T extends DataType>(
runtime: DataGridContextMenuCommandRuntime<T>,
context: DataGridContextMenuContext<T>,
): void;

Clear full visible rows while retaining the row span resolved from selection.

export function clearRows<T extends DataType>(
runtime: DataGridContextMenuCommandRuntime<T>,
context: DataGridContextMenuContext<T>,
): void;

export function applyPasteMatrix<T extends DataType>(
runtime: DataGridContextMenuCommandRuntime<T>,
context: DataGridContextMenuContext<T>,
matrix: DataFormat[][],
): void;

export function dispatchRangeEdit(
revogrid: HTMLRevoGridElement,
detail: BeforeRangeSaveDataDetails,
): void;

export function createExportCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function createFilterCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

Resolve spreadsheet selection semantics independently from command dispatch.

export function resolveFormattingTarget<T extends DataType>(
context: DataGridContextMenuContext<T>,
runtime: DataGridContextMenuCommandRuntime<T>,
): ResolvedFormattingTarget<T> | undefined;

export function getFormattingConfig<T extends DataType>(
runtime: DataGridContextMenuCommandRuntime<T>,
): DataGridFormattingConfig<T> | undefined;

interface ResolvedFormattingTarget {
readonly selection: DataGridFormattingSelection<T>;
readonly valueKind: DataGridFormattingValueKind;
readonly canFormatValue: boolean
}

export function createFormattingCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function createInspectionCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

Evaluate the invoked cell with the same schema contract used by core editing.

export function isInvokedCellReadOnly<T extends DataType>(
context: DataGridContextMenuContext<T>,
runtime: DataGridContextMenuCommandRuntime<T>,
): boolean;

True when at least one resolved cell target can accept an edit.

export function hasWritableContextCell<T extends DataType>(
context: DataGridContextMenuContext<T>,
runtime: DataGridContextMenuCommandRuntime<T>,
): boolean;

export function isGridReadOnly<T extends DataType>(
context: DataGridContextMenuContext<T>,
runtime: DataGridContextMenuCommandRuntime<T>,
): boolean;

export function isResolvedCellReadOnly<T extends DataType>(
row: DataGridContextMenuRow<T>,
column: ColumnRegular,
runtime: DataGridContextMenuCommandRuntime<T>,
): boolean;

export function createRowGroupCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function areAllRowGroupDescendantsSelected<T extends DataType>(
context: DataGridContextMenuContext<T>,
runtime: DataGridContextMenuCommandRuntime<T>,
): boolean;

export function createRowLayoutCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function createRowMutationCommands<T extends DataType>(): DataGridContextMenuCommandDefinitions<T>;

export function resolveDataGridContextMenuColumns(
menu: ContextMenuOpenContext,
surface: DataGridContextMenuSurface,
columnType?: DimensionCols,
range?: RangeArea,
): ColumnRegular[];

export function resolveColumnPhysicalIndex(
menu: ContextMenuOpenContext,
columnType?: DimensionCols,
): number | undefined;

export function resolveColumnSize(
menu: ContextMenuOpenContext,
columnType?: DimensionCols,
): number | undefined;

export function resolveDataGridContextMenuRows(
menu: Extract<ContextMenuOpenContext, { target: 'row' }>,
surface: DataGridContextMenuSurface,
rowType: DimensionRows,
range?: RangeArea,
): DataGridContextMenuRow[];

export function resolveInvokedSelectionRange(
menu: Extract<ContextMenuOpenContext, { target: 'row' }>,
columnType?: DimensionCols,
): RangeArea | undefined;

export function normalizeDataColumnType(
type: unknown,
): DimensionCols | undefined;

CELL_CLIPBOARD_ICONS: {
'cell.edit': string;
'cell.inspect': string;
'cell.clear': string;
'clipboard.cut': string;
'clipboard.copy': string;
'clipboard.copyCell': string;
'clipboard.copyWithHeaders': string;
'clipboard.paste': string;
};

export function getColumnGroupToggleIcon(
state: DataGridContextMenuIconState,
): string;

COLUMN_GROUP_ICONS: {
'columnGroup.autoSize': string;
'columnGroup.hide': string;
};

COLUMN_ICONS: {
'column.copy': string;
'column.copyWithHeader': string;
'column.inspect': string;
'column.sortAscending': string;
'column.sortDescending': string;
'column.clearSort': string;
'column.groupBy': string;
'column.ungroup': string;
'column.pinLeft': string;
'column.pinRight': string;
'column.unpin': string;
'column.moveLeft': string;
'column.moveRight': string;
'column.moveStart': string;
'column.moveEnd': string;
'column.autoSize': string;
'column.autoSizeAll': string;
'column.resetWidth': string;
'column.hide': string;
'column.manage': string;
'column.insertLeft': string;
'column.insertRight': string;
'column.duplicate': string;
'column.delete': string;
};

EXPORT_ICONS: {
'column.exportCsv': string;
'export.selectionCsv': string;
'export.rowsCsv': string;
'export.allCsv': string;
'export.allExcel': string;
};

FILTER_ICONS: {
'filter.keepOnly': string;
'filter.exclude': string;
'filter.open': string;
'filter.clear': string;
'column.filterOpen': string;
'column.filterClear': string;
};

FORMATTING_ICONS: {
'menu.format': string;
'format.automatic': string;
'format.number': string;
'format.currency': string;
'format.accounting': string;
'format.percent': string;
'format.scientific': string;
'format.date': string;
'format.datetime': string;
'format.time': string;
'format.more': string;
'format.clear': string;
};

export function resolveDataGridContextMenuIcon(
id: DataGridContextMenuItemId,
state: DataGridContextMenuIconState,
): string | undefined;

export type DataGridContextMenuIconMap = Partial<Record<
DataGridContextMenuItemId,
string
>>;

interface DataGridContextMenuIconState {
readonly rowGroupExpanded: boolean;
readonly columnGroupCollapsed: boolean
}

MENU_ICONS: {
'menu.copy': string;
'menu.rows': string;
'menu.filter': string;
'menu.export': string;
'menu.sort': string;
'menu.grouping': string;
'menu.pin': string;
'menu.move': string;
'menu.size': string;
'menu.schema': string;
};

export function getRowGroupToggleIcon(
state: DataGridContextMenuIconState,
): string;

ROW_GROUP_ICONS: {
'rowGroup.expandAll': string;
'rowGroup.collapseAll': string;
'rowGroup.selectDescendants': string;
'rowGroup.copy': string;
'rowGroup.copyWithHeaders': string;
'rowGroup.exportCsv': string;
'rowGroup.removeField': string;
'rowGroup.clearGrouping': string;
};

ROW_ICONS: {
'row.copy': string;
'row.copyWithHeaders': string;
'row.clear': string;
'row.insertAbove': string;
'row.insertBelow': string;
'row.duplicate': string;
'row.delete': string;
'row.pinTop': string;
'row.pinBottom': string;
'row.unpin': string;
};

export function buildMenuItem<T extends DataType>(
spec: DataGridMenuItemSpec,
context: DataGridContextMenuContext<T>,
config: DataGridContextMenuConfig<T>,
commands: DataGridContextMenuCommands<T>,
locale: DataGridContextMenuLocaleText,
iconState: DataGridContextMenuIconState,
): ContextMenuItem[];

Flattens named task sections into menu specs separated by the shared Context Menu divider primitive. Runtime normalization removes dividers around hidden or unavailable sections.

export function createMenuSections(
sections: readonly DataGridMenuSection[],
): DataGridMenuItemSpec[];

export type DataGridMenuSection = {
/** Semantic section name used only to identify its internal divider. */
readonly id: string;
readonly items: readonly DataGridMenuItemSpec[];
};

export function isMenuSeparatorSpec(
spec: DataGridMenuItemSpec,
): spec is DataGridMenuSeparatorSpec;

export function collectMenuItemIds(
specs: readonly DataGridMenuItemSpec[],
): readonly DataGridContextMenuItemId[];

export type DataGridMenuCommandSpec = {
id: DataGridContextMenuItemId;
children: readonly DataGridMenuItemSpec[];
};

export type DataGridMenuSeparatorSpec = {
kind: 'separator';
id: string;
};

export type DataGridMenuItemSpec =
| DataGridContextMenuItemId
| DataGridMenuCommandSpec
| DataGridMenuSeparatorSpec;

export function getSurfaceItemSpecs(
surface: DataGridContextMenuSurface,
): readonly DataGridMenuItemSpec[];

CELL_CLIPBOARD_ITEMS: DataGridMenuItemSpec[];

COLUMN_CLIPBOARD_ITEMS: DataGridMenuItemSpec[];

COLUMN_SORT_ITEMS: DataGridMenuItemSpec[];

COLUMN_GROUPING_ITEMS: DataGridMenuItemSpec[];

COLUMN_PIN_ITEMS: DataGridMenuItemSpec[];

COLUMN_MOVE_ITEMS: DataGridMenuItemSpec[];

COLUMN_SIZE_ITEMS: DataGridMenuItemSpec[];

COLUMN_SCHEMA_ITEMS: DataGridMenuItemSpec[];

CELL_EXPORT_ITEMS: DataGridMenuItemSpec[];

ROW_HEADER_EXPORT_ITEMS: DataGridMenuItemSpec[];

COLUMN_EXPORT_ITEMS: DataGridMenuItemSpec[];

CELL_FILTER_ITEMS: DataGridMenuItemSpec[];

COLUMN_FILTER_ITEMS: DataGridMenuItemSpec[];

FORMAT_CONTEXT_MENU_ITEMS: DataGridMenuItemSpec[];

CELL_ROW_ITEMS: DataGridMenuItemSpec[];

ROW_HEADER_ROW_ITEMS: DataGridMenuItemSpec[];

ROW_PIN_ITEMS: DataGridMenuItemSpec[];

CELL_CONTEXT_MENU_ITEMS: DataGridMenuItemSpec[];

COLUMN_GROUP_HEADER_CONTEXT_MENU_ITEMS: DataGridMenuItemSpec[];

COLUMN_HEADER_CONTEXT_MENU_ITEMS: DataGridMenuItemSpec[];

ROW_GROUP_CONTEXT_MENU_ITEMS: DataGridMenuItemSpec[];

ROW_HEADER_CONTEXT_MENU_ITEMS: DataGridMenuItemSpec[];