@progress/kendo-react-grid 14.2.2-develop.1 → 14.3.0-develop.10
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/GridClientContextReader.js +1 -1
- package/GridClientContextReader.mjs +10 -9
- package/GridClientWrapper.js +1 -1
- package/GridClientWrapper.mjs +651 -494
- package/GridComponent.js +1 -1
- package/GridComponent.mjs +418 -379
- package/GridState.d.ts +2 -0
- package/GridState.js +1 -1
- package/GridState.mjs +98 -90
- package/{toolbar-tools/smartbox/SegmentedControl.d.ts → cells/pincell/GridPinCell.d.ts} +4 -2
- package/cells/pincell/GridPinCell.js +9 -0
- package/cells/pincell/GridPinCell.mjs +19 -0
- package/cells/pincell/GridPinCellServer.d.ts +15 -0
- package/cells/pincell/GridPinCellServer.js +8 -0
- package/cells/pincell/GridPinCellServer.mjs +32 -0
- package/cells/pincell/GridPinCellServerContainer.d.ts +11 -0
- package/cells/pincell/GridPinCellServerContainer.js +9 -0
- package/cells/pincell/GridPinCellServerContainer.mjs +26 -0
- package/cells/pincell/GridPinDropdownButton.d.ts +21 -0
- package/cells/pincell/GridPinDropdownButton.js +9 -0
- package/cells/pincell/GridPinDropdownButton.mjs +58 -0
- package/cells/pincell/useGridPinCellClientTdProps.d.ts +24 -0
- package/cells/pincell/useGridPinCellClientTdProps.js +9 -0
- package/cells/pincell/useGridPinCellClientTdProps.mjs +21 -0
- package/cells/pincell/utils.d.ts +20 -0
- package/cells/pincell/utils.js +8 -0
- package/cells/pincell/utils.mjs +47 -0
- package/components/PinnedRowsTable.d.ts +48 -0
- package/components/PinnedRowsTable.js +9 -0
- package/components/PinnedRowsTable.mjs +133 -0
- package/components/StickyGroupTable.d.ts +42 -0
- package/components/StickyGroupTable.js +9 -0
- package/components/StickyGroupTable.mjs +82 -0
- package/components/colGroup/GridColGroup.js +1 -1
- package/components/colGroup/GridColGroup.mjs +9 -9
- package/contextMenu/GridContextMenu.d.ts +42 -0
- package/contextMenu/GridContextMenu.js +1 -1
- package/contextMenu/GridContextMenu.mjs +101 -51
- package/contextMenu/enums.d.ts +5 -1
- package/contextMenu/enums.js +1 -1
- package/contextMenu/enums.mjs +2 -2
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/drag/ColumnResize.d.ts +17 -0
- package/drag/ColumnResize.js +1 -1
- package/drag/ColumnResize.mjs +107 -100
- package/getRowContents.d.ts +58 -0
- package/getRowContents.js +8 -0
- package/getRowContents.mjs +99 -0
- package/header/GridHeaderGroupSpacerCell.d.ts +13 -0
- package/header/GridHeaderGroupSpacerCell.js +9 -0
- package/header/GridHeaderGroupSpacerCell.mjs +23 -0
- package/header/client/GridHeaderPinCell.d.ts +12 -0
- package/header/client/GridHeaderPinCell.js +9 -0
- package/header/client/GridHeaderPinCell.mjs +14 -0
- package/hooks/useStickyGroups.d.ts +71 -0
- package/hooks/useStickyGroups.js +9 -0
- package/hooks/useStickyGroups.mjs +350 -0
- package/index.d.mts +5 -2
- package/index.d.ts +5 -2
- package/index.js +1 -1
- package/index.mjs +97 -95
- package/interfaces/ColumnType.d.ts +1 -1
- package/interfaces/GridCellsSettings.d.ts +23 -0
- package/interfaces/GridGroupableSettings.d.ts +23 -0
- package/interfaces/GridProps.d.ts +70 -1
- package/interfaces/GridRowProps.d.ts +4 -0
- package/interfaces/GridRowsSettings.d.ts +11 -0
- package/interfaces/events.d.ts +17 -0
- package/messages/index.d.ts +25 -0
- package/messages/index.js +2 -2
- package/messages/index.mjs +122 -112
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +17 -17
- package/rows/GridRow.js +1 -1
- package/rows/GridRow.mjs +25 -24
- package/rows/GridRowRenderer.d.ts +1 -0
- package/rows/GridRowRenderer.js +1 -1
- package/rows/GridRowRenderer.mjs +39 -36
- package/stacked/GridStackedRow.d.ts +5 -0
- package/stacked/GridStackedRow.js +1 -1
- package/stacked/GridStackedRow.mjs +118 -116
- package/stacked/StackedModeComponents.d.ts +1 -0
- package/stacked/StackedModeComponents.js +1 -1
- package/stacked/StackedModeComponents.mjs +14 -14
- package/stacked/StackedModeRow.d.ts +1 -0
- package/stacked/StackedModeRow.js +1 -1
- package/stacked/StackedModeRow.mjs +13 -11
- package/toolbar-tools/smartbox/SmartBox.js +1 -1
- package/toolbar-tools/smartbox/SmartBox.mjs +102 -94
- package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.d.ts +12 -3
- package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.js +1 -1
- package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.mjs +42 -41
- package/toolbar-tools/smartbox/index.d.ts +0 -1
- package/toolbar-tools/smartbox/interfaces/index.d.ts +0 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -1
- package/utils/index.mjs +44 -44
- package/toolbar-tools/smartbox/SegmentedControl.js +0 -8
- package/toolbar-tools/smartbox/SegmentedControl.mjs +0 -109
- package/toolbar-tools/smartbox/interfaces/SegmentedControlTypes.d.ts +0 -66
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),L=require("../cells/groupcell/GridGroupCellToggle.js"),V=require("../rows/GridRow.js"),z=require("./GridStackedRow.js");function H(e){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const u=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(c,s,u.get?u:{enumerable:!0,get:()=>e[s]})}}return c.default=e,Object.freeze(c)}const t=H(B),U=({item:e,rowId:c,dataIndex:s,idPrefix:u,ariaRowIndex:f,absoluteRowIndex:y,isAltRow:k,isHidden:h,isRowReorderable:j,rowHeight:O,rows:R,leafColumns:p,groupLevelCount:b,stackedLayoutSettings:w,cells:F,editMode:x,isSelected:S,isHighlighted:D,isInEdit:v,preparedCells:M,showDetailToggle:_,isDetailExpanded:q,detailExpandField:A,isPinned:I})=>{var C,G,$;if(e.rowType==="data")return t.createElement(z.GridStackedRow,{key:c,dataItem:e.dataItem,columns:p,stackedLayoutSettings:w,isAltRow:k,isSelected:S,isInEdit:v,cells:F,dataIndex:s,idPrefix:u,ariaRowIndex:f,absoluteRowIndex:y,groupLevel:b,preparedCells:M,editMode:x,showDetailToggle:_,isDetailExpanded:q,detailExpandField:A,isPinned:I});const P=b+1,E=e.level||0,T=Math.max(1,P-E),N=Array.from({length:E},(d,r)=>t.createElement("td",{key:`group-cell-${c}-${r}`,className:"k-table-group-td k-group-cell k-table-td"}));let m;if(e.rowType==="groupHeader"){const d=(C=e.dataItem)==null?void 0:C.field,r=(G=e.dataItem)==null?void 0:G.value,g=d!==void 0?(()=>{const l=String(d),n=p.find(o=>o.field===l),i=n==null?void 0:n.title;return typeof i=="string"&&i.length?i:l})():void 0;let a="";if(d!==void 0){let l;r instanceof Date?l=r.toString():l=String(r),a=`${g}: ${l}`}else r instanceof Date?a=r.toString():r!==void 0&&(a=String(r));m=t.createElement(t.Fragment,null,N,t.createElement("td",{className:"k-table-td",colSpan:T,role:"gridcell","aria-expanded":e.expanded},t.createElement("p",{className:"k-reset"},t.createElement(L.GridGroupCellToggle,{id:"",dataItem:e.dataItem,dataIndex:e.dataIndex,field:"value",expanded:e.expanded,group:e.group,columnPosition:{},ariaColumnIndex:1,isSelected:!1}),t.createElement("span",{className:"k-value"},a))))}else{const d=p.filter(a=>{const l=!!a._type,n=a.isAccessible===!1;return!a.hidden&&!l&&!n&&(a.columnType==="data"||a.columnType===void 0)}),r=($=e.dataItem)==null?void 0:$.aggregates,g=d.map(a=>{const l=a.field;if(!l||!r)return null;const n=r[l];if(!n||typeof n!="object")return null;const i=Object.keys(n).filter(o=>n[o]!==void 0&&n[o]!==null).map(o=>`${o.length?`${o.charAt(0).toUpperCase()}${o.slice(1)}`:o}: ${String(n[o])}`);return i.length===0?null:t.createElement("div",{key:`agg-${c}-${l}`,className:"k-grid-template-column"},t.createElement("p",{className:"k-grid-template-column-header"},a.title||l),t.createElement("p",{className:"k-reset"},i.join(", ")))}).filter(Boolean);if(e.rowType==="groupFooter"&&g.length===0)return t.createElement(t.Fragment,{key:c});m=t.createElement(t.Fragment,null,N,t.createElement("td",{className:"k-table-td",colSpan:T},t.createElement("div",{className:"k-grid-column-template"},g)))}return t.createElement(V.GridRow,{key:c,dataItem:e.dataItem,isAltRow:k,isInEdit:v,rowType:e.rowType,isRowReorderable:j,isHidden:h,onClick:null,onDoubleClick:null,rowHeight:O,ariaRowIndex:f,absoluteRowIndex:y,dataIndex:s,isSelected:S,isHighlighted:D,rows:R},m)};exports.StackedModeRow=U;
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as e from "react";
|
|
9
|
-
import { GridGroupCellToggle as
|
|
10
|
-
import { GridRow as
|
|
11
|
-
import { GridStackedRow as
|
|
12
|
-
const
|
|
9
|
+
import { GridGroupCellToggle as H } from "../cells/groupcell/GridGroupCellToggle.mjs";
|
|
10
|
+
import { GridRow as O } from "../rows/GridRow.mjs";
|
|
11
|
+
import { GridStackedRow as P } from "./GridStackedRow.mjs";
|
|
12
|
+
const K = ({
|
|
13
13
|
item: t,
|
|
14
14
|
rowId: d,
|
|
15
15
|
dataIndex: m,
|
|
@@ -32,12 +32,13 @@ const J = ({
|
|
|
32
32
|
preparedCells: w,
|
|
33
33
|
showDetailToggle: B,
|
|
34
34
|
isDetailExpanded: L,
|
|
35
|
-
detailExpandField: M
|
|
35
|
+
detailExpandField: M,
|
|
36
|
+
isPinned: V
|
|
36
37
|
}) => {
|
|
37
38
|
var T, $, C;
|
|
38
39
|
if (t.rowType === "data")
|
|
39
40
|
return /* @__PURE__ */ e.createElement(
|
|
40
|
-
|
|
41
|
+
P,
|
|
41
42
|
{
|
|
42
43
|
key: d,
|
|
43
44
|
dataItem: t.dataItem,
|
|
@@ -56,10 +57,11 @@ const J = ({
|
|
|
56
57
|
editMode: D,
|
|
57
58
|
showDetailToggle: B,
|
|
58
59
|
isDetailExpanded: L,
|
|
59
|
-
detailExpandField: M
|
|
60
|
+
detailExpandField: M,
|
|
61
|
+
isPinned: V
|
|
60
62
|
}
|
|
61
63
|
);
|
|
62
|
-
const
|
|
64
|
+
const _ = y + 1, S = t.level || 0, b = Math.max(1, _ - S), N = Array.from({ length: S }, (c, r) => /* @__PURE__ */ e.createElement("td", { key: `group-cell-${d}-${r}`, className: "k-table-group-td k-group-cell k-table-td" }));
|
|
63
65
|
let g;
|
|
64
66
|
if (t.rowType === "groupHeader") {
|
|
65
67
|
const c = (T = t.dataItem) == null ? void 0 : T.field, r = ($ = t.dataItem) == null ? void 0 : $.value, i = c !== void 0 ? (() => {
|
|
@@ -72,7 +74,7 @@ const J = ({
|
|
|
72
74
|
r instanceof Date ? l = r.toString() : l = String(r), a = `${i}: ${l}`;
|
|
73
75
|
} else r instanceof Date ? a = r.toString() : r !== void 0 && (a = String(r));
|
|
74
76
|
g = /* @__PURE__ */ e.createElement(e.Fragment, null, N, /* @__PURE__ */ e.createElement("td", { className: "k-table-td", colSpan: b, role: "gridcell", "aria-expanded": t.expanded }, /* @__PURE__ */ e.createElement("p", { className: "k-reset" }, /* @__PURE__ */ e.createElement(
|
|
75
|
-
|
|
77
|
+
H,
|
|
76
78
|
{
|
|
77
79
|
id: "",
|
|
78
80
|
dataItem: t.dataItem,
|
|
@@ -104,7 +106,7 @@ const J = ({
|
|
|
104
106
|
g = /* @__PURE__ */ e.createElement(e.Fragment, null, N, /* @__PURE__ */ e.createElement("td", { className: "k-table-td", colSpan: b }, /* @__PURE__ */ e.createElement("div", { className: "k-grid-column-template" }, i)));
|
|
105
107
|
}
|
|
106
108
|
return /* @__PURE__ */ e.createElement(
|
|
107
|
-
|
|
109
|
+
O,
|
|
108
110
|
{
|
|
109
111
|
key: d,
|
|
110
112
|
dataItem: t.dataItem,
|
|
@@ -127,5 +129,5 @@ const J = ({
|
|
|
127
129
|
);
|
|
128
130
|
};
|
|
129
131
|
export {
|
|
130
|
-
|
|
132
|
+
K as StackedModeRow
|
|
131
133
|
};
|
|
@@ -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 Ze=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ze=require("react"),M=require("@progress/kendo-react-buttons"),_=require("@progress/kendo-svg-icons"),d=require("@progress/kendo-react-common"),et=require("@progress/kendo-react-intl"),A=require("@progress/kendo-react-dropdowns"),tt=require("@progress/kendo-react-popup"),R=require("./listItemRenders.js"),o=require("../../messages/index.js"),nt=require("../../hooks/useGridAIRequest.js"),st=require("../../utils/GridContext.js"),rt=require("./hooks/useSmartBoxModes.js"),at=require("./hooks/useSmartBoxHistory.js"),ot=require("./hooks/useSmartBoxPopup.js"),ct=require("./hooks/useSmartBoxGridState.js"),it=require("./hooks/useSmartBoxLabels.js"),lt=require("./hooks/useSmartBoxListData.js"),ut=require("./hooks/useSmartBoxSegmentedControl.js"),pt=require("./hooks/useSmartBoxSearch.js"),dt=require("./hooks/useDebounce.js");function mt(m){const x=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const f in m)if(f!=="default"){const I=Object.getOwnPropertyDescriptor(m,f);Object.defineProperty(x,f,I.get?I:{enumerable:!0,get:()=>m[f]})}}return x.default=m,Object.freeze(x)}const e=mt(Ze),ge=e.forwardRef((m,x)=>{var de;const{searchConfig:f,semanticSearchConfig:I,aiAssistantConfig:he,activeMode:fe,dir:Se="ltr",size:J="medium",placeholder:ke,history:xe,loading:be=!1,promptSuggestionRender:Q,historyItemRender:X,onOpen:Ce,onClose:Be,onFocus:v,onBlur:q,onSearch:Re,onSemanticSearch:Ie,onAIPromptRequest:N,onAIResponseSuccess:F,onAIResponseError:O,onAICancelRequest:w}=m,b=et.useLocalization(),C=e.useContext(st.GridContext),ve=e.useRef(`k-${d.guid()}`),S=e.useRef(null),B=e.useRef(null),Y=e.useRef(null),[c,g]=e.useState(""),[qe,D]=e.useState(!1),[we,Z]=e.useState(void 0),[De,ee]=e.useState(null),{searchMode:i,semanticSearchMode:u,aiAssistantMode:r,selectedView:n,setSelectedViewState:z,lastSearchMode:Pe,searchHistorySettings:te,semanticSearchHistorySettings:ne,aiAssistantHistorySettings:G,speechToTextButtonSettings:se,currentSearchDelay:ye}=rt.useSmartBoxModes({searchConfigProp:f,semanticSearchConfigProp:I,aiAssistantConfigProp:he,activeModeProp:fe,sharedHistory:xe}),{currentHistory:P,currentHistorySettings:Ee,addToHistory:V}=at.useSmartBoxHistory({selectedView:n,searchHistorySettings:te,semanticSearchHistorySettings:ne,aiAssistantHistorySettings:G}),{isOpen:W,togglePopup:a}=ot.useSmartBoxPopup({onOpen:Ce,onClose:Be}),{columns:re,gridState:Le,gridRef:Te,handleStateChange:He}=ct.useSmartBoxGridState(C),j=e.useMemo(()=>(r==null?void 0:r.promptSuggestions)||[],[r==null?void 0:r.promptSuggestions]),{inputPlaceholder:Ne,prefixIcon:Fe}=it.useSmartBoxLabels({selectedView:n,searchMode:i,semanticSearchMode:u,aiAssistantMode:r,sharedPlaceholder:ke}),{searchListData:k,aiAssistantListData:y,searchHistoryListData:E}=lt.useSmartBoxListData({selectedView:n,searchModeEnabled:i==null?void 0:i.enabled,semanticSearchModeEnabled:u==null?void 0:u.enabled,promptSuggestions:j,currentHistory:P,currentHistorySettings:Ee}),L=ut.useSmartBoxSegmentedControl({searchMode:i,semanticSearchMode:u,aiAssistantMode:r,selectedView:n,lastSearchMode:Pe,setSelectedViewState:z,setInputValue:g});e.useEffect(()=>{const t=S.current;if(!t)return;Z(t.offsetWidth);const s=new ResizeObserver(()=>{t&&Z(t.offsetWidth)});return s.observe(t),()=>{s.disconnect()}},[]);const h=be||qe,U=!n,Oe=!(i!=null&&i.enabled)&&!(u!=null&&u.enabled)&&!(r!=null&&r.enabled),ze=d.kendoThemeMaps.sizeMap[J]||"md",{emitSearchEvent:p}=pt.useSmartBoxSearch({selectedView:n,searchMode:i,columns:re,gridContext:C,searchHistorySettings:te,semanticSearchHistorySettings:ne,addToHistory:V,onSearch:Re,onSemanticSearch:Ie}),{sendRequest:ae,cancelRequest:oe}=nt.useGridAIRequest({requestUrl:r==null?void 0:r.requestUrl,requestOptions:r==null?void 0:r.requestOptions,columns:re,gridState:Le,gridRef:Te,onPromptRequest:t=>{N==null||N({requestData:t})},onResponseSuccess:t=>{D(!1),F==null||F({response:t})},onResponseError:t=>{D(!1),O==null||O({error:t})},onStateChange:He,onExportPdf:()=>C==null?void 0:C.exportAsPdf()});e.useImperativeHandle(x,()=>({show:()=>a(!0),hide:()=>a(!1)}),[a]);const $=dt.useDebounce(De,ye),ce=e.useRef(p);ce.current=p,e.useEffect(()=>{$!==null&&ce.current($)},[$]);const Ge=e.useCallback(t=>{const s=t.target.value;g(s),a(!s),(n==="search"||n==="semanticSearch")&&ee(s)},[a,n]),Ve=e.useCallback(()=>{v==null||v(),c||a(!0)},[v,a,c]),We=e.useCallback(t=>{var me;const s=S.current,l=(me=Y.current)==null?void 0:me.element,H=t.relatedTarget,Xe=H&&(s==null?void 0:s.contains(H)),Ye=H&&(l==null?void 0:l.contains(H));!Xe&&!Ye&&(q==null||q(),a(!1))},[q,a]),je=e.useCallback(()=>{c||a(!0)},[a,c]),ie=!!((de=r==null?void 0:r.requestOptions)!=null&&de.url||r!=null&&r.requestUrl),K=e.useCallback(()=>{if(h){w==null||w(),oe(),D(!1);return}c.trim()&&(ie&&D(!0),V("aiAssistant",c,G),a(!1),ae(c.trim()),g(""))},[h,c,G,a,V,ae,oe,ie,w]),Ue=e.useCallback(t=>{t.key==="Enter"&&(n==="aiAssistant"?K():n==="semanticSearch"&&p(c))},[n,c,p,K]),$e=e.useCallback(()=>{var t;a(!W),(t=B.current)==null||t.focus()},[W,a]),Ke=e.useCallback(t=>{var s;t.stopPropagation(),t.preventDefault(),g(""),(s=B.current)==null||s.focus(),a(!0),p("")},[a,p]),le=e.useCallback(t=>{var s;z(t),g(""),ee(null),(s=B.current)==null||s.focus()},[z]),T=e.useCallback(t=>{var s;g(t),a(!1),(s=B.current)==null||s.focus(),n!=="aiAssistant"&&p(t)},[n,a,p]),Me=e.useCallback(t=>{if(t.isFinal&&t.alternatives.length>0){const s=t.alternatives[0].transcript;g(l=>l?`${l} ${s}`:s)}},[]),_e=e.useMemo(()=>n==="aiAssistant"?P.length===0&&j.length===0:n==="search"||n==="semanticSearch"?P.length===0&&k.length===0:!1,[n,P.length,j.length,k.length]),ue=e.useCallback(t=>{const l=(n==="aiAssistant"?y:E)[t];l&&T(l.text)},[n,y,E,T]),Ae=e.useCallback(t=>{const s=k[t];s&&le(s.mode)},[k,le]),pe=e.useMemo(()=>R.createListItemRender({historyItemRender:X,promptSuggestionRender:Q,handleListItemClick:T}),[X,Q,T]),Je=W&&!Oe,Qe=()=>e.createElement(e.Fragment,null,L.items.length>0&&e.createElement(M.SegmentedControl,{items:L.items,value:L.value,onChange:L.onChange,size:J,layoutMode:"stretch"}),(n==="search"||n==="semanticSearch")&&k.length>0&&e.createElement(A.List,{data:k,textField:"text",descriptionField:"description",onClick:Ae,itemRender:R.searchModeItemRender,show:!0,wrapperCssClass:"k-list k-list-md"}),n==="aiAssistant"&&y.length>0&&e.createElement(A.List,{data:y,textField:"text",groupField:"group",svgIconField:"groupSvgIcon",descriptionField:"description",onClick:ue,itemRender:pe,groupHeaderItemRender:R.listGroupHeaderRender,showFirstGroupHeader:!0,show:!0,wrapperCssClass:"k-list k-list-md"}),(n==="search"||n==="semanticSearch")&&E.length>0&&e.createElement(A.List,{data:E,textField:"text",groupField:"group",svgIconField:"groupSvgIcon",descriptionField:"description",onClick:ue,itemRender:pe,groupHeaderItemRender:R.listGroupHeaderRender,showFirstGroupHeader:!0,show:!0,wrapperCssClass:"k-list k-list-md"}),_e&&e.createElement(R.NoDataRender,{selectedView:n}));return e.createElement("div",{ref:S,className:"k-smart-box-wrapper",dir:Se,onBlur:We},e.createElement("span",{className:d.classNames("k-smart-box","k-input",`k-input-${ze}`,{"k-loading":h})},!U&&e.createElement("span",{className:"k-input-prefix k-input-prefix-horizontal"},e.createElement(d.IconWrap,{className:d.classNames("k-icon",{"k-accent-icon":n==="aiAssistant"||n==="semanticSearch"}),icon:Fe.svgIcon,onClick:$e,onMouseDown:t=>{"preventDefault"in t&&t.preventDefault()}})),e.createElement("input",{ref:B,type:"text",className:d.classNames("k-input-inner",{"k-disabled":U}),id:ve.current,placeholder:Ne,value:c,disabled:U,onChange:Ge,onFocus:Ve,onClick:je,onKeyDown:Ue}),c.length>0&&(n==="search"||n==="semanticSearch")&&e.createElement("span",{className:"k-clear-value",title:b.toLanguageString(o.smartBoxClearTitle,o.messages[o.smartBoxClearTitle]),role:"button",tabIndex:-1,onClick:Ke,onMouseDown:t=>t.preventDefault()},e.createElement(d.IconWrap,{className:"k-icon",icon:_.xIcon})),n==="aiAssistant"&&e.createElement("span",{className:"k-input-suffix k-input-suffix-horizontal"},se&&e.createElement(M.SpeechToTextButton,{...se,"aria-label":b.toLanguageString(o.smartBoxSpeechToTextButton,o.messages[o.smartBoxSpeechToTextButton]),title:b.toLanguageString(o.smartBoxSpeechToTextButton,o.messages[o.smartBoxSpeechToTextButton]),onResult:Me}),e.createElement(M.Button,{className:d.classNames("k-smart-box-send",{"k-processing":h,"k-active":h}),type:"button",rounded:"full",size:"small",title:b.toLanguageString(o.smartBoxSubmitPromptButton,o.messages[o.smartBoxSubmitPromptButton]),"aria-label":b.toLanguageString(o.smartBoxSubmitPromptButton,o.messages[o.smartBoxSubmitPromptButton]),"aria-disabled":c.length===0,svgIcon:h?_.stopSmIcon:_.arrowUpOutlineIcon,disabled:c.length===0&&!h,onClick:K}))),e.createElement(tt.Popup,{ref:Y,anchor:S.current,show:Je,popupClass:"k-smart-box-popup",style:{width:we},anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},margin:{horizontal:0,vertical:2},onMouseDownOutside:t=>{const s=t.event.target;S.current&&!S.current.contains(s)&&a(!1)}},Qe()))});ge.displayName="KendoReactSmartBox";exports.SmartBox=ge;
|
|
@@ -6,17 +6,16 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as e from "react";
|
|
9
|
-
import {
|
|
10
|
-
import { SpeechToTextButton as tt, Button as nt } from "@progress/kendo-react-buttons";
|
|
9
|
+
import { SpeechToTextButton as et, Button as tt, SegmentedControl as nt } from "@progress/kendo-react-buttons";
|
|
11
10
|
import { xIcon as rt, stopSmIcon as st, arrowUpOutlineIcon as at } from "@progress/kendo-svg-icons";
|
|
12
11
|
import { guid as ot, kendoThemeMaps as it, classNames as B, IconWrap as ce } from "@progress/kendo-react-common";
|
|
13
12
|
import { useLocalization as lt } from "@progress/kendo-react-intl";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
13
|
+
import { List as $ } from "@progress/kendo-react-dropdowns";
|
|
14
|
+
import { Popup as ct } from "@progress/kendo-react-popup";
|
|
15
|
+
import { createListItemRender as ut, searchModeItemRender as pt, listGroupHeaderRender as ue, NoDataRender as mt } from "./listItemRenders.mjs";
|
|
16
|
+
import { smartBoxClearTitle as pe, messages as k, smartBoxSpeechToTextButton as P, smartBoxSubmitPromptButton as L } from "../../messages/index.mjs";
|
|
17
|
+
import { useGridAIRequest as dt } from "../../hooks/useGridAIRequest.mjs";
|
|
18
|
+
import { GridContext as ft } from "../../utils/GridContext.mjs";
|
|
20
19
|
import { useSmartBoxModes as ht } from "./hooks/useSmartBoxModes.mjs";
|
|
21
20
|
import { useSmartBoxHistory as gt } from "./hooks/useSmartBoxHistory.mjs";
|
|
22
21
|
import { useSmartBoxPopup as St } from "./hooks/useSmartBoxPopup.mjs";
|
|
@@ -25,8 +24,8 @@ import { useSmartBoxLabels as Ct } from "./hooks/useSmartBoxLabels.mjs";
|
|
|
25
24
|
import { useSmartBoxListData as bt } from "./hooks/useSmartBoxListData.mjs";
|
|
26
25
|
import { useSmartBoxSegmentedControl as xt } from "./hooks/useSmartBoxSegmentedControl.mjs";
|
|
27
26
|
import { useSmartBoxSearch as Rt } from "./hooks/useSmartBoxSearch.mjs";
|
|
28
|
-
import { useDebounce as
|
|
29
|
-
const
|
|
27
|
+
import { useDebounce as vt } from "./hooks/useDebounce.mjs";
|
|
28
|
+
const It = e.forwardRef((me, de) => {
|
|
30
29
|
var ie;
|
|
31
30
|
const {
|
|
32
31
|
searchConfig: fe,
|
|
@@ -34,32 +33,32 @@ const vt = e.forwardRef((me, de) => {
|
|
|
34
33
|
aiAssistantConfig: ge,
|
|
35
34
|
activeMode: Se,
|
|
36
35
|
dir: ke = "ltr",
|
|
37
|
-
size:
|
|
36
|
+
size: K = "medium",
|
|
38
37
|
placeholder: Ce,
|
|
39
38
|
history: be,
|
|
40
39
|
loading: xe = !1,
|
|
41
|
-
promptSuggestionRender:
|
|
42
|
-
historyItemRender:
|
|
40
|
+
promptSuggestionRender: j,
|
|
41
|
+
historyItemRender: J,
|
|
43
42
|
onOpen: Re,
|
|
44
|
-
onClose:
|
|
43
|
+
onClose: ve,
|
|
45
44
|
onFocus: C,
|
|
46
45
|
onBlur: b,
|
|
47
|
-
onSearch:
|
|
46
|
+
onSearch: Ie,
|
|
48
47
|
onSemanticSearch: we,
|
|
49
|
-
onAIPromptRequest:
|
|
50
|
-
onAIResponseSuccess:
|
|
51
|
-
onAIResponseError:
|
|
48
|
+
onAIPromptRequest: F,
|
|
49
|
+
onAIResponseSuccess: H,
|
|
50
|
+
onAIResponseError: z,
|
|
52
51
|
onAICancelRequest: x
|
|
53
|
-
} = me, h = lt(), g = e.useContext(
|
|
52
|
+
} = me, h = lt(), g = e.useContext(ft), Ee = e.useRef(`k-${ot()}`), d = e.useRef(null), S = e.useRef(null), M = e.useRef(null), [o, p] = e.useState(""), [De, R] = e.useState(!1), [ye, Q] = e.useState(void 0), [Be, X] = e.useState(null), {
|
|
54
53
|
searchMode: i,
|
|
55
54
|
semanticSearchMode: c,
|
|
56
55
|
aiAssistantMode: s,
|
|
57
56
|
selectedView: n,
|
|
58
|
-
setSelectedViewState:
|
|
57
|
+
setSelectedViewState: N,
|
|
59
58
|
lastSearchMode: Pe,
|
|
60
59
|
searchHistorySettings: Y,
|
|
61
60
|
semanticSearchHistorySettings: Z,
|
|
62
|
-
aiAssistantHistorySettings:
|
|
61
|
+
aiAssistantHistorySettings: T,
|
|
63
62
|
speechToTextButtonSettings: _,
|
|
64
63
|
currentSearchDelay: Le
|
|
65
64
|
} = ht({
|
|
@@ -68,12 +67,12 @@ const vt = e.forwardRef((me, de) => {
|
|
|
68
67
|
aiAssistantConfigProp: ge,
|
|
69
68
|
activeModeProp: Se,
|
|
70
69
|
sharedHistory: be
|
|
71
|
-
}), { currentHistory:
|
|
70
|
+
}), { currentHistory: v, currentHistorySettings: Fe, addToHistory: q } = gt({
|
|
72
71
|
selectedView: n,
|
|
73
72
|
searchHistorySettings: Y,
|
|
74
73
|
semanticSearchHistorySettings: Z,
|
|
75
|
-
aiAssistantHistorySettings:
|
|
76
|
-
}), { isOpen:
|
|
74
|
+
aiAssistantHistorySettings: T
|
|
75
|
+
}), { isOpen: O, togglePopup: a } = St({ onOpen: Re, onClose: ve }), { columns: A, gridState: He, gridRef: ze, handleStateChange: Ne } = kt(g), V = e.useMemo(
|
|
77
76
|
() => (s == null ? void 0 : s.promptSuggestions) || [],
|
|
78
77
|
[s == null ? void 0 : s.promptSuggestions]
|
|
79
78
|
), { inputPlaceholder: Te, prefixIcon: qe } = Ct({
|
|
@@ -82,20 +81,20 @@ const vt = e.forwardRef((me, de) => {
|
|
|
82
81
|
semanticSearchMode: c,
|
|
83
82
|
aiAssistantMode: s,
|
|
84
83
|
sharedPlaceholder: Ce
|
|
85
|
-
}), { searchListData: f, aiAssistantListData:
|
|
84
|
+
}), { searchListData: f, aiAssistantListData: I, searchHistoryListData: w } = bt({
|
|
86
85
|
selectedView: n,
|
|
87
86
|
searchModeEnabled: i == null ? void 0 : i.enabled,
|
|
88
87
|
semanticSearchModeEnabled: c == null ? void 0 : c.enabled,
|
|
89
|
-
promptSuggestions:
|
|
90
|
-
currentHistory:
|
|
88
|
+
promptSuggestions: V,
|
|
89
|
+
currentHistory: v,
|
|
91
90
|
currentHistorySettings: Fe
|
|
92
|
-
}),
|
|
91
|
+
}), E = xt({
|
|
93
92
|
searchMode: i,
|
|
94
93
|
semanticSearchMode: c,
|
|
95
94
|
aiAssistantMode: s,
|
|
96
95
|
selectedView: n,
|
|
97
96
|
lastSearchMode: Pe,
|
|
98
|
-
setSelectedViewState:
|
|
97
|
+
setSelectedViewState: N,
|
|
99
98
|
setInputValue: p
|
|
100
99
|
});
|
|
101
100
|
e.useEffect(() => {
|
|
@@ -110,30 +109,30 @@ const vt = e.forwardRef((me, de) => {
|
|
|
110
109
|
r.disconnect();
|
|
111
110
|
};
|
|
112
111
|
}, []);
|
|
113
|
-
const m = xe || De,
|
|
112
|
+
const m = xe || De, W = !n, Oe = !(i != null && i.enabled) && !(c != null && c.enabled) && !(s != null && s.enabled), Ve = it.sizeMap[K] || "md", { emitSearchEvent: u } = Rt({
|
|
114
113
|
selectedView: n,
|
|
115
114
|
searchMode: i,
|
|
116
115
|
columns: A,
|
|
117
116
|
gridContext: g,
|
|
118
117
|
searchHistorySettings: Y,
|
|
119
118
|
semanticSearchHistorySettings: Z,
|
|
120
|
-
addToHistory:
|
|
121
|
-
onSearch:
|
|
119
|
+
addToHistory: q,
|
|
120
|
+
onSearch: Ie,
|
|
122
121
|
onSemanticSearch: we
|
|
123
|
-
}), { sendRequest: ee, cancelRequest: te } =
|
|
122
|
+
}), { sendRequest: ee, cancelRequest: te } = dt({
|
|
124
123
|
requestUrl: s == null ? void 0 : s.requestUrl,
|
|
125
124
|
requestOptions: s == null ? void 0 : s.requestOptions,
|
|
126
125
|
columns: A,
|
|
127
126
|
gridState: He,
|
|
128
127
|
gridRef: ze,
|
|
129
128
|
onPromptRequest: (t) => {
|
|
130
|
-
|
|
129
|
+
F == null || F({ requestData: t });
|
|
131
130
|
},
|
|
132
131
|
onResponseSuccess: (t) => {
|
|
133
|
-
R(!1),
|
|
132
|
+
R(!1), H == null || H({ response: t });
|
|
134
133
|
},
|
|
135
134
|
onResponseError: (t) => {
|
|
136
|
-
R(!1),
|
|
135
|
+
R(!1), z == null || z({ error: t });
|
|
137
136
|
},
|
|
138
137
|
onStateChange: Ne,
|
|
139
138
|
onExportPdf: () => g == null ? void 0 : g.exportAsPdf()
|
|
@@ -146,10 +145,10 @@ const vt = e.forwardRef((me, de) => {
|
|
|
146
145
|
}),
|
|
147
146
|
[a]
|
|
148
147
|
);
|
|
149
|
-
const
|
|
148
|
+
const G = vt(Be, Le), ne = e.useRef(u);
|
|
150
149
|
ne.current = u, e.useEffect(() => {
|
|
151
|
-
|
|
152
|
-
}, [
|
|
150
|
+
G !== null && ne.current(G);
|
|
151
|
+
}, [G]);
|
|
153
152
|
const We = e.useCallback(
|
|
154
153
|
(t) => {
|
|
155
154
|
const r = t.target.value;
|
|
@@ -161,37 +160,37 @@ const vt = e.forwardRef((me, de) => {
|
|
|
161
160
|
}, [C, a, o]), Ue = e.useCallback(
|
|
162
161
|
(t) => {
|
|
163
162
|
var le;
|
|
164
|
-
const r = d.current, l = (le =
|
|
165
|
-
!
|
|
163
|
+
const r = d.current, l = (le = M.current) == null ? void 0 : le.element, y = t.relatedTarget, _e = y && (r == null ? void 0 : r.contains(y)), Ae = y && (l == null ? void 0 : l.contains(y));
|
|
164
|
+
!_e && !Ae && (b == null || b(), a(!1));
|
|
166
165
|
},
|
|
167
166
|
[b, a]
|
|
168
167
|
), $e = e.useCallback(() => {
|
|
169
168
|
o || a(!0);
|
|
170
|
-
}, [a, o]), re = !!((ie = s == null ? void 0 : s.requestOptions) != null && ie.url || s != null && s.requestUrl),
|
|
169
|
+
}, [a, o]), re = !!((ie = s == null ? void 0 : s.requestOptions) != null && ie.url || s != null && s.requestUrl), U = e.useCallback(() => {
|
|
171
170
|
if (m) {
|
|
172
171
|
x == null || x(), te(), R(!1);
|
|
173
172
|
return;
|
|
174
173
|
}
|
|
175
|
-
o.trim() && (re && R(!0),
|
|
174
|
+
o.trim() && (re && R(!0), q("aiAssistant", o, T), a(!1), ee(o.trim()), p(""));
|
|
176
175
|
}, [
|
|
177
176
|
m,
|
|
178
177
|
o,
|
|
179
|
-
N,
|
|
180
|
-
a,
|
|
181
178
|
T,
|
|
179
|
+
a,
|
|
180
|
+
q,
|
|
182
181
|
ee,
|
|
183
182
|
te,
|
|
184
183
|
re,
|
|
185
184
|
x
|
|
186
185
|
]), Ke = e.useCallback(
|
|
187
186
|
(t) => {
|
|
188
|
-
t.key === "Enter" && (n === "aiAssistant" ?
|
|
187
|
+
t.key === "Enter" && (n === "aiAssistant" ? U() : n === "semanticSearch" && u(o));
|
|
189
188
|
},
|
|
190
|
-
[n, o, u,
|
|
189
|
+
[n, o, u, U]
|
|
191
190
|
), je = e.useCallback(() => {
|
|
192
191
|
var t;
|
|
193
|
-
a(!
|
|
194
|
-
}, [
|
|
192
|
+
a(!O), (t = S.current) == null || t.focus();
|
|
193
|
+
}, [O, a]), Je = e.useCallback(
|
|
195
194
|
(t) => {
|
|
196
195
|
var r;
|
|
197
196
|
t.stopPropagation(), t.preventDefault(), p(""), (r = S.current) == null || r.focus(), a(!0), u("");
|
|
@@ -200,54 +199,63 @@ const vt = e.forwardRef((me, de) => {
|
|
|
200
199
|
), se = e.useCallback(
|
|
201
200
|
(t) => {
|
|
202
201
|
var r;
|
|
203
|
-
|
|
202
|
+
N(t), p(""), X(null), (r = S.current) == null || r.focus();
|
|
204
203
|
},
|
|
205
|
-
[
|
|
206
|
-
),
|
|
204
|
+
[N]
|
|
205
|
+
), D = e.useCallback(
|
|
207
206
|
(t) => {
|
|
208
207
|
var r;
|
|
209
208
|
p(t), a(!1), (r = S.current) == null || r.focus(), n !== "aiAssistant" && u(t);
|
|
210
209
|
},
|
|
211
210
|
[n, a, u]
|
|
212
|
-
),
|
|
211
|
+
), Me = e.useCallback((t) => {
|
|
213
212
|
if (t.isFinal && t.alternatives.length > 0) {
|
|
214
213
|
const r = t.alternatives[0].transcript;
|
|
215
214
|
p((l) => l ? `${l} ${r}` : r);
|
|
216
215
|
}
|
|
217
|
-
}, []),
|
|
216
|
+
}, []), Qe = e.useMemo(() => n === "aiAssistant" ? v.length === 0 && V.length === 0 : n === "search" || n === "semanticSearch" ? v.length === 0 && f.length === 0 : !1, [n, v.length, V.length, f.length]), ae = e.useCallback(
|
|
218
217
|
(t) => {
|
|
219
|
-
const l = (n === "aiAssistant" ?
|
|
220
|
-
l &&
|
|
218
|
+
const l = (n === "aiAssistant" ? I : w)[t];
|
|
219
|
+
l && D(l.text);
|
|
221
220
|
},
|
|
222
|
-
[n,
|
|
223
|
-
),
|
|
221
|
+
[n, I, w, D]
|
|
222
|
+
), Xe = e.useCallback(
|
|
224
223
|
(t) => {
|
|
225
224
|
const r = f[t];
|
|
226
225
|
r && se(r.mode);
|
|
227
226
|
},
|
|
228
227
|
[f, se]
|
|
229
228
|
), oe = e.useMemo(
|
|
230
|
-
() =>
|
|
231
|
-
historyItemRender:
|
|
232
|
-
promptSuggestionRender:
|
|
233
|
-
handleListItemClick:
|
|
229
|
+
() => ut({
|
|
230
|
+
historyItemRender: J,
|
|
231
|
+
promptSuggestionRender: j,
|
|
232
|
+
handleListItemClick: D
|
|
234
233
|
}),
|
|
235
|
-
[
|
|
236
|
-
),
|
|
237
|
-
|
|
234
|
+
[J, j, D]
|
|
235
|
+
), Ye = O && !Oe, Ze = () => /* @__PURE__ */ e.createElement(e.Fragment, null, E.items.length > 0 && /* @__PURE__ */ e.createElement(
|
|
236
|
+
nt,
|
|
237
|
+
{
|
|
238
|
+
items: E.items,
|
|
239
|
+
value: E.value,
|
|
240
|
+
onChange: E.onChange,
|
|
241
|
+
size: K,
|
|
242
|
+
layoutMode: "stretch"
|
|
243
|
+
}
|
|
244
|
+
), (n === "search" || n === "semanticSearch") && f.length > 0 && /* @__PURE__ */ e.createElement(
|
|
245
|
+
$,
|
|
238
246
|
{
|
|
239
247
|
data: f,
|
|
240
248
|
textField: "text",
|
|
241
249
|
descriptionField: "description",
|
|
242
|
-
onClick:
|
|
243
|
-
itemRender:
|
|
250
|
+
onClick: Xe,
|
|
251
|
+
itemRender: pt,
|
|
244
252
|
show: !0,
|
|
245
253
|
wrapperCssClass: "k-list k-list-md"
|
|
246
254
|
}
|
|
247
|
-
), n === "aiAssistant" &&
|
|
248
|
-
|
|
255
|
+
), n === "aiAssistant" && I.length > 0 && /* @__PURE__ */ e.createElement(
|
|
256
|
+
$,
|
|
249
257
|
{
|
|
250
|
-
data:
|
|
258
|
+
data: I,
|
|
251
259
|
textField: "text",
|
|
252
260
|
groupField: "group",
|
|
253
261
|
svgIconField: "groupSvgIcon",
|
|
@@ -260,7 +268,7 @@ const vt = e.forwardRef((me, de) => {
|
|
|
260
268
|
wrapperCssClass: "k-list k-list-md"
|
|
261
269
|
}
|
|
262
270
|
), (n === "search" || n === "semanticSearch") && w.length > 0 && /* @__PURE__ */ e.createElement(
|
|
263
|
-
|
|
271
|
+
$,
|
|
264
272
|
{
|
|
265
273
|
data: w,
|
|
266
274
|
textField: "text",
|
|
@@ -274,7 +282,7 @@ const vt = e.forwardRef((me, de) => {
|
|
|
274
282
|
show: !0,
|
|
275
283
|
wrapperCssClass: "k-list k-list-md"
|
|
276
284
|
}
|
|
277
|
-
),
|
|
285
|
+
), Qe && /* @__PURE__ */ e.createElement(mt, { selectedView: n }));
|
|
278
286
|
return /* @__PURE__ */ e.createElement("div", { ref: d, className: "k-smart-box-wrapper", dir: ke, onBlur: Ue }, /* @__PURE__ */ e.createElement(
|
|
279
287
|
"span",
|
|
280
288
|
{
|
|
@@ -282,7 +290,7 @@ const vt = e.forwardRef((me, de) => {
|
|
|
282
290
|
"k-loading": m
|
|
283
291
|
})
|
|
284
292
|
},
|
|
285
|
-
!
|
|
293
|
+
!W && /* @__PURE__ */ e.createElement("span", { className: "k-input-prefix k-input-prefix-horizontal" }, /* @__PURE__ */ e.createElement(
|
|
286
294
|
ce,
|
|
287
295
|
{
|
|
288
296
|
className: B("k-icon", {
|
|
@@ -300,11 +308,11 @@ const vt = e.forwardRef((me, de) => {
|
|
|
300
308
|
{
|
|
301
309
|
ref: S,
|
|
302
310
|
type: "text",
|
|
303
|
-
className: B("k-input-inner", { "k-disabled":
|
|
311
|
+
className: B("k-input-inner", { "k-disabled": W }),
|
|
304
312
|
id: Ee.current,
|
|
305
313
|
placeholder: Te,
|
|
306
314
|
value: o,
|
|
307
|
-
disabled:
|
|
315
|
+
disabled: W,
|
|
308
316
|
onChange: We,
|
|
309
317
|
onFocus: Ge,
|
|
310
318
|
onClick: $e,
|
|
@@ -327,21 +335,21 @@ const vt = e.forwardRef((me, de) => {
|
|
|
327
335
|
/* @__PURE__ */ e.createElement(ce, { className: "k-icon", icon: rt })
|
|
328
336
|
),
|
|
329
337
|
n === "aiAssistant" && /* @__PURE__ */ e.createElement("span", { className: "k-input-suffix k-input-suffix-horizontal" }, _ && /* @__PURE__ */ e.createElement(
|
|
330
|
-
|
|
338
|
+
et,
|
|
331
339
|
{
|
|
332
340
|
..._,
|
|
333
341
|
"aria-label": h.toLanguageString(
|
|
334
|
-
|
|
335
|
-
k[
|
|
342
|
+
P,
|
|
343
|
+
k[P]
|
|
336
344
|
),
|
|
337
345
|
title: h.toLanguageString(
|
|
338
|
-
|
|
339
|
-
k[
|
|
346
|
+
P,
|
|
347
|
+
k[P]
|
|
340
348
|
),
|
|
341
|
-
onResult:
|
|
349
|
+
onResult: Me
|
|
342
350
|
}
|
|
343
351
|
), /* @__PURE__ */ e.createElement(
|
|
344
|
-
|
|
352
|
+
tt,
|
|
345
353
|
{
|
|
346
354
|
className: B("k-smart-box-send", {
|
|
347
355
|
"k-processing": m,
|
|
@@ -351,27 +359,27 @@ const vt = e.forwardRef((me, de) => {
|
|
|
351
359
|
rounded: "full",
|
|
352
360
|
size: "small",
|
|
353
361
|
title: h.toLanguageString(
|
|
354
|
-
|
|
355
|
-
k[
|
|
362
|
+
L,
|
|
363
|
+
k[L]
|
|
356
364
|
),
|
|
357
365
|
"aria-label": h.toLanguageString(
|
|
358
|
-
|
|
359
|
-
k[
|
|
366
|
+
L,
|
|
367
|
+
k[L]
|
|
360
368
|
),
|
|
361
369
|
"aria-disabled": o.length === 0,
|
|
362
370
|
svgIcon: m ? st : at,
|
|
363
371
|
disabled: o.length === 0 && !m,
|
|
364
|
-
onClick:
|
|
372
|
+
onClick: U
|
|
365
373
|
}
|
|
366
374
|
))
|
|
367
375
|
), /* @__PURE__ */ e.createElement(
|
|
368
|
-
|
|
376
|
+
ct,
|
|
369
377
|
{
|
|
370
|
-
ref:
|
|
378
|
+
ref: M,
|
|
371
379
|
anchor: d.current,
|
|
372
|
-
show:
|
|
380
|
+
show: Ye,
|
|
373
381
|
popupClass: "k-smart-box-popup",
|
|
374
|
-
style: { width:
|
|
382
|
+
style: { width: ye },
|
|
375
383
|
anchorAlign: { horizontal: "left", vertical: "bottom" },
|
|
376
384
|
popupAlign: { horizontal: "left", vertical: "top" },
|
|
377
385
|
margin: { horizontal: 0, vertical: 2 },
|
|
@@ -380,10 +388,10 @@ const vt = e.forwardRef((me, de) => {
|
|
|
380
388
|
d.current && !d.current.contains(r) && a(!1);
|
|
381
389
|
}
|
|
382
390
|
},
|
|
383
|
-
|
|
391
|
+
Ze()
|
|
384
392
|
));
|
|
385
393
|
});
|
|
386
|
-
|
|
394
|
+
It.displayName = "KendoReactSmartBox";
|
|
387
395
|
export {
|
|
388
|
-
|
|
396
|
+
It as SmartBox
|
|
389
397
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { SmartBoxMode
|
|
8
|
+
import { SmartBoxMode } from '../interfaces/index.js';
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
/**
|
|
11
11
|
* Represents a minimal mode configuration for the segmented control.
|
|
@@ -63,8 +63,17 @@ export interface UseSmartBoxSegmentedControlProps {
|
|
|
63
63
|
* appropriate icon based on the last selected search mode.
|
|
64
64
|
*
|
|
65
65
|
* @param props - The hook properties.
|
|
66
|
-
* @returns An
|
|
66
|
+
* @returns An object containing the button array and handler function for the SegmentedControl onChange event.
|
|
67
67
|
*
|
|
68
68
|
* @hidden
|
|
69
69
|
*/
|
|
70
|
-
export declare function useSmartBoxSegmentedControl({ searchMode, semanticSearchMode, aiAssistantMode, selectedView, lastSearchMode, setSelectedViewState, setInputValue }: UseSmartBoxSegmentedControlProps):
|
|
70
|
+
export declare function useSmartBoxSegmentedControl({ searchMode, semanticSearchMode, aiAssistantMode, selectedView, lastSearchMode, setSelectedViewState, setInputValue }: UseSmartBoxSegmentedControlProps): {
|
|
71
|
+
items: {
|
|
72
|
+
value: string;
|
|
73
|
+
text: string;
|
|
74
|
+
svgIcon?: any;
|
|
75
|
+
iconClassName?: string | undefined;
|
|
76
|
+
}[];
|
|
77
|
+
value: string | undefined;
|
|
78
|
+
onChange: (value: string) => void;
|
|
79
|
+
};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),g=require("@progress/kendo-svg-icons");function O(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const l in n)if(l!=="default"){const u=Object.getOwnPropertyDescriptor(n,l);Object.defineProperty(t,l,u.get?u:{enumerable:!0,get:()=>n[l]})}}return t.default=n,Object.freeze(t)}const o=O(p);function a({searchMode:n,semanticSearchMode:t,aiAssistantMode:l,selectedView:u,lastSearchMode:r,setSelectedViewState:f,setInputValue:i}){const v=o.useMemo(()=>{const b=(n==null?void 0:n.enabled)||(t==null?void 0:t.enabled),k=l==null?void 0:l.enabled;if(!b||!k)return[];const s=u==="semanticSearch"||u==="aiAssistant"&&r==="semanticSearch";return[{value:"search",text:"Search",svgIcon:s?g.zoomSparkleIcon:g.searchIcon,iconClassName:s?"k-accent-icon":void 0},{value:"aiAssistant",text:"AI Assistant",svgIcon:g.sparklesIcon,iconClassName:"k-accent-icon"}]},[n,t,l,u,r]),C=o.useCallback(()=>{if(u==="search"||u==="semanticSearch")return"search";if(u==="aiAssistant")return"aiAssistant"},[u]),I=o.useCallback(b=>{b==="search"?r&&(r==="search"?n!=null&&n.enabled:t!=null&&t.enabled)?f(r):n!=null&&n.enabled?f("search"):t!=null&&t.enabled&&f("semanticSearch"):b==="aiAssistant"&&f("aiAssistant"),i("")},[n,t,r,f,i]);return{items:v,value:C(),onChange:I}}exports.useSmartBoxSegmentedControl=a;
|