@progress/kendo-react-grid 13.1.0-develop.2 → 13.1.0-develop.4
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/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +18 -18
- package/toolbar-tools/GridToolbarAIAssistant.js +2 -2
- package/toolbar-tools/GridToolbarAIAssistant.mjs +138 -128
- package/toolbar-tools/ai-tool/GridAIPrompt.js +2 -2
- package/toolbar-tools/ai-tool/GridAIPrompt.mjs +46 -36
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: 1763476002,version:"13.1.0-develop.4",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: "13.1.0-develop.
|
|
13
|
+
publishDate: 1763476002,
|
|
14
|
+
version: "13.1.0-develop.4",
|
|
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": "13.1.0-develop.
|
|
3
|
+
"version": "13.1.0-develop.4",
|
|
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",
|
|
@@ -27,22 +27,22 @@
|
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@progress/kendo-data-query": "^1.0.0",
|
|
29
29
|
"@progress/kendo-drawing": "^1.21.2",
|
|
30
|
-
"@progress/kendo-licensing": "^1.7.
|
|
31
|
-
"@progress/kendo-react-animation": "13.1.0-develop.
|
|
32
|
-
"@progress/kendo-react-buttons": "13.1.0-develop.
|
|
33
|
-
"@progress/kendo-react-common": "13.1.0-develop.
|
|
34
|
-
"@progress/kendo-react-data-tools": "13.1.0-develop.
|
|
35
|
-
"@progress/kendo-react-dateinputs": "13.1.0-develop.
|
|
36
|
-
"@progress/kendo-react-indicators": "13.1.0-develop.
|
|
37
|
-
"@progress/kendo-react-form": "13.1.0-develop.
|
|
38
|
-
"@progress/kendo-react-labels": "13.1.0-develop.
|
|
39
|
-
"@progress/kendo-react-dialogs": "13.1.0-develop.
|
|
40
|
-
"@progress/kendo-react-dropdowns": "13.1.0-develop.
|
|
41
|
-
"@progress/kendo-react-inputs": "13.1.0-develop.
|
|
42
|
-
"@progress/kendo-react-intl": "13.1.0-develop.
|
|
43
|
-
"@progress/kendo-react-popup": "13.1.0-develop.
|
|
44
|
-
"@progress/kendo-react-layout": "13.1.0-develop.
|
|
45
|
-
"@progress/kendo-react-conversational-ui": "13.1.0-develop.
|
|
30
|
+
"@progress/kendo-licensing": "^1.7.2",
|
|
31
|
+
"@progress/kendo-react-animation": "13.1.0-develop.4",
|
|
32
|
+
"@progress/kendo-react-buttons": "13.1.0-develop.4",
|
|
33
|
+
"@progress/kendo-react-common": "13.1.0-develop.4",
|
|
34
|
+
"@progress/kendo-react-data-tools": "13.1.0-develop.4",
|
|
35
|
+
"@progress/kendo-react-dateinputs": "13.1.0-develop.4",
|
|
36
|
+
"@progress/kendo-react-indicators": "13.1.0-develop.4",
|
|
37
|
+
"@progress/kendo-react-form": "13.1.0-develop.4",
|
|
38
|
+
"@progress/kendo-react-labels": "13.1.0-develop.4",
|
|
39
|
+
"@progress/kendo-react-dialogs": "13.1.0-develop.4",
|
|
40
|
+
"@progress/kendo-react-dropdowns": "13.1.0-develop.4",
|
|
41
|
+
"@progress/kendo-react-inputs": "13.1.0-develop.4",
|
|
42
|
+
"@progress/kendo-react-intl": "13.1.0-develop.4",
|
|
43
|
+
"@progress/kendo-react-popup": "13.1.0-develop.4",
|
|
44
|
+
"@progress/kendo-react-layout": "13.1.0-develop.4",
|
|
45
|
+
"@progress/kendo-react-conversational-ui": "13.1.0-develop.4",
|
|
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",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"package": {
|
|
148
148
|
"productName": "KendoReact",
|
|
149
149
|
"productCode": "KENDOUIREACT",
|
|
150
|
-
"publishDate":
|
|
150
|
+
"publishDate": 1763476002,
|
|
151
151
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
152
152
|
}
|
|
153
153
|
},
|
|
@@ -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
|
-
`);D([{id:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ge=require("react"),be=require("../utils/GridContext.js"),me=require("@progress/kendo-react-buttons"),ke=require("@progress/kendo-svg-icons"),E=require("axios"),Re=require("@progress/kendo-react-intl"),c=require("../messages/index.js"),H=require("@progress/kendo-react-common"),we=require("@progress/kendo-react-dialogs"),ye=require("./ai-tool/GridAIPrompt.js"),xe=require("../filterCommon.js");function Te(n){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const d=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(p,t,d.get?d:{enumerable:!0,get:()=>n[t]})}}return p.default=n,Object.freeze(p)}const a=Te(Ge),z=768;var W=(n=>(n.GridClearFilter="GridClearFilter",n.GridClearSort="GridClearSort",n.GridClearGroup="GridClearGroup",n.GridClearHighlight="GridClearHighlight",n.GridClearSelect="GridClearSelect",n.GridSort="GridSort",n.GridFilter="GridFilter",n.GridGroup="GridGroup",n.GridHighlight="GridHighlight",n.GridSelect="GridSelect",n.GridExportPDF="GridExportPDF",n.GridColumnResize="GridColumnResize",n.GridColumnHide="GridColumnHide",n.GridColumnShow="GridColumnShow",n.GridColumnReorder="GridColumnReorder",n.GridColumnLock="GridColumnLock",n.GridColumnUnlock="GridColumnUnlock",n))(W||{});const Pe=(n,p)=>n.map(d=>{let f=d;return p.forEach(g=>{g.field&&f.includes(g.field)&&(f=f.replace(new RegExp(g.field,"g"),g.title||g.field))}),f}),ve=()=>null,j=a.forwardRef((n,p)=>{const t=a.useContext(be.GridContext),d=Re.useLocalization(),{requestUrl:f,requestOptions:g,onPromptRequest:P,onResponseSuccess:v,onResponseError:m,role:B="user",gridAIPrompt:M=ye.GridAIPrompt,icon:O,svgIcon:N,onCloseWindow:k,promptPlaceHolder:U,suggestionsList:_,streaming:K,loading:q,outputs:V,enableSpeechToText:X}=n,[R,D]=a.useState([]),Y=a.useMemo(()=>t&&Array.isArray(t.columnsRef)&&Array.isArray(t.hiddenColumnsRef)?[...t.columnsRef,...t.hiddenColumnsRef].map(e=>{var r;return{id:e.id,field:e.field,values:(r=e.values)!=null?r:[]}}):[],[t]),[$,C]=a.useState(!1),[J,S]=a.useState(!1),[w,y]=a.useState(!1),[Q,Z]=a.useState(),[ee,te]=a.useState(),[F,re]=a.useState(()=>{const e=window.innerWidth;return e<z?e*.8:560}),h=a.useRef(null),x=a.useRef(null),oe=e=>{e.preventDefault(),y(!w)},G=a.useMemo(()=>{var e;return(e=n.show)!=null?e:w},[n.show,w]),b=a.useCallback(()=>{var e;k&&k(),D([]),y(!1),h.current&&((e=h.current.element)==null||e.focus())},[k]),ne=(e,r)=>{var s;if(t.sortable&&e){const o=Array.isArray(e)?e:[e];if(o.length===0)t.sortChange([],r);else{const u=((s=t.sort)!=null?s:[]).filter(i=>!o.some(T=>T.field===i.field));u.push(...o),t.sortChange(u,r)}}},se=(e,r)=>{if(!e)return;const s=xe.combineSmartFilters({logic:e.logic?e.logic:"and",filters:e.filters},t.filter);t.filterChange(s,r)},ie=(e,r)=>{var o;if(!e)return;const s=Array.isArray(e)?e:[e];if(s.length===0)t.groupChange([],r);else{const u=((o=t.group)!=null?o:[]).filter(i=>!s.some(T=>T.field===i.field));u.push(...s),t.groupChange(u,r)}},le=(e,r,s)=>{const o=[d.toLanguageString(c.aIResponseData,c.messages[c.aIResponseData])],l=Pe([e],t.columnsRef).join(`
|
|
9
|
+
`);D([{id:R.length+1,title:d.toLanguageString(c.generatedWithAI,c.messages[c.generatedWithAI]),subTitle:r,prompt:r,responseContent:o.concat(l).join(""),isRetry:s},...R])},ae=(e,r,s)=>{const o=t.columnsRef.findIndex(l=>l.id===e);t.reorderable&&t.columnReorder(o,r,s)},I=(e,r)=>{const s=t.columnsState.findIndex(l=>l.id===e),o=t.columnsState.map(l=>l.id===e?{...l,hidden:r}:l);s!==-1&&t.onColumnsStateChange(o)},L=(e,r)=>{const s=t.columnsRef.findIndex(l=>l.id===e),o=t.columnsState.map(l=>l.id===e?{...l,locked:r}:l);s!==-1&&t.onColumnsStateChange(o)},ue=(e,r,s)=>{const o=t.columnsRef.findIndex(i=>i.id===e),l=t.columnsState[o],u=t.columnsState.map(i=>i.id===e?{...i,width:parseFloat(r)}:i);o!==-1&&t.onResize(o,parseFloat(r),parseFloat(l.width)||0,s,!0,u,e)},ce=(e,r,s)=>{var o,l,u;C(!1),S(!1),(o=e==null?void 0:e.data)==null||o.commands.forEach(i=>{switch(i.type){case"GridSort":ne(i.sort,e);break;case"GridFilter":se(i.filter,e);break;case"GridHighlight":t.applyHighlightDescriptor([i.highlight]);break;case"GridGroup":ie(i.group,e);break;case"GridClearFilter":t.filterChange(void 0);break;case"GridClearGroup":t.groupChange([],e);break;case"GridClearHighlight":t.applyHighlightDescriptor([]);break;case"GridClearSort":t.sortChange(void 0);break;case"GridSelect":t.applySelectionDescriptor([i.select]);break;case"GridClearSelect":t.applySelectionDescriptor([]);break;case"GridExportPDF":t.exportAsPdf();break;case"GridColumnResize":ue(i.id,i.size,e);break;case"GridColumnHide":I(i.id,!0);break;case"GridColumnShow":I(i.id,!1);break;case"GridColumnReorder":ae(i.id,i.position,e);break;case"GridColumnLock":L(i.id,!0);break;case"GridColumnUnlock":L(i.id,!1);break}}),(u=(l=e==null?void 0:e.data)==null?void 0:l.commands)!=null&&u.length||le(e.data.message,r,s),v&&v(e,r,s)},de=e=>{m==null||m(e),C(!1),S(!1)},pe=(e,r)=>{const s=E.CancelToken.source(),o={role:B||"user",columns:Y||[],headers:{Accept:"*/*","Content-Type":"application/json"},promptMessage:e,requestOptions:{url:f,method:"POST",withCredentials:!1,responseType:"json",cancelToken:s.token,...g}};if(P&&P(o,r),o.requestOptions.url!==void 0){C(!0),S(!0);const{url:l,...u}=o.requestOptions;E(l,{...u,headers:o.headers,data:{columns:o.columns,contents:[{text:o.promptMessage}]},responseType:"json"}).then(i=>ce(i,o.promptMessage,r)).catch(de),x.current=s}},ge=a.useCallback(()=>{x.current&&x.current.cancel("Request cancelled by user."),C(!1),S(!1)},[]),[fe,A]=H.useCustomComponent(M),he=Object.keys(A).length>0?A:{},Ce=a.createElement(fe,{onPromptRequest:pe,onCancel:ge,onClose:b,streaming:K||$,loading:q||J,outputs:V||R,promptPlaceHolder:U,suggestionsList:_,enableSpeechToText:X,...he}),Se=a.createElement(me.Button,{ref:h,togglable:!0,themeColor:"primary",rounded:"full",selected:G,svgIcon:N||(O?void 0:ke.sparklesIcon),icon:O,size:t.mobileMode?"large":"medium",className:H.classNames("k-toolbar-button",{"k-icon-button":t.mobileMode}),title:d.toLanguageString(c.toolbarAI,c.messages[c.toolbarAI]),onClick:oe});return a.useEffect(()=>{var e;if(h.current&&G){const r=(e=h.current.element)==null?void 0:e.getBoundingClientRect();if(r){Z(r.top+window.scrollY+r.height),te(r.left+window.scrollX+r.width);const s=window.innerWidth,o=s<z?s*.75:560;re(o)}}},[G]),a.useImperativeHandle(p,()=>({show:()=>y(!0),hide:()=>b()}),[b]),a.createElement(a.Fragment,null,Se,G&&a.createElement(we.Window,{key:F,autoFocus:!1,title:d.toLanguageString(c.toolbarAI,c.messages[c.toolbarAI]),initialTop:Q,initialLeft:ee,initialWidth:F,style:{height:"auto",minWidth:"90px",minHeight:"50px"},onClose:b,resizable:!0,draggable:!0,className:"k-grid-assistant-window",maximizeButton:ve},Ce))});j.displayName="KendoReactGridToolbarAIAssistant";exports.GridAICommands=W;exports.GridToolbarAIAssistant=j;
|
|
@@ -6,121 +6,125 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as a from "react";
|
|
9
|
-
import { GridContext as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { sparklesIcon as
|
|
12
|
-
import
|
|
13
|
-
import { useLocalization as
|
|
14
|
-
import { toolbarAI as S, messages as G, aIResponseData as
|
|
15
|
-
import { useCustomComponent as
|
|
16
|
-
import { Window as
|
|
17
|
-
import { GridAIPrompt as
|
|
18
|
-
import { combineSmartFilters as
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
import { GridContext as Se } from "../utils/GridContext.mjs";
|
|
10
|
+
import { Button as Ge } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { sparklesIcon as be } from "@progress/kendo-svg-icons";
|
|
12
|
+
import W from "axios";
|
|
13
|
+
import { useLocalization as ke } from "@progress/kendo-react-intl";
|
|
14
|
+
import { toolbarAI as S, messages as G, aIResponseData as B, generatedWithAI as M } from "../messages/index.mjs";
|
|
15
|
+
import { useCustomComponent as Re, classNames as we } from "@progress/kendo-react-common";
|
|
16
|
+
import { Window as xe } from "@progress/kendo-react-dialogs";
|
|
17
|
+
import { GridAIPrompt as ye } from "./ai-tool/GridAIPrompt.mjs";
|
|
18
|
+
import { combineSmartFilters as Te } from "../filterCommon.mjs";
|
|
19
|
+
const j = 768;
|
|
20
|
+
var Pe = /* @__PURE__ */ ((i) => (i.GridClearFilter = "GridClearFilter", i.GridClearSort = "GridClearSort", i.GridClearGroup = "GridClearGroup", i.GridClearHighlight = "GridClearHighlight", i.GridClearSelect = "GridClearSelect", i.GridSort = "GridSort", i.GridFilter = "GridFilter", i.GridGroup = "GridGroup", i.GridHighlight = "GridHighlight", i.GridSelect = "GridSelect", i.GridExportPDF = "GridExportPDF", i.GridColumnResize = "GridColumnResize", i.GridColumnHide = "GridColumnHide", i.GridColumnShow = "GridColumnShow", i.GridColumnReorder = "GridColumnReorder", i.GridColumnLock = "GridColumnLock", i.GridColumnUnlock = "GridColumnUnlock", i))(Pe || {});
|
|
21
|
+
const ve = (i, b) => i.map((d) => {
|
|
21
22
|
let p = d;
|
|
22
|
-
return
|
|
23
|
+
return b.forEach((c) => {
|
|
23
24
|
c.field && p.includes(c.field) && (p = p.replace(new RegExp(c.field, "g"), c.title || c.field));
|
|
24
25
|
}), p;
|
|
25
|
-
}),
|
|
26
|
-
(
|
|
27
|
-
const t = a.useContext(
|
|
26
|
+
}), Fe = () => null, Le = a.forwardRef(
|
|
27
|
+
(i, b) => {
|
|
28
|
+
const t = a.useContext(Se), d = ke(), {
|
|
28
29
|
requestUrl: p,
|
|
29
30
|
requestOptions: c,
|
|
30
31
|
onPromptRequest: v,
|
|
31
|
-
onResponseSuccess:
|
|
32
|
-
onResponseError:
|
|
33
|
-
role:
|
|
34
|
-
gridAIPrompt:
|
|
35
|
-
icon:
|
|
36
|
-
svgIcon:
|
|
37
|
-
onCloseWindow:
|
|
38
|
-
promptPlaceHolder:
|
|
39
|
-
suggestionsList:
|
|
40
|
-
streaming:
|
|
41
|
-
loading:
|
|
42
|
-
outputs:
|
|
43
|
-
enableSpeechToText:
|
|
44
|
-
} =
|
|
32
|
+
onResponseSuccess: F,
|
|
33
|
+
onResponseError: k,
|
|
34
|
+
role: A = "user",
|
|
35
|
+
gridAIPrompt: I = ye,
|
|
36
|
+
icon: L,
|
|
37
|
+
svgIcon: N,
|
|
38
|
+
onCloseWindow: R,
|
|
39
|
+
promptPlaceHolder: U,
|
|
40
|
+
suggestionsList: K,
|
|
41
|
+
streaming: V,
|
|
42
|
+
loading: X,
|
|
43
|
+
outputs: Y,
|
|
44
|
+
enableSpeechToText: _
|
|
45
|
+
} = i, [w, E] = a.useState([]), $ = a.useMemo(() => t && Array.isArray(t.columnsRef) && Array.isArray(t.hiddenColumnsRef) ? [...t.columnsRef, ...t.hiddenColumnsRef].map((e) => {
|
|
45
46
|
var r;
|
|
46
47
|
return {
|
|
47
48
|
id: e.id,
|
|
48
49
|
field: e.field,
|
|
49
50
|
values: (r = e.values) != null ? r : []
|
|
50
51
|
};
|
|
51
|
-
}) : [], [t]), [
|
|
52
|
-
e.
|
|
53
|
-
|
|
52
|
+
}) : [], [t]), [J, g] = a.useState(!1), [Q, h] = a.useState(!1), [x, y] = a.useState(!1), [Z, q] = a.useState(), [ee, te] = a.useState(), [H, re] = a.useState(() => {
|
|
53
|
+
const e = window.innerWidth;
|
|
54
|
+
return e < j ? e * 0.8 : 560;
|
|
55
|
+
}), f = a.useRef(null), T = a.useRef(null), oe = (e) => {
|
|
56
|
+
e.preventDefault(), y(!x);
|
|
57
|
+
}, C = a.useMemo(() => {
|
|
54
58
|
var e;
|
|
55
|
-
return (e =
|
|
56
|
-
}, [
|
|
59
|
+
return (e = i.show) != null ? e : x;
|
|
60
|
+
}, [i.show, x]), m = a.useCallback(() => {
|
|
57
61
|
var e;
|
|
58
|
-
|
|
59
|
-
}, [
|
|
60
|
-
var
|
|
62
|
+
R && R(), E([]), y(!1), f.current && ((e = f.current.element) == null || e.focus());
|
|
63
|
+
}, [R]), ne = (e, r) => {
|
|
64
|
+
var n;
|
|
61
65
|
if (t.sortable && e) {
|
|
62
66
|
const o = Array.isArray(e) ? e : [e];
|
|
63
67
|
if (o.length === 0)
|
|
64
68
|
t.sortChange([], r);
|
|
65
69
|
else {
|
|
66
|
-
const u = ((
|
|
67
|
-
(s) => !o.some((
|
|
70
|
+
const u = ((n = t.sort) != null ? n : []).filter(
|
|
71
|
+
(s) => !o.some((P) => P.field === s.field)
|
|
68
72
|
);
|
|
69
73
|
u.push(...o), t.sortChange(u, r);
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
|
-
},
|
|
76
|
+
}, se = (e, r) => {
|
|
73
77
|
if (!e)
|
|
74
78
|
return;
|
|
75
|
-
const
|
|
79
|
+
const n = Te(
|
|
76
80
|
{
|
|
77
81
|
logic: e.logic ? e.logic : "and",
|
|
78
82
|
filters: e.filters
|
|
79
83
|
},
|
|
80
84
|
t.filter
|
|
81
85
|
);
|
|
82
|
-
t.filterChange(
|
|
83
|
-
},
|
|
86
|
+
t.filterChange(n, r);
|
|
87
|
+
}, ie = (e, r) => {
|
|
84
88
|
var o;
|
|
85
89
|
if (!e)
|
|
86
90
|
return;
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
91
|
+
const n = Array.isArray(e) ? e : [e];
|
|
92
|
+
if (n.length === 0)
|
|
89
93
|
t.groupChange([], r);
|
|
90
94
|
else {
|
|
91
95
|
const u = ((o = t.group) != null ? o : []).filter(
|
|
92
|
-
(s) => !
|
|
96
|
+
(s) => !n.some((P) => P.field === s.field)
|
|
93
97
|
);
|
|
94
|
-
u.push(...
|
|
98
|
+
u.push(...n), t.groupChange(u, r);
|
|
95
99
|
}
|
|
96
|
-
},
|
|
97
|
-
const o = [d.toLanguageString(
|
|
100
|
+
}, le = (e, r, n) => {
|
|
101
|
+
const o = [d.toLanguageString(B, G[B])], l = ve([e], t.columnsRef).join(`
|
|
98
102
|
`);
|
|
99
|
-
|
|
103
|
+
E([
|
|
100
104
|
{
|
|
101
|
-
id:
|
|
102
|
-
title: d.toLanguageString(
|
|
105
|
+
id: w.length + 1,
|
|
106
|
+
title: d.toLanguageString(M, G[M]),
|
|
103
107
|
subTitle: r,
|
|
104
108
|
prompt: r,
|
|
105
109
|
responseContent: o.concat(l).join(""),
|
|
106
|
-
isRetry:
|
|
110
|
+
isRetry: n
|
|
107
111
|
},
|
|
108
|
-
...
|
|
112
|
+
...w
|
|
109
113
|
]);
|
|
110
|
-
},
|
|
114
|
+
}, ae = (e, r, n) => {
|
|
111
115
|
const o = t.columnsRef.findIndex((l) => l.id === e);
|
|
112
|
-
t.reorderable && t.columnReorder(o, r,
|
|
113
|
-
},
|
|
114
|
-
const
|
|
116
|
+
t.reorderable && t.columnReorder(o, r, n);
|
|
117
|
+
}, z = (e, r) => {
|
|
118
|
+
const n = t.columnsState.findIndex((l) => l.id === e), o = t.columnsState.map(
|
|
115
119
|
(l) => l.id === e ? { ...l, hidden: r } : l
|
|
116
120
|
);
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
const
|
|
121
|
+
n !== -1 && t.onColumnsStateChange(o);
|
|
122
|
+
}, D = (e, r) => {
|
|
123
|
+
const n = t.columnsRef.findIndex((l) => l.id === e), o = t.columnsState.map(
|
|
120
124
|
(l) => l.id === e ? { ...l, locked: r } : l
|
|
121
125
|
);
|
|
122
|
-
|
|
123
|
-
},
|
|
126
|
+
n !== -1 && t.onColumnsStateChange(o);
|
|
127
|
+
}, ue = (e, r, n) => {
|
|
124
128
|
const o = t.columnsRef.findIndex((s) => s.id === e), l = t.columnsState[o], u = t.columnsState.map(
|
|
125
129
|
(s) => s.id === e ? { ...s, width: parseFloat(r) } : s
|
|
126
130
|
);
|
|
@@ -131,7 +135,7 @@ const we = (n, m) => n.map((d) => {
|
|
|
131
135
|
// newWidth: 200
|
|
132
136
|
parseFloat(l.width) || 0,
|
|
133
137
|
// oldWidth: current width
|
|
134
|
-
|
|
138
|
+
n,
|
|
135
139
|
// nativeEvent: mock event
|
|
136
140
|
!0,
|
|
137
141
|
// end: true (resize is complete)
|
|
@@ -140,21 +144,21 @@ const we = (n, m) => n.map((d) => {
|
|
|
140
144
|
e
|
|
141
145
|
// targetId: column ID
|
|
142
146
|
);
|
|
143
|
-
},
|
|
147
|
+
}, ce = (e, r, n) => {
|
|
144
148
|
var o, l, u;
|
|
145
|
-
g(!1), (o = e == null ? void 0 : e.data) == null || o.commands.forEach((s) => {
|
|
149
|
+
g(!1), h(!1), (o = e == null ? void 0 : e.data) == null || o.commands.forEach((s) => {
|
|
146
150
|
switch (s.type) {
|
|
147
151
|
case "GridSort":
|
|
148
|
-
|
|
152
|
+
ne(s.sort, e);
|
|
149
153
|
break;
|
|
150
154
|
case "GridFilter":
|
|
151
|
-
|
|
155
|
+
se(s.filter, e);
|
|
152
156
|
break;
|
|
153
157
|
case "GridHighlight":
|
|
154
158
|
t.applyHighlightDescriptor([s.highlight]);
|
|
155
159
|
break;
|
|
156
160
|
case "GridGroup":
|
|
157
|
-
|
|
161
|
+
ie(s.group, e);
|
|
158
162
|
break;
|
|
159
163
|
case "GridClearFilter":
|
|
160
164
|
t.filterChange(void 0);
|
|
@@ -178,31 +182,31 @@ const we = (n, m) => n.map((d) => {
|
|
|
178
182
|
t.exportAsPdf();
|
|
179
183
|
break;
|
|
180
184
|
case "GridColumnResize":
|
|
181
|
-
|
|
185
|
+
ue(s.id, s.size, e);
|
|
182
186
|
break;
|
|
183
187
|
case "GridColumnHide":
|
|
184
|
-
|
|
188
|
+
z(s.id, !0);
|
|
185
189
|
break;
|
|
186
190
|
case "GridColumnShow":
|
|
187
|
-
|
|
191
|
+
z(s.id, !1);
|
|
188
192
|
break;
|
|
189
193
|
case "GridColumnReorder":
|
|
190
|
-
|
|
194
|
+
ae(s.id, s.position, e);
|
|
191
195
|
break;
|
|
192
196
|
case "GridColumnLock":
|
|
193
|
-
|
|
197
|
+
D(s.id, !0);
|
|
194
198
|
break;
|
|
195
199
|
case "GridColumnUnlock":
|
|
196
|
-
|
|
200
|
+
D(s.id, !1);
|
|
197
201
|
break;
|
|
198
202
|
}
|
|
199
|
-
}), (u = (l = e == null ? void 0 : e.data) == null ? void 0 : l.commands) != null && u.length ||
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
},
|
|
203
|
-
const
|
|
204
|
-
role:
|
|
205
|
-
columns:
|
|
203
|
+
}), (u = (l = e == null ? void 0 : e.data) == null ? void 0 : l.commands) != null && u.length || le(e.data.message, r, n), F && F(e, r, n);
|
|
204
|
+
}, de = (e) => {
|
|
205
|
+
k == null || k(e), g(!1), h(!1);
|
|
206
|
+
}, pe = (e, r) => {
|
|
207
|
+
const n = W.CancelToken.source(), o = {
|
|
208
|
+
role: A || "user",
|
|
209
|
+
columns: $ || [],
|
|
206
210
|
headers: {
|
|
207
211
|
Accept: "*/*",
|
|
208
212
|
"Content-Type": "application/json"
|
|
@@ -213,14 +217,14 @@ const we = (n, m) => n.map((d) => {
|
|
|
213
217
|
method: "POST",
|
|
214
218
|
withCredentials: !1,
|
|
215
219
|
responseType: "json",
|
|
216
|
-
cancelToken:
|
|
220
|
+
cancelToken: n.token,
|
|
217
221
|
...c
|
|
218
222
|
}
|
|
219
223
|
};
|
|
220
224
|
if (v && v(o, r), o.requestOptions.url !== void 0) {
|
|
221
|
-
g(!0);
|
|
225
|
+
g(!0), h(!0);
|
|
222
226
|
const { url: l, ...u } = o.requestOptions;
|
|
223
|
-
|
|
227
|
+
W(l, {
|
|
224
228
|
...u,
|
|
225
229
|
headers: o.headers,
|
|
226
230
|
data: {
|
|
@@ -229,79 +233,85 @@ const we = (n, m) => n.map((d) => {
|
|
|
229
233
|
},
|
|
230
234
|
responseType: "json"
|
|
231
235
|
// Ensure correct type
|
|
232
|
-
}).then((s) =>
|
|
236
|
+
}).then((s) => ce(s, o.promptMessage, r)).catch(de), T.current = n;
|
|
233
237
|
}
|
|
234
|
-
},
|
|
235
|
-
|
|
236
|
-
}, []), [
|
|
237
|
-
|
|
238
|
-
),
|
|
239
|
-
|
|
238
|
+
}, fe = a.useCallback(() => {
|
|
239
|
+
T.current && T.current.cancel("Request cancelled by user."), g(!1), h(!1);
|
|
240
|
+
}, []), [ge, O] = Re(
|
|
241
|
+
I
|
|
242
|
+
), he = Object.keys(O).length > 0 ? O : {}, Ce = /* @__PURE__ */ a.createElement(
|
|
243
|
+
ge,
|
|
240
244
|
{
|
|
241
|
-
onPromptRequest:
|
|
242
|
-
onCancel:
|
|
243
|
-
onClose:
|
|
244
|
-
streaming:
|
|
245
|
-
loading:
|
|
246
|
-
outputs:
|
|
247
|
-
promptPlaceHolder:
|
|
248
|
-
suggestionsList:
|
|
249
|
-
enableSpeechToText:
|
|
250
|
-
...
|
|
245
|
+
onPromptRequest: pe,
|
|
246
|
+
onCancel: fe,
|
|
247
|
+
onClose: m,
|
|
248
|
+
streaming: V || J,
|
|
249
|
+
loading: X || Q,
|
|
250
|
+
outputs: Y || w,
|
|
251
|
+
promptPlaceHolder: U,
|
|
252
|
+
suggestionsList: K,
|
|
253
|
+
enableSpeechToText: _,
|
|
254
|
+
...he
|
|
251
255
|
}
|
|
252
|
-
),
|
|
253
|
-
|
|
256
|
+
), me = /* @__PURE__ */ a.createElement(
|
|
257
|
+
Ge,
|
|
254
258
|
{
|
|
255
259
|
ref: f,
|
|
256
260
|
togglable: !0,
|
|
257
261
|
themeColor: "primary",
|
|
258
262
|
rounded: "full",
|
|
259
|
-
selected:
|
|
260
|
-
svgIcon:
|
|
261
|
-
icon:
|
|
263
|
+
selected: C,
|
|
264
|
+
svgIcon: N || (L ? void 0 : be),
|
|
265
|
+
icon: L,
|
|
262
266
|
size: t.mobileMode ? "large" : "medium",
|
|
263
|
-
className:
|
|
267
|
+
className: we("k-toolbar-button", { "k-icon-button": t.mobileMode }),
|
|
264
268
|
title: d.toLanguageString(S, G[S]),
|
|
265
|
-
onClick:
|
|
269
|
+
onClick: oe
|
|
266
270
|
}
|
|
267
271
|
);
|
|
268
272
|
return a.useEffect(() => {
|
|
269
273
|
var e;
|
|
270
|
-
if (f.current &&
|
|
274
|
+
if (f.current && C) {
|
|
271
275
|
const r = (e = f.current.element) == null ? void 0 : e.getBoundingClientRect();
|
|
272
|
-
|
|
276
|
+
if (r) {
|
|
277
|
+
q(r.top + window.scrollY + r.height), te(r.left + window.scrollX + r.width);
|
|
278
|
+
const n = window.innerWidth, o = n < j ? n * 0.75 : 560;
|
|
279
|
+
re(o);
|
|
280
|
+
}
|
|
273
281
|
}
|
|
274
|
-
}, [
|
|
275
|
-
|
|
282
|
+
}, [C]), a.useImperativeHandle(
|
|
283
|
+
b,
|
|
276
284
|
() => ({
|
|
277
|
-
show: () =>
|
|
278
|
-
hide: () =>
|
|
285
|
+
show: () => y(!0),
|
|
286
|
+
hide: () => m()
|
|
279
287
|
}),
|
|
280
|
-
[
|
|
281
|
-
), /* @__PURE__ */ a.createElement(a.Fragment, null,
|
|
282
|
-
|
|
288
|
+
[m]
|
|
289
|
+
), /* @__PURE__ */ a.createElement(a.Fragment, null, me, C && /* @__PURE__ */ a.createElement(
|
|
290
|
+
xe,
|
|
283
291
|
{
|
|
292
|
+
key: H,
|
|
284
293
|
autoFocus: !1,
|
|
285
294
|
title: d.toLanguageString(S, G[S]),
|
|
286
|
-
initialTop:
|
|
287
|
-
initialLeft:
|
|
288
|
-
initialWidth:
|
|
295
|
+
initialTop: Z,
|
|
296
|
+
initialLeft: ee,
|
|
297
|
+
initialWidth: H,
|
|
289
298
|
style: {
|
|
290
299
|
height: "auto",
|
|
291
300
|
minWidth: "90px",
|
|
292
301
|
minHeight: "50px"
|
|
293
302
|
},
|
|
294
|
-
onClose:
|
|
303
|
+
onClose: m,
|
|
295
304
|
resizable: !0,
|
|
296
305
|
draggable: !0,
|
|
297
|
-
className: "k-grid-assistant-window"
|
|
306
|
+
className: "k-grid-assistant-window",
|
|
307
|
+
maximizeButton: Fe
|
|
298
308
|
},
|
|
299
|
-
|
|
309
|
+
Ce
|
|
300
310
|
));
|
|
301
311
|
}
|
|
302
312
|
);
|
|
303
|
-
|
|
313
|
+
Le.displayName = "KendoReactGridToolbarAIAssistant";
|
|
304
314
|
export {
|
|
305
|
-
|
|
306
|
-
|
|
315
|
+
Pe as GridAICommands,
|
|
316
|
+
Le as GridToolbarAIAssistant
|
|
307
317
|
};
|
|
@@ -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
|
-
`);return r.createElement("div",{className:"k-card-body"},n.map((a,c)=>r.createElement("div",{key:a.trim()+c,className:"k-card-text"},a)))},T=t=>{const{activeView:o,onActiveViewChange:n,toolbarItems:a,outputs:c,promptValue:d,promptInput:g,generateButton:f,onCopy:b,onOutputRating:y,onPromptRequest:i,suggestionsList:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react"),s=require("@progress/kendo-react-conversational-ui"),R=require("@progress/kendo-react-buttons"),O=require("@progress/kendo-react-inputs"),D=require("@progress/kendo-svg-icons"),u=require("../../messages/index.js"),E=require("@progress/kendo-react-intl");function z(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=z(P),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)))},T=t=>{const{activeView:o,onActiveViewChange:n,toolbarItems:a,outputs:c,promptValue:d,promptInput:g,generateButton:f,onCopy:b,onOutputRating:y,onPromptRequest:i,suggestionsList:w,outputCard:A,promptPlaceHolder:I,streaming:v,loading:S,onCancel:V,onClose:l,enableSpeechToText:k}=t,p=E.useLocalization(),[C,m]=r.useState(s.promptViewDefaults.name),h=(e,B)=>{e&&(i&&i(e),m(s.outputViewDefaults.name))},q=e=>{n&&n(e),m(e)},x=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:q,onPromptRequest:h,toolbarItems:a||[s.promptViewDefaults,s.outputViewDefaults],streaming:v,loading:S,suggestionsView:"modern",onCancel:V,onKeyDown:x},r.createElement(s.AIPromptView,{promptSuggestions:w,promptValue:d,promptInput:g||r.createElement(O.TextArea,{flow:"vertical",resizable:"none",autoSize:!0,textareaStyle:{maxHeight:"110px"},placeholder:I,rows:2}),generateButton:f||r.createElement(R.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])),enableSpeechToText:k}),r.createElement(s.AIPromptOutputView,{outputs:c,showOutputRating:!0,onCopy:b,onOutputRating:y,outputCard:A||{body:j}}))};exports.GridAIPrompt=T;
|