@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
68 lines (67 loc) • 1.73 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
"use client";
import * as B from "react";
function j({
selectedView: f,
searchMode: l,
columns: v,
gridContext: p,
searchHistorySettings: D,
semanticSearchHistorySettings: E,
addToHistory: m,
onSearch: u,
onSemanticSearch: i
}) {
return {
emitSearchEvent: B.useCallback(
(s) => {
var A;
if (!f || f === "aiAssistant")
return;
const b = ((A = l == null ? void 0 : l.fields) != null && A.length ? l.fields : v.map((t) => t.field)).map((t) => ({
field: t,
operator: "contains",
value: s,
ignoreCase: !0
}));
let r = !1;
const k = {
searchValue: s,
filters: b,
logic: "or",
isDefaultPrevented: () => r,
preventDefault: () => {
r = !0;
}
};
if (f === "search") {
if (u == null || u(k), !r && (p != null && p.filterChange)) {
const t = s.trim() ? { filters: b, logic: "or" } : null;
p.filterChange(t, {});
}
m("search", s, D);
} else f === "semanticSearch" && (i == null || i(k), m("semanticSearch", s, E));
},
[
f,
l,
v,
p,
u,
i,
m,
D,
E
]
)
};
}
export {
j as useSmartBoxSearch
};