UNPKG

@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.51 kB
/** * @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 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(` `);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;