@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
40 lines (39 loc) • 1.42 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 client";
import * as a from "react";
import { GridContext as u } from "../../utils/GridContext.mjs";
import { cloneReactElement as s } from "../../utils/index.mjs";
const x = (t) => {
const i = a.useContext(u), f = (e, r, c, C) => {
if (!i.filterChange)
return;
const l = [];
(e !== "" && e !== null || r !== "") && l.push({
field: c,
operator: r,
value: e
}), t.filter && t.filter.filters && (t.filter.filters || []).forEach((n) => {
n && n.field !== c && l.push(n);
});
const h = t.filter && t.filter.logic ? t.filter.logic : "and";
i.filterChange(l.length > 0 ? { logic: h, filters: l } : null, C);
}, d = i.getCellPositionStyle(t.column), o = t.isCustom ? {
style: { ...d }
} : {};
return i.isClient || t.isClient ? s(t.children, {
onChange: (e) => {
f(e.value, e.operator, t.field, e.syntheticEvent);
},
tdProps: { ...t.tdProps, ...o },
thProps: { ...t.tdProps, ...o }
}) : s(t.children, {});
};
export {
x as GridFilterCellContainer
};