@progress/kendo-angular-grid
Version:
Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.
204 lines (203 loc) • 6.66 kB
TypeScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { HttpHeaders, HttpResponse, HttpErrorResponse } from "@angular/common/http";
import { PreventableEvent } from "@progress/kendo-angular-common";
import { AIPromptComponent, AIPromptSettings } from "@progress/kendo-angular-conversational-ui";
import { WindowComponent, WindowSettings } from "@progress/kendo-angular-dialog";
import { CompositeFilterDescriptor, FilterDescriptor, GroupDescriptor, SortDescriptor } from "@progress/kendo-data-query";
/**
* Interface representing all configuration options of the AI Assistant Window.
*/
export interface GridAIAssistantWindowSettings extends Omit<WindowSettings, 'content'> {
}
/**
* Interface representing all configuration options of the AI Assistant Prompt.
*/
export interface GridAIAssistantPromptSettings extends Omit<AIPromptSettings, 'promptCommands'> {
}
/**
* Descriptor for a Grid column sent in the AI request.
*/
export interface GridAIRequestColumnDescriptor {
/** The field name bound to the column. */
field?: string;
/** Unique identifier for the column. */
id: string;
/** Header text of group columns. */
header?: string;
/** Nested child columns for grouped or span columns. */
columns?: GridAIRequestColumnDescriptor[];
/** Optional type marker for special columns without a `field`. */
type?: 'checkbox' | 'command';
}
/**
* Represents the data sent in the AI request from the Grid Toolbar AI Assistant.
*/
export interface GridAIRequestData {
/**
* The columns of the grid, each represented by its field, id, header, and nested columns (if any).
*/
columns: Array<GridAIRequestColumnDescriptor>;
/**
* The prompt message to be sent to the AI service.
*/
promptMessage: string;
/**
* The URL of the AI service endpoint.
*/
url?: string;
/**
* The request options for the AI service, including headers, method, and other configurations.
*/
requestOptions: {
role?: string;
headers?: HttpHeaders;
method?: string;
withCredentials?: boolean;
body?: any;
responseType?: 'json' | 'arraybuffer' | 'blob' | 'text';
[key: string]: any;
};
}
/**
* @hidden
*
* Represents a composite highlight descriptor for a grid.
* It contains a map of cell identifiers to their highlight status,
* an array of filter descriptors, and the logical operator used to combine the filters.
*/
export interface CompositeHighlightDescriptor {
/**
* A map of cell identifiers to a boolean indicating whether the cell should be highlighted.
*/
cells: {
[key: string]: boolean;
};
/**
* An array of filter descriptors representing the filters applied to the grid.
*/
filters: FilterDescriptor[];
/**
* The logical operator ('and' | 'or') used to combine the filters.
*/
logic: 'and' | 'or';
}
/**
* @hidden
*
* The possible command type string values returned by the AI service.
*/
export type GridAICommandType = 'GridSort' | 'GridClearSort' | 'GridFilter' | 'GridClearFilter' | 'GridGroup' | 'GridClearGroup' | 'GridHighlight' | 'GridClearHighlight' | 'GridSelect' | 'GridClearSelect' | 'GridColumnResize' | 'GridColumnReorder' | 'GridColumnShow' | 'GridColumnHide' | 'GridColumnLock' | 'GridColumnUnlock' | 'GridPage' | 'GridPageSize' | 'GridExportExcel' | 'GridExportPDF';
/**
* @hidden
*
* AI command interface.
*/
export interface GridAICommand {
type: GridAICommandType;
message: string;
sort?: SortDescriptor;
filter?: CompositeFilterDescriptor;
group?: GroupDescriptor;
highlight?: CompositeHighlightDescriptor;
select?: CompositeHighlightDescriptor;
size?: number | string;
position?: number;
page?: number;
pageSize?: number;
fileName?: string;
id?: string;
}
/**
* @hidden
*
* Represents the response from the AI request in the Grid Toolbar AI Assistant.
* The response is an ordered array of commands that must be executed sequentially.
*/
export interface GridAIResponse {
/**
* Ordered array of commands that must be executed sequentially.
*/
commands: Array<GridAICommand>;
/**
* Optional human-readable message returned by the AI service about the overall response.
*/
message?: string;
}
/**
* Configuration options for the HTTP request.
*/
export interface GridAIRequestOptions {
/**
* HTTP headers to include with the request.
*/
headers?: HttpHeaders;
/**
* The role of the user making the request, e.g., 'user', 'assistant'.
* @default 'user'
*/
role?: string;
/**
* HTTP method to use for the request.
* @default 'POST'
*/
method?: string;
/**
* Whether to include credentials (cookies, authorization headers) with the request.
* @default false
*/
withCredentials?: boolean;
/**
* The expected response type.
* @default 'json'
*/
responseType?: 'json' | 'arraybuffer' | 'blob' | 'text';
/**
* The body of the request.
*/
body?: any;
/**
* Additional custom options that will be spread into the request configuration.
*/
[key: string]: any;
}
/**
* @hidden
*/
export declare const DEFAULT_AI_REQUEST_OPTIONS: GridAIRequestOptions;
/**
* Represents the event data when the AI Assistant request completes successfully.
*/
export declare class GridAIAssistantResponseSuccessEvent extends PreventableEvent {
/**
* The HTTP response from the AI service.
*/
response: HttpResponse<any>;
constructor(response: HttpResponse<any>);
}
/**
* Represents the event data when the AI Assistant request completes with an error.
*/
export declare class GridAIAssistantResponseErrorEvent extends PreventableEvent {
/**
* The HTTP error response from the AI service.
*/
error: HttpErrorResponse;
constructor(error: HttpErrorResponse);
}
/**
* Represents the event data when the AI Assistant request is initiated.
*/
export interface GridAIAssistantRequestEvent {
requestData: GridAIRequestData;
isRetry: boolean;
}
/**
* Represents the event data when the AI Assistant window is opened.
*/
export interface GridAIAssistantOpenEvent {
aiWindow: WindowComponent;
aiPrompt: AIPromptComponent;
}