@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
10 lines (9 loc) • 2.63 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
"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(`
`);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;