@progress/kendo-react-grid 11.4.0-develop.9 → 11.4.0
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/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.d.mts +6 -4
- package/index.d.ts +6 -4
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +17 -17
- package/toolbar-tools/GridToolbarAIAssistant.js +2 -2
- package/toolbar-tools/GridToolbarAIAssistant.mjs +187 -176
- package/toolbar-tools/ai-tool/GridAIPrompt.js +1 -1
- package/toolbar-tools/ai-tool/GridAIPrompt.mjs +1 -0
package/index.d.mts
CHANGED
|
@@ -3766,10 +3766,12 @@ export declare const GridToolbar: {
|
|
|
3766
3766
|
/**
|
|
3767
3767
|
* Represents the GridToolbarAIAssistant component.
|
|
3768
3768
|
*/
|
|
3769
|
-
export declare const GridToolbarAIAssistant:
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3769
|
+
export declare const GridToolbarAIAssistant: React_2.ForwardRefExoticComponent<GridToolbarAIAssistantProps & React_2.RefAttributes<GridToolbarAIAssistantHandle>>;
|
|
3770
|
+
|
|
3771
|
+
declare interface GridToolbarAIAssistantHandle {
|
|
3772
|
+
show: () => void;
|
|
3773
|
+
hide: () => void;
|
|
3774
|
+
}
|
|
3773
3775
|
|
|
3774
3776
|
export declare interface GridToolbarAIAssistantProps {
|
|
3775
3777
|
/**
|
package/index.d.ts
CHANGED
|
@@ -3766,10 +3766,12 @@ export declare const GridToolbar: {
|
|
|
3766
3766
|
/**
|
|
3767
3767
|
* Represents the GridToolbarAIAssistant component.
|
|
3768
3768
|
*/
|
|
3769
|
-
export declare const GridToolbarAIAssistant:
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3769
|
+
export declare const GridToolbarAIAssistant: React_2.ForwardRefExoticComponent<GridToolbarAIAssistantProps & React_2.RefAttributes<GridToolbarAIAssistantHandle>>;
|
|
3770
|
+
|
|
3771
|
+
declare interface GridToolbarAIAssistantHandle {
|
|
3772
|
+
show: () => void;
|
|
3773
|
+
hide: () => void;
|
|
3774
|
+
}
|
|
3773
3775
|
|
|
3774
3776
|
export declare interface GridToolbarAIAssistantProps {
|
|
3775
3777
|
/**
|
package/package-metadata.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-grid",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-grid",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1755016121,version:"11.4.0",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"});exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -10,8 +10,8 @@ const e = Object.freeze({
|
|
|
10
10
|
productName: "KendoReact",
|
|
11
11
|
productCode: "KENDOUIREACT",
|
|
12
12
|
productCodes: ["KENDOUIREACT"],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: "11.4.0
|
|
13
|
+
publishDate: 1755016121,
|
|
14
|
+
version: "11.4.0",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
});
|
|
17
17
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-grid",
|
|
3
|
-
"version": "11.4.0
|
|
3
|
+
"version": "11.4.0",
|
|
4
4
|
"description": "React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -28,21 +28,21 @@
|
|
|
28
28
|
"@progress/kendo-data-query": "^1.0.0",
|
|
29
29
|
"@progress/kendo-drawing": "^1.21.2",
|
|
30
30
|
"@progress/kendo-licensing": "^1.7.0",
|
|
31
|
-
"@progress/kendo-react-animation": "11.4.0
|
|
32
|
-
"@progress/kendo-react-buttons": "11.4.0
|
|
33
|
-
"@progress/kendo-react-common": "11.4.0
|
|
34
|
-
"@progress/kendo-react-data-tools": "11.4.0
|
|
35
|
-
"@progress/kendo-react-dateinputs": "11.4.0
|
|
36
|
-
"@progress/kendo-react-indicators": "11.4.0
|
|
37
|
-
"@progress/kendo-react-form": "11.4.0
|
|
38
|
-
"@progress/kendo-react-labels": "11.4.0
|
|
39
|
-
"@progress/kendo-react-dialogs": "11.4.0
|
|
40
|
-
"@progress/kendo-react-dropdowns": "11.4.0
|
|
41
|
-
"@progress/kendo-react-inputs": "11.4.0
|
|
42
|
-
"@progress/kendo-react-intl": "11.4.0
|
|
43
|
-
"@progress/kendo-react-popup": "11.4.0
|
|
44
|
-
"@progress/kendo-react-layout": "11.4.0
|
|
45
|
-
"@progress/kendo-react-conversational-ui": "11.4.0
|
|
31
|
+
"@progress/kendo-react-animation": "11.4.0",
|
|
32
|
+
"@progress/kendo-react-buttons": "11.4.0",
|
|
33
|
+
"@progress/kendo-react-common": "11.4.0",
|
|
34
|
+
"@progress/kendo-react-data-tools": "11.4.0",
|
|
35
|
+
"@progress/kendo-react-dateinputs": "11.4.0",
|
|
36
|
+
"@progress/kendo-react-indicators": "11.4.0",
|
|
37
|
+
"@progress/kendo-react-form": "11.4.0",
|
|
38
|
+
"@progress/kendo-react-labels": "11.4.0",
|
|
39
|
+
"@progress/kendo-react-dialogs": "11.4.0",
|
|
40
|
+
"@progress/kendo-react-dropdowns": "11.4.0",
|
|
41
|
+
"@progress/kendo-react-inputs": "11.4.0",
|
|
42
|
+
"@progress/kendo-react-intl": "11.4.0",
|
|
43
|
+
"@progress/kendo-react-popup": "11.4.0",
|
|
44
|
+
"@progress/kendo-react-layout": "11.4.0",
|
|
45
|
+
"@progress/kendo-react-conversational-ui": "11.4.0",
|
|
46
46
|
"@progress/kendo-svg-icons": "^4.0.0",
|
|
47
47
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
48
48
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"package": {
|
|
147
147
|
"productName": "KendoReact",
|
|
148
148
|
"productCode": "KENDOUIREACT",
|
|
149
|
-
"publishDate":
|
|
149
|
+
"publishDate": 1755016121,
|
|
150
150
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
151
151
|
}
|
|
152
152
|
},
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
9
|
-
`);
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("react"),ae=require("../utils/GridContext.js"),ie=require("@progress/kendo-react-buttons"),le=require("@progress/kendo-svg-icons"),G=require("axios"),ue=require("@progress/kendo-react-intl"),i=require("../messages/index.js"),D=require("@progress/kendo-react-common"),ce=require("@progress/kendo-react-dialogs"),de=require("./ai-tool/GridAIPrompt.js"),L=require("../filterCommon.js");function pe(s){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const u=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(c,t,u.get?u:{enumerable:!0,get:()=>s[t]})}}return c.default=s,Object.freeze(c)}const o=pe(re),fe=(s,c)=>s.map(u=>{let p=u;return c.forEach(d=>{d.field&&p.includes(d.field)&&(p=p.replace(new RegExp(d.field,"g"),d.title||d.field))}),p}),v=o.forwardRef((s,c)=>{const t=o.useContext(ae.GridContext),u=ue.useLocalization(),{requestUrl:p,requestOptions:d,onPromptRequest:O,onResponseSuccess:P,onResponseError:E,role:W="user",gridAIPrompt:B=de.GridAIPrompt,icon:F,svgIcon:A,onCloseWindow:R,promptPlaceHolder:M,suggestionsList:z,streaming:H,loading:N,outputs:_}=s,[w,j]=o.useState([]),$=o.useMemo(()=>t&&Array.isArray(t.columnsRef)?t.columnsRef.map(e=>({field:e.field})):[],[t]),[K,h]=o.useState(!1),[C,I]=o.useState(!1),[U,X]=o.useState(),[Y,J]=o.useState(),f=o.useRef(null),k=o.useRef(null),Q=e=>{e.preventDefault(),I(!C)},y=o.useMemo(()=>{var e;return(e=s.show)!=null?e:C},[s.show,C]),b=o.useCallback(()=>{var e;R&&R(),j([]),I(!1),f.current&&((e=f.current.element)==null||e.focus())},[R]),V=(e,r,g)=>{var l,S;if(h(!1),e!=null&&e.data){if(t.sortable&&e.data.sort)if(e.data.sort.length===0)t.sortChange([],e);else{const a=(l=t.sort)!=null?l:[],n=[];a.forEach(m=>{e.data.sort.some(T=>T.field===m.field)||n.push(m)}),n.push(...e.data.sort),t.sortChange(n,e)}if(e.data.filter){const a=L.combineSmartFilters(e.data.filter,t.filter);t.filterChange(a,e)}if(e.data.highlight){let a=e.data.highlight;Array.isArray(a)&&(a=a.map(n=>(n!=null&&n.filters&&Array.isArray(n.filters)&&L.parseFilterDates(n),n))),t.applyHighlightDescriptor(a)}if(t&&e.data.group)if(e.data.group.length===0)t.groupChange([],e);else{const a=(S=t.group)!=null?S:[],n=[];a.forEach(m=>{e.data.group.some(T=>T.field===m.field)||n.push(m)}),n.push(...e.data.group),t.groupChange(n,e)}if(e.data.messages){const a=[u.toLanguageString(i.aIResponseData,i.messages[i.aIResponseData])],n=fe(e.data.messages,t.columnsRef).join(`
|
|
9
|
+
`);j([{id:w.length+1,title:u.toLanguageString(i.generatedWithAI,i.messages[i.generatedWithAI]),subTitle:r,prompt:r,responseContent:a.concat(n).join(""),isRetry:g},...w])}}P&&P(e,r,g)},Z=e=>{E&&E(e),h(!1)},q=(e,r)=>{const g=G.CancelToken.source(),l={role:"user",columns:$||[],headers:{Accept:"*/*","Content-Type":"application/json"},promptMessage:e,requestOptions:{url:p,method:"POST",withCredentials:!1,responseType:"json",cancelToken:g.token,...d}};O&&O(l,r),l.requestOptions.url!==void 0&&(h(!0),G({...l.requestOptions,headers:l.headers,data:{role:W||l.role,contents:[{$type:"text",text:l.promptMessage}],columns:l.columns||[]},...s.requestOptions}).then(S=>V(S,l.promptMessage,r)).catch(Z),k.current=g)},ee=o.useCallback(()=>{k.current&&k.current.cancel("Request cancelled by user."),h(!1)},[]),[te,x]=D.useCustomComponent(B),oe=Object.keys(x).length>0?x:{},ne=o.createElement(te,{onPromptRequest:q,onCancel:ee,onClose:b,streaming:H||K,loading:N,outputs:_||w,promptPlaceHolder:M,suggestionsList:z,...oe}),se=o.createElement(ie.Button,{ref:f,togglable:!0,themeColor:"primary",rounded:"full",selected:y,svgIcon:A!=null?A:le.sparklesIcon,icon:F,size:t.mobileMode?"large":"medium",className:D.classNames("k-toolbar-button",{"k-icon-button":t.mobileMode}),title:u.toLanguageString(i.toolbarAI,i.messages[i.toolbarAI]),onClick:Q});return o.useEffect(()=>{var e;if(f.current&&y){const r=(e=f.current.element)==null?void 0:e.getBoundingClientRect();r&&(X(r.top+window.scrollY+r.height),J(r.left+window.scrollX+r.width))}},[y]),o.useImperativeHandle(c,()=>({show:()=>I(!0),hide:()=>b()}),[b]),o.createElement(o.Fragment,null,se,C&&o.createElement(ce.Window,{autoFocus:!1,title:u.toLanguageString(i.toolbarAI,i.messages[i.toolbarAI]),initialTop:U,initialLeft:Y,initialWidth:520,initialHeight:500,onClose:b,resizable:!0,draggable:!0,className:"k-grid-assistant-window"},ne))});v.displayName="KendoReactGridToolbarAIAssistant";exports.GridToolbarAIAssistant=v;
|
|
@@ -5,187 +5,198 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { GridContext as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { sparklesIcon as
|
|
12
|
-
import
|
|
13
|
-
import { useLocalization as
|
|
14
|
-
import { toolbarAI as
|
|
15
|
-
import { useCustomComponent as
|
|
16
|
-
import { Window as
|
|
17
|
-
import { GridAIPrompt as
|
|
18
|
-
import { combineSmartFilters as
|
|
19
|
-
const
|
|
20
|
-
let
|
|
21
|
-
return
|
|
22
|
-
i.field &&
|
|
23
|
-
}),
|
|
24
|
-
}),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
t.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
if (t.data.sort
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
8
|
+
import * as e from "react";
|
|
9
|
+
import { GridContext as rt } from "../utils/GridContext.mjs";
|
|
10
|
+
import { Button as at } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { sparklesIcon as it } from "@progress/kendo-svg-icons";
|
|
12
|
+
import F from "axios";
|
|
13
|
+
import { useLocalization as lt } from "@progress/kendo-react-intl";
|
|
14
|
+
import { toolbarAI as S, messages as w, aIResponseData as W, generatedWithAI as j } from "../messages/index.mjs";
|
|
15
|
+
import { useCustomComponent as ut, classNames as ct } from "@progress/kendo-react-common";
|
|
16
|
+
import { Window as pt } from "@progress/kendo-react-dialogs";
|
|
17
|
+
import { GridAIPrompt as dt } from "./ai-tool/GridAIPrompt.mjs";
|
|
18
|
+
import { combineSmartFilters as ft, parseFilterDates as mt } from "../filterCommon.mjs";
|
|
19
|
+
const gt = (l, b) => l.map((u) => {
|
|
20
|
+
let c = u;
|
|
21
|
+
return b.forEach((i) => {
|
|
22
|
+
i.field && c.includes(i.field) && (c = c.replace(new RegExp(i.field, "g"), i.title || i.field));
|
|
23
|
+
}), c;
|
|
24
|
+
}), ht = e.forwardRef(
|
|
25
|
+
(l, b) => {
|
|
26
|
+
const o = e.useContext(rt), u = lt(), {
|
|
27
|
+
requestUrl: c,
|
|
28
|
+
requestOptions: i,
|
|
29
|
+
onPromptRequest: E,
|
|
30
|
+
onResponseSuccess: O,
|
|
31
|
+
onResponseError: x,
|
|
32
|
+
role: B = "user",
|
|
33
|
+
gridAIPrompt: D = dt,
|
|
34
|
+
icon: H,
|
|
35
|
+
svgIcon: A,
|
|
36
|
+
onCloseWindow: R,
|
|
37
|
+
promptPlaceHolder: v,
|
|
38
|
+
suggestionsList: z,
|
|
39
|
+
streaming: M,
|
|
40
|
+
loading: N,
|
|
41
|
+
outputs: $
|
|
42
|
+
} = l, [T, L] = e.useState([]), K = e.useMemo(() => o && Array.isArray(o.columnsRef) ? o.columnsRef.map((t) => ({ field: t.field })) : [], [o]), [U, m] = e.useState(!1), [g, k] = e.useState(!1), [X, Y] = e.useState(), [J, Q] = e.useState(), p = e.useRef(null), y = e.useRef(null), V = (t) => {
|
|
43
|
+
t.preventDefault(), k(!g);
|
|
44
|
+
}, I = e.useMemo(() => {
|
|
45
|
+
var t;
|
|
46
|
+
return (t = l.show) != null ? t : g;
|
|
47
|
+
}, [l.show, g]), h = e.useCallback(() => {
|
|
48
|
+
var t;
|
|
49
|
+
R && R(), L([]), k(!1), p.current && ((t = p.current.element) == null || t.focus());
|
|
50
|
+
}, [R]), Z = (t, n, d) => {
|
|
51
|
+
var a, C;
|
|
52
|
+
if (m(!1), t != null && t.data) {
|
|
53
|
+
if (o.sortable && t.data.sort)
|
|
54
|
+
if (t.data.sort.length === 0)
|
|
55
|
+
o.sortChange([], t);
|
|
56
|
+
else {
|
|
57
|
+
const r = (a = o.sort) != null ? a : [], s = [];
|
|
58
|
+
r.forEach((f) => {
|
|
59
|
+
t.data.sort.some((P) => P.field === f.field) || s.push(f);
|
|
60
|
+
}), s.push(...t.data.sort), o.sortChange(s, t);
|
|
61
|
+
}
|
|
62
|
+
if (t.data.filter) {
|
|
63
|
+
const r = ft(t.data.filter, o.filter);
|
|
64
|
+
o.filterChange(r, t);
|
|
60
65
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
if (t.data.highlight) {
|
|
66
|
-
let r = t.data.highlight;
|
|
67
|
-
Array.isArray(r) && (r = r.map((o) => (o != null && o.filters && Array.isArray(o.filters) && ft(o), o))), e.applyHighlightDescriptor(r);
|
|
68
|
-
}
|
|
69
|
-
if (e && t.data.group)
|
|
70
|
-
if (t.data.group.length === 0)
|
|
71
|
-
e.groupChange([], t);
|
|
72
|
-
else {
|
|
73
|
-
const r = (h = e.group) != null ? h : [], o = [];
|
|
74
|
-
r.forEach((f) => {
|
|
75
|
-
t.data.group.some((y) => y.field === f.field) || o.push(f);
|
|
76
|
-
}), o.push(...t.data.group), e.groupChange(o, t);
|
|
66
|
+
if (t.data.highlight) {
|
|
67
|
+
let r = t.data.highlight;
|
|
68
|
+
Array.isArray(r) && (r = r.map((s) => (s != null && s.filters && Array.isArray(s.filters) && mt(s), s))), o.applyHighlightDescriptor(r);
|
|
77
69
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
if (o && t.data.group)
|
|
71
|
+
if (t.data.group.length === 0)
|
|
72
|
+
o.groupChange([], t);
|
|
73
|
+
else {
|
|
74
|
+
const r = (C = o.group) != null ? C : [], s = [];
|
|
75
|
+
r.forEach((f) => {
|
|
76
|
+
t.data.group.some((P) => P.field === f.field) || s.push(f);
|
|
77
|
+
}), s.push(...t.data.group), o.groupChange(s, t);
|
|
78
|
+
}
|
|
79
|
+
if (t.data.messages) {
|
|
80
|
+
const r = [
|
|
81
|
+
u.toLanguageString(W, w[W])
|
|
82
|
+
], s = gt(t.data.messages, o.columnsRef).join(
|
|
83
|
+
`
|
|
81
84
|
`
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
);
|
|
86
|
+
L([
|
|
87
|
+
{
|
|
88
|
+
id: T.length + 1,
|
|
89
|
+
title: u.toLanguageString(j, w[j]),
|
|
90
|
+
subTitle: n,
|
|
91
|
+
prompt: n,
|
|
92
|
+
responseContent: r.concat(s).join(""),
|
|
93
|
+
isRetry: d
|
|
94
|
+
},
|
|
95
|
+
...T
|
|
96
|
+
]);
|
|
97
|
+
}
|
|
94
98
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
99
|
+
O && O(t, n, d);
|
|
100
|
+
}, _ = (t) => {
|
|
101
|
+
x && x(t), m(!1);
|
|
102
|
+
}, q = (t, n) => {
|
|
103
|
+
const d = F.CancelToken.source(), a = {
|
|
104
|
+
role: "user",
|
|
105
|
+
columns: K || [],
|
|
106
|
+
headers: {
|
|
107
|
+
Accept: "*/*",
|
|
108
|
+
"Content-Type": "application/json"
|
|
109
|
+
},
|
|
110
|
+
promptMessage: t,
|
|
111
|
+
requestOptions: {
|
|
112
|
+
url: c,
|
|
113
|
+
method: "POST",
|
|
114
|
+
withCredentials: !1,
|
|
115
|
+
responseType: "json",
|
|
116
|
+
cancelToken: d.token,
|
|
117
|
+
...i
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
E && E(a, n), a.requestOptions.url !== void 0 && (m(!0), F({
|
|
121
|
+
...a.requestOptions,
|
|
122
|
+
headers: a.headers,
|
|
123
|
+
data: {
|
|
124
|
+
role: B || a.role,
|
|
125
|
+
contents: [
|
|
126
|
+
{
|
|
127
|
+
$type: "text",
|
|
128
|
+
text: a.promptMessage
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
columns: a.columns || []
|
|
132
|
+
},
|
|
133
|
+
...l.requestOptions
|
|
134
|
+
}).then((C) => Z(C, a.promptMessage, n)).catch(_), y.current = d);
|
|
135
|
+
}, tt = e.useCallback(() => {
|
|
136
|
+
y.current && y.current.cancel("Request cancelled by user."), m(!1);
|
|
137
|
+
}, []), [et, G] = ut(
|
|
138
|
+
D
|
|
139
|
+
), ot = Object.keys(G).length > 0 ? G : {}, st = /* @__PURE__ */ e.createElement(
|
|
140
|
+
et,
|
|
141
|
+
{
|
|
142
|
+
onPromptRequest: q,
|
|
143
|
+
onCancel: tt,
|
|
144
|
+
onClose: h,
|
|
145
|
+
streaming: M || U,
|
|
146
|
+
loading: N,
|
|
147
|
+
outputs: $ || T,
|
|
148
|
+
promptPlaceHolder: v,
|
|
149
|
+
suggestionsList: z,
|
|
150
|
+
...ot
|
|
115
151
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
152
|
+
), nt = /* @__PURE__ */ e.createElement(
|
|
153
|
+
at,
|
|
154
|
+
{
|
|
155
|
+
ref: p,
|
|
156
|
+
togglable: !0,
|
|
157
|
+
themeColor: "primary",
|
|
158
|
+
rounded: "full",
|
|
159
|
+
selected: I,
|
|
160
|
+
svgIcon: A != null ? A : it,
|
|
161
|
+
icon: H,
|
|
162
|
+
size: o.mobileMode ? "large" : "medium",
|
|
163
|
+
className: ct("k-toolbar-button", { "k-icon-button": o.mobileMode }),
|
|
164
|
+
title: u.toLanguageString(S, w[S]),
|
|
165
|
+
onClick: V
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
return e.useEffect(() => {
|
|
169
|
+
var t;
|
|
170
|
+
if (p.current && I) {
|
|
171
|
+
const n = (t = p.current.element) == null ? void 0 : t.getBoundingClientRect();
|
|
172
|
+
n && (Y(n.top + window.scrollY + n.height), Q(n.left + window.scrollX + n.width));
|
|
173
|
+
}
|
|
174
|
+
}, [I]), e.useImperativeHandle(
|
|
175
|
+
b,
|
|
176
|
+
() => ({
|
|
177
|
+
show: () => k(!0),
|
|
178
|
+
hide: () => h()
|
|
179
|
+
}),
|
|
180
|
+
[h]
|
|
181
|
+
), /* @__PURE__ */ e.createElement(e.Fragment, null, nt, g && /* @__PURE__ */ e.createElement(
|
|
182
|
+
pt,
|
|
183
|
+
{
|
|
184
|
+
autoFocus: !1,
|
|
185
|
+
title: u.toLanguageString(S, w[S]),
|
|
186
|
+
initialTop: X,
|
|
187
|
+
initialLeft: J,
|
|
188
|
+
initialWidth: 520,
|
|
189
|
+
initialHeight: 500,
|
|
190
|
+
onClose: h,
|
|
191
|
+
resizable: !0,
|
|
192
|
+
draggable: !0,
|
|
193
|
+
className: "k-grid-assistant-window"
|
|
129
194
|
},
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
B
|
|
136
|
-
), et = Object.keys(L).length > 0 ? L : {}, ot = /* @__PURE__ */ s.createElement(
|
|
137
|
-
tt,
|
|
138
|
-
{
|
|
139
|
-
onPromptRequest: _,
|
|
140
|
-
onCancel: q,
|
|
141
|
-
onClose: x,
|
|
142
|
-
streaming: M || K,
|
|
143
|
-
loading: N,
|
|
144
|
-
outputs: v || b,
|
|
145
|
-
promptPlaceHolder: z,
|
|
146
|
-
suggestionsList: H,
|
|
147
|
-
...et
|
|
148
|
-
}
|
|
149
|
-
), st = /* @__PURE__ */ s.createElement(
|
|
150
|
-
rt,
|
|
151
|
-
{
|
|
152
|
-
ref: p,
|
|
153
|
-
togglable: !0,
|
|
154
|
-
themeColor: "primary",
|
|
155
|
-
rounded: "full",
|
|
156
|
-
selected: T,
|
|
157
|
-
svgIcon: A != null ? A : at,
|
|
158
|
-
icon: D,
|
|
159
|
-
size: e.mobileMode ? "large" : "medium",
|
|
160
|
-
className: ut("k-toolbar-button", { "k-icon-button": e.mobileMode }),
|
|
161
|
-
title: c.toLanguageString(C, S[C]),
|
|
162
|
-
onClick: Q
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
return s.useEffect(() => {
|
|
166
|
-
var t;
|
|
167
|
-
if (p.current && T) {
|
|
168
|
-
const n = (t = p.current.element) == null ? void 0 : t.getBoundingClientRect();
|
|
169
|
-
n && (X(n.top + window.scrollY + n.height), J(n.left + window.scrollX + n.width));
|
|
170
|
-
}
|
|
171
|
-
}, [T]), /* @__PURE__ */ s.createElement(s.Fragment, null, st, g && /* @__PURE__ */ s.createElement(
|
|
172
|
-
ct,
|
|
173
|
-
{
|
|
174
|
-
autoFocus: !1,
|
|
175
|
-
title: c.toLanguageString(C, S[C]),
|
|
176
|
-
initialTop: U,
|
|
177
|
-
initialLeft: Y,
|
|
178
|
-
initialWidth: 520,
|
|
179
|
-
initialHeight: 500,
|
|
180
|
-
onClose: x,
|
|
181
|
-
resizable: !0,
|
|
182
|
-
draggable: !0,
|
|
183
|
-
className: "k-grid-assistant-window"
|
|
184
|
-
},
|
|
185
|
-
ot
|
|
186
|
-
));
|
|
187
|
-
};
|
|
188
|
-
gt.displayName = "KendoReactGridToolbarAIAssistant";
|
|
195
|
+
st
|
|
196
|
+
));
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
ht.displayName = "KendoReactGridToolbarAIAssistant";
|
|
189
200
|
export {
|
|
190
|
-
|
|
201
|
+
ht as GridToolbarAIAssistant
|
|
191
202
|
};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),s=require("@progress/kendo-react-conversational-ui"),S=require("@progress/kendo-react-buttons"),h=require("@progress/kendo-react-inputs"),D=require("@progress/kendo-svg-icons"),u=require("../../messages/index.js"),E=require("@progress/kendo-react-intl");function x(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(o,n,a.get?a:{enumerable:!0,get:()=>t[n]})}}return o.default=t,Object.freeze(o)}const r=x(O),j=t=>{const{responseContent:o}=t,n=o.split(`
|
|
9
|
-
`);return r.createElement("div",{className:"k-card-body"},n.map((a,c)=>r.createElement("div",{key:a.trim()+c,className:"k-card-text"},a)))},z=t=>{const{activeView:o,onActiveViewChange:n,toolbarItems:a,outputs:c,promptValue:d,promptInput:g,generateButton:f,onCopy:b,onOutputRating:y,onPromptRequest:i,suggestionsList:A,outputCard:
|
|
9
|
+
`);return r.createElement("div",{className:"k-card-body"},n.map((a,c)=>r.createElement("div",{key:a.trim()+c,className:"k-card-text"},a)))},z=t=>{const{activeView:o,onActiveViewChange:n,toolbarItems:a,outputs:c,promptValue:d,promptInput:g,generateButton:f,onCopy:b,onOutputRating:y,onPromptRequest:i,suggestionsList:A,outputCard:w,promptPlaceHolder:I,streaming:V,loading:k,onCancel:v,onClose:l}=t,p=E.useLocalization(),[C,m]=r.useState(s.promptViewDefaults.name),q=(e,B)=>{e&&(i&&i(e),m(s.outputViewDefaults.name))},P=e=>{n&&n(e),m(e)},R=e=>{e.key==="Escape"&&l&&l()};return r.useEffect(()=>{const e=document.querySelector(".k-prompt-view .k-textarea textarea");e&&e.focus()},[]),r.createElement(s.AIPrompt,{style:{maxHeight:"100%"},activeView:o!=null?o:C,onActiveViewChange:P,onPromptRequest:q,toolbarItems:a||[s.promptViewDefaults,s.outputViewDefaults],streaming:V,loading:k,suggestionsView:"modern",onCancel:v,onKeyDown:R},r.createElement(s.AIPromptView,{promptSuggestions:A,promptValue:d,promptInput:g||r.createElement(h.TextArea,{placeholder:I,rows:2}),generateButton:f||r.createElement(S.Button,{svgIcon:D.tableWizardIcon,icon:"table-wizard",type:"button",title:p.toLanguageString(u.toolbarAIApply,u.messages[u.toolbarAIApply])},p.toLanguageString(u.toolbarAIApply,u.messages[u.toolbarAIApply]))}),r.createElement(s.AIPromptOutputView,{outputs:c,showOutputRating:!0,onCopy:b,onOutputRating:y,outputCard:w||{body:j}}))};exports.GridAIPrompt=z;
|