@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
111 lines (110 loc) • 3.76 kB
TypeScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import { CompositeFilterDescriptor, GroupDescriptor, SortDescriptor } from '@progress/kendo-data-query';
import { GridAICommands } from './GridAICommands.js';
import { CompositeHighlightDescriptor } from './CompositeHighlightDescriptor.js';
/**
* Represents a command structure returned by AI services for grid operations.
* Each command contains the operation type and relevant configuration data.
*
* @example
* ```tsx
* // Sort command example
* const sortCommand: GridAIAssistantCommand = {
* type: 'GridSort',
* sort: { field: 'productName', dir: 'asc' },
* message: 'Sorted by Product Name ascending'
* };
*
* // Filter command example
* const filterCommand: GridAIAssistantCommand = {
* type: 'GridFilter',
* filter: {
* logic: 'and',
* filters: [{ field: 'price', operator: 'gte', value: 100 }]
* },
* message: 'Filtered products with price >= 100'
* };
* ```
*/
export interface GridAIAssistantCommand {
/**
* The type of grid operation to perform.
* Possible values: 'GridSort', 'GridFilter', 'GridGroup', 'GridHighlight', 'GridClearSort', 'GridClearFilter', 'GridClearGroup', 'GridClearHighlight'
*/
type: GridAICommands;
/**
* The filename for export operations, including the file extension.
* Used when the AI assistant performs export commands such as PDF generation.
* Expected data type: string ending with file extension (e.g., '.pdf', '.xlsx').
*/
fileName?: string;
/**
* The sort descriptor for sorting operations.
*/
sort?: SortDescriptor | SortDescriptor[];
/**
* The filter descriptor for filtering operations.
*/
filter?: CompositeFilterDescriptor;
/**
* The group descriptor for grouping operations.
*/
group?: GroupDescriptor | GroupDescriptor[];
/**
* The highlight descriptor for highlight operations.
*/
highlight?: CompositeHighlightDescriptor;
/**
* The select descriptor for selection operations.
* Used when type is 'GridSelect' to define cell or row selection criteria.
*
* @example
* ```tsx
* select: {
* cells: { 'Age': true },
* filters: [{ field: 'Age', operator: 'gt', value: 60 }],
* logic: 'and'
* }
* ```
*/
select?: CompositeHighlightDescriptor;
/**
* The message describing the operation.
*/
message?: string;
/**
* The messages describing the operation (alternative to message).
*/
messages?: string[];
/**
* The new size value for column resize operations.
* Specifies the width dimension when resizing grid columns.
*/
size?: string;
/**
* The unique identifier of the column to resize.
* Used when type is 'GridColumnResize' to specify which column should be resized.
*/
id?: string;
/**
* The target page number for pagination operations.
* Used when type is 'GridPage' to navigate to a specific page.
*/
page?: number;
/**
* The number of items to display per page for pagination operations.
* Used when type is 'GridPageSize' to change the grid's page size.
*/
pageSize?: number;
/**
* The target position for column reordering operations.
* Used when type is 'GridColumnReorder' to specify the new column index.
*/
position?: number;
}