UNPKG

@progress/kendo-angular-grid

Version:

Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.

75 lines (74 loc) 2.18 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { HttpHeaders } from "@angular/common/http"; import { PreventableEvent } from "@progress/kendo-angular-common"; /** * @hidden */ export const DEFAULT_AI_REQUEST_OPTIONS = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }), role: 'user', method: 'POST', responseType: 'json' }; /** * @hidden */ export const convertDateStringsInFilter = (filter, columns) => { if (!filter) { return filter; } if (filter.filters && Array.isArray(filter.filters)) { return { ...filter, filters: filter.filters.map(f => convertDateStringsInFilter(f, columns)) }; } if (filter.field && filter.value !== undefined) { const column = columns.find(col => col.field === filter.field); if (column && isDateField(filter.field, columns)) { return { ...filter, value: new Date(filter.value) }; } } return filter; }; /** * @hidden */ export const isDateField = (fieldName, columns) => { const column = columns.find((col) => col.field === fieldName); return column?.filter === 'date'; }; /** * Represents the event data when the AI Assistant request completes successfully. */ export class GridToolbarAIResponseSuccessEvent extends PreventableEvent { /** * The HTTP response from the AI service. */ response; constructor(response) { super(); this.response = response; } } /** * Represents the event data when the AI Assistant request completes with an error. */ export class GridToolbarAIResponseErrorEvent extends PreventableEvent { /** * The HTTP error response from the AI service. */ error; constructor(error) { super(); this.error = error; } }