@progress/kendo-react-grid 11.3.1 → 11.4.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.mts CHANGED
@@ -5,6 +5,10 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
+ import { AIPromptCardInterface } from '@progress/kendo-react-conversational-ui';
9
+ import { AIPromptOutputInterface } from '@progress/kendo-react-conversational-ui';
10
+ import { AxiosRequestConfig } from 'axios';
11
+ import { AxiosResponse } from 'axios';
8
12
  import { BaseEvent } from '@progress/kendo-react-common';
9
13
  import { ButtonProps } from '@progress/kendo-react-buttons';
10
14
  import { CellProps } from '@progress/kendo-react-data-tools';
@@ -13,6 +17,7 @@ import { ColumnBaseProps } from '@progress/kendo-react-data-tools';
13
17
  import { ColumnSortSettings } from '@progress/kendo-react-data-tools';
14
18
  import { ComponentType } from 'react';
15
19
  import { CompositeFilterDescriptor } from '@progress/kendo-data-query';
20
+ import { CustomComponent } from '@progress/kendo-react-common';
16
21
  import { DataResult } from '@progress/kendo-data-query';
17
22
  import { DetailExpandDescriptor } from '@progress/kendo-react-data-tools';
18
23
  import { DialogProps } from '@progress/kendo-react-dialogs';
@@ -20,6 +25,7 @@ import { DragClue } from '@progress/kendo-react-data-tools';
20
25
  import { DropClue } from '@progress/kendo-react-data-tools';
21
26
  import { EditDescriptor } from '@progress/kendo-react-data-tools';
22
27
  import { FieldProps } from '@progress/kendo-react-form';
28
+ import { FilterDescriptor } from '@progress/kendo-data-query';
23
29
  import { FilterOperator } from '@progress/kendo-react-data-tools';
24
30
  import { getSelectedState } from '@progress/kendo-react-data-tools';
25
31
  import { getSelectedStateFromKeyDown } from '@progress/kendo-react-data-tools';
@@ -39,8 +45,10 @@ import { MenuSelectEvent } from '@progress/kendo-react-layout';
39
45
  import { NavigatableSettings } from '@progress/kendo-react-data-tools';
40
46
  import { NormalizedDragEvent } from '@progress/kendo-react-common';
41
47
  import { Offset } from '@progress/kendo-react-popup';
48
+ import { outputViewDefaults } from '@progress/kendo-react-conversational-ui';
42
49
  import { PagerProps } from '@progress/kendo-react-data-tools';
43
50
  import { PagerTargetEvent } from '@progress/kendo-react-data-tools';
51
+ import { promptViewDefaults } from '@progress/kendo-react-conversational-ui';
44
52
  import * as React_2 from 'react';
45
53
  import { ReactElement } from 'react';
46
54
  import { SearchField } from '@progress/kendo-react-data-tools';
@@ -59,6 +67,7 @@ import { TableKeyDownEvent } from '@progress/kendo-react-data-tools';
59
67
  import { TableSelectableMode } from '@progress/kendo-react-data-tools';
60
68
  import { TableSelectableSettings } from '@progress/kendo-react-data-tools';
61
69
  import { TableSelectionChangeEvent } from '@progress/kendo-react-data-tools';
70
+ import { TextAreaProps } from '@progress/kendo-react-inputs';
62
71
  import { TextBoxChangeEvent } from '@progress/kendo-react-inputs';
63
72
  import { TextBoxProps } from '@progress/kendo-react-inputs';
64
73
  import { ToolbarProps } from '@progress/kendo-react-buttons';
@@ -91,6 +100,28 @@ export declare const cellInputChange: (value: any, e: React_2.SyntheticEvent<any
91
100
  */
92
101
  export declare const cellOperatorChange: (event: any, currentValue: any, onChange: Function) => void;
93
102
 
103
+ /**
104
+ * Represents a composite highlight descriptor for a grid.
105
+ * It contains a map of cell identifiers to their highlight status,
106
+ * an array of filter descriptors, and the logical operator used to combine the filters.
107
+ */
108
+ export declare interface CompositeHighlightDescriptor {
109
+ /**
110
+ * A map of cell identifiers to a boolean indicating whether the cell should be highlighted.
111
+ */
112
+ cells: {
113
+ [key: string]: boolean;
114
+ };
115
+ /**
116
+ * An array of filter descriptors representing the filters applied to the grid.
117
+ */
118
+ filters: FilterDescriptor[];
119
+ /**
120
+ * The logical operator ('and' | 'or') used to combine the filters.
121
+ */
122
+ logic: 'and' | 'or';
123
+ }
124
+
94
125
  /**
95
126
  * @hidden
96
127
  */
@@ -313,6 +344,139 @@ export declare const GRID_PREVENT_SELECTION_ELEMENT = "data-prevent-selection";
313
344
  /** The attribute required by the Grid selection on Grid `tr` elements. */
314
345
  export declare const GRID_ROW_INDEX_ATTRIBUTE = "data-grid-row-index";
315
346
 
347
+ export declare const GridAIPrompt: (props: GridAIPromptProps) => JSX.Element;
348
+
349
+ /**
350
+ * Props for the `GridAIPrompt` component, which provides AI-powered prompt and output functionality in a grid toolbar.
351
+ *
352
+ * @example
353
+ * ```tsx
354
+ * <GridAIPrompt
355
+ * promptValue="Summarize this data"
356
+ * outputs={[{ text: "Summary...", ... }]}
357
+ * streaming={true}
358
+ * onPromptRequest={handlePrompt}
359
+ * suggestionsList={["Summarize", "Explain", "Generate chart"]}
360
+ * />
361
+ * ```
362
+ */
363
+ export declare interface GridAIPromptProps {
364
+ /**
365
+ * List of AI-generated outputs to display.
366
+ *
367
+ * @example
368
+ * outputs={[{ text: "AI output 1" }, { text: "AI output 2" }]}
369
+ */
370
+ outputs?: AIPromptOutputInterface[];
371
+ /**
372
+ * Indicates whether the prompt is currently streaming or processing.
373
+ *
374
+ * @example
375
+ * streaming={true}
376
+ */
377
+ streaming?: boolean;
378
+ /**
379
+ * Configuration for the output card displaying AI results.
380
+ *
381
+ * @example
382
+ * outputCard={{ title: "AI Result", content: "..." }}
383
+ */
384
+ outputCard?: AIPromptCardInterface;
385
+ /**
386
+ * Current value of the prompt input field.
387
+ *
388
+ * @example
389
+ * promptValue="Describe the selected rows"
390
+ */
391
+ promptValue?: string;
392
+ /**
393
+ * Placeholder text for the prompt input field.
394
+ *
395
+ * @example
396
+ * promptPlaceHolder="Type your question here..."
397
+ */
398
+ promptPlaceHolder?: string;
399
+ /**
400
+ * Custom component to render the prompt input field.
401
+ *
402
+ * @example
403
+ * promptInput={CustomTextArea}
404
+ */
405
+ promptInput?: CustomComponent<TextAreaProps>;
406
+ /**
407
+ * Callback fired when the active view changes.
408
+ *
409
+ * @param viewName The name of the new active view.
410
+ * @example
411
+ * onActiveViewChange={(view) => setActiveView(view)}
412
+ */
413
+ onActiveViewChange?: (viewName: string) => void;
414
+ /**
415
+ * Custom component to render the generate button.
416
+ *
417
+ * @example
418
+ * generateButton={CustomGenerateButton}
419
+ */
420
+ generateButton?: CustomComponent<ButtonProps>;
421
+ /**
422
+ * Name of the currently active view.
423
+ *
424
+ * @example
425
+ * activeView="prompt"
426
+ */
427
+ activeView?: string;
428
+ /**
429
+ * Array of toolbar items to display, can include prompt or output view defaults.
430
+ *
431
+ * @example
432
+ * toolbarItems={[promptViewDefaults, outputViewDefaults]}
433
+ */
434
+ toolbarItems?: Array<typeof promptViewDefaults | typeof outputViewDefaults>;
435
+ /**
436
+ * Callback fired when the user clicks the Copy button in the output card.
437
+ *
438
+ * @example
439
+ * onCopy={() => copyToClipboard()}
440
+ */
441
+ onCopy?: () => void;
442
+ /**
443
+ * Callback fired when the user rates the output.
444
+ *
445
+ * @example
446
+ * onOutputRating={() => handleRating()}
447
+ */
448
+ onOutputRating?: () => void;
449
+ /**
450
+ * Callback fired when the user submits a prompt request.
451
+ *
452
+ * @param prompt The prompt text submitted by the user.
453
+ * @example
454
+ * onPromptRequest={(prompt) => sendPrompt(prompt)}
455
+ */
456
+ onPromptRequest?: (prompt: string) => void;
457
+ /**
458
+ * List of prompt suggestions to display to the user.
459
+ *
460
+ * @example
461
+ * suggestionsList={["Summarize", "Explain", "Generate chart"]}
462
+ */
463
+ suggestionsList?: string[];
464
+ /**
465
+ * Callback fired when the user cancels the current operation.
466
+ *
467
+ * @example
468
+ * onCancel={() => cancelPrompt()}
469
+ */
470
+ onCancel?: () => void;
471
+ /**
472
+ * Callback fired when the user closes the current operation.
473
+ *
474
+ * @example
475
+ * onClose={() => closePrompt()}
476
+ */
477
+ onClose?: () => void;
478
+ }
479
+
316
480
  /**
317
481
  * @hidden
318
482
  */
@@ -2070,6 +2234,22 @@ export declare const GridHierarchyCell: (props: {
2070
2234
  cellProps: GridCellProps;
2071
2235
  }) => JSX.Element | null;
2072
2236
 
2237
+ /**
2238
+ * Represents the object of the `onHighlightChange` Grid event.
2239
+ */
2240
+ export declare interface GridHighlightChangeEvent {
2241
+ /**
2242
+ * The new highlight descriptor based on the user action.
2243
+ */
2244
+ highlight: GridHighlightDescriptor;
2245
+ }
2246
+
2247
+ export declare interface GridHighlightDescriptor {
2248
+ [id: string]: boolean | {
2249
+ [id: string]: boolean;
2250
+ };
2251
+ }
2252
+
2073
2253
  /**
2074
2254
  * Represents the object of the `onItemChange` Grid event.
2075
2255
  */
@@ -2124,6 +2304,10 @@ export declare const gridMessages: {
2124
2304
  "grid.adaptiveToolbarSortTitle": string;
2125
2305
  "grid.adaptiveToolbarGroupTitle": string;
2126
2306
  "grid.toolbarSort": string;
2307
+ "grid.toolbarAI": string;
2308
+ "grid.toolbarAIApply": string;
2309
+ "grid.aIResponseData": string;
2310
+ "grid.generatedWithAI": string;
2127
2311
  "grid.toolbarGroup": string;
2128
2312
  "grid.toolbarFilter": string;
2129
2313
  "grid.toolbarColumnsChooser": string;
@@ -2542,6 +2726,17 @@ export declare interface GridProps extends KendoReactComponentBaseProps {
2542
2726
  * ```
2543
2727
  */
2544
2728
  onFilterChange?: (event: GridFilterChangeEvent) => void;
2729
+ /**
2730
+ * Fires when the Grid highlight is modified. You must handle the event and filter the data.
2731
+ *
2732
+ * @example
2733
+ * ```jsx
2734
+ * <Grid
2735
+ * onHighlightChange={(event) => console.log('Highlight changed:', event.highlight)}
2736
+ * />
2737
+ * ```
2738
+ */
2739
+ onHighlightChange?: (event: GridHighlightChangeEvent) => void;
2545
2740
  /**
2546
2741
  * Specifies whether the loader of the Grid will be displayed.
2547
2742
  *
@@ -2834,11 +3029,7 @@ export declare interface GridProps extends KendoReactComponentBaseProps {
2834
3029
  * <Grid highlight={{ ['item-data-key-id']: { name: true } }} />
2835
3030
  * ```
2836
3031
  */
2837
- highlight?: {
2838
- [id: string]: boolean | {
2839
- [id: string]: boolean;
2840
- };
2841
- };
3032
+ highlight?: GridHighlightDescriptor;
2842
3033
  /**
2843
3034
  * The default `select` state applied to the Grid when using uncontrolled mode.
2844
3035
  *
@@ -3562,6 +3753,135 @@ export declare const GridToolbar: {
3562
3753
  displayName: string;
3563
3754
  };
3564
3755
 
3756
+ /**
3757
+ * Represents the GridToolbarAI component.
3758
+ */
3759
+ export declare const GridToolbarAI: {
3760
+ (props: GridToolbarAIProps): JSX.Element;
3761
+ displayName: string;
3762
+ };
3763
+
3764
+ export declare interface GridToolbarAIProps {
3765
+ /**
3766
+ * Defines the URL to which the request will be sent.
3767
+ *
3768
+ * @example
3769
+ * ```jsx
3770
+ * <GridToolbarAI requestUrl="https://example.com/api/ai" />
3771
+ * ```
3772
+ */
3773
+ requestUrl?: string;
3774
+ /**
3775
+ * Defines the options for the axios request.
3776
+ *
3777
+ * @example
3778
+ * ```jsx
3779
+ * <GridToolbarAI requestOptions={{ timeout: 5000 }} />
3780
+ * ```
3781
+ */
3782
+ requestOptions?: AxiosRequestConfig;
3783
+ /**
3784
+ * Called before the request is sent.
3785
+ *
3786
+ * @example
3787
+ * ```jsx
3788
+ * <GridToolbarAI onPromptRequest={(request) => console.log(request)} />
3789
+ * ```
3790
+ */
3791
+ onPromptRequest?: (request: GridToolbarAIRequestData, isRetry?: boolean) => void;
3792
+ /**
3793
+ * Called when the response is received.
3794
+ *
3795
+ * @example
3796
+ * ```jsx
3797
+ * <GridToolbarAI onResponseSuccess={(response) => console.log(response)} />
3798
+ * ```
3799
+ */
3800
+ onResponseSuccess?: (response: AxiosResponse<any>) => void;
3801
+ /**
3802
+ * Called when the response returns an error.
3803
+ *
3804
+ * @example
3805
+ * ```jsx
3806
+ * <GridToolbarAI onResponseError={(error) => console.error(error)} />
3807
+ * ```
3808
+ */
3809
+ onResponseError?: (error: any) => void;
3810
+ /**
3811
+ * Defines the user role for the request. Defaults to 'user'.
3812
+ *
3813
+ * @example
3814
+ * ```jsx
3815
+ * <GridToolbarAI role="admin" />
3816
+ * ```
3817
+ */
3818
+ role?: string;
3819
+ /**
3820
+ * Customizes the AI prompt component.
3821
+ *
3822
+ * @example
3823
+ * ```jsx
3824
+ * <GridToolbarAI gridAIPrompt={MyCustomPromptComponent} />
3825
+ * ```
3826
+ */
3827
+ gridAIPrompt?: CustomComponent<GridAIPromptProps>;
3828
+ /**
3829
+ * Defines the icon rendered in the GridToolbarAI tool ([see example]({% slug overview_icon %})).
3830
+ *
3831
+ * @example
3832
+ * ```jsx
3833
+ * <GridToolbarAI icon="home" />
3834
+ * ```
3835
+ */
3836
+ icon?: string;
3837
+ /**
3838
+ * Defines the SVG icon rendered in the GridToolbarAI tool ([see example]({% slug overview_svgicon %})).
3839
+ *
3840
+ * @example
3841
+ * ```jsx
3842
+ * import { gearIcon } from '@progress/kendo-svg-icons';
3843
+ *
3844
+ * <GridToolbarAI svgIcon={gearIcon} />
3845
+ * ```
3846
+ */
3847
+ svgIcon?: SVGIcon_2;
3848
+ /**
3849
+ * Specifies if the popup will be displayed.
3850
+ *
3851
+ * @example
3852
+ * ```jsx
3853
+ * <GridToolbarAI show={true} />
3854
+ * ```
3855
+ */
3856
+ show?: boolean;
3857
+ /**
3858
+ * The method that will be called to close the column menu.
3859
+ *
3860
+ * @example
3861
+ * ```jsx
3862
+ * <GridToolbarAI onCloseWindow={() => console.log('close menu');} />
3863
+ * ```
3864
+ */
3865
+ onCloseWindow?: () => void;
3866
+ }
3867
+
3868
+ export declare interface GridToolbarAIRequestData {
3869
+ role: string;
3870
+ columns: Array<{
3871
+ field: string;
3872
+ }>;
3873
+ headers: Record<string, string>;
3874
+ promptMessage: string;
3875
+ requestOptions: {
3876
+ url?: string;
3877
+ method?: string;
3878
+ withCredentials?: boolean;
3879
+ responseType?: string;
3880
+ cancelToken?: any;
3881
+ [key: string]: any;
3882
+ };
3883
+ }
3884
+
3565
3885
  /**
3566
3886
  * Represents the GridToolbarCheckboxFilter component.
3567
3887
  */