@progress/kendo-react-data-tools
Version:
Includes React Pager & React Filter component, an intuitive interface to create complex filter descriptions. KendoReact Data Tools package
53 lines (52 loc) • 2.02 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 d from "react";
import { HeaderTdElement as h } from "./HeaderTdElement.mjs";
import { getFilterColumnId as C } from "../navigation/utils.mjs";
import { useLocalization as k } from "@progress/kendo-react-intl";
import { filterAriaLabel as f, messages as p } from "../messages/index.mjs";
import { classNames as b } from "@progress/kendo-react-common";
const w = "k-table-row k-filter-row", F = (i, a, l) => {
let r = `${l ? "k-grid-header-sticky" : ""}`;
return i.some((o) => o.field === a) && (r += " k-sorted"), r;
}, u = function(i) {
const { columns: a, filter: l, filterChange: r, sort: o = [], ariaRowIndex: m } = i, g = k(), c = (e) => {
if (!r)
return;
const s = e.filter.filter((t) => !(t.operator === "eq" && t.value === null));
r({ ...e, filter: s });
};
return /* @__PURE__ */ d.createElement("tr", { className: w, "aria-rowindex": m, role: "row" }, a.map((e, s) => {
const t = e.locked !== void 0 ? {
left: e.left,
right: e.right,
borderRightWidth: e.rightBorder ? "1px" : ""
} : {}, n = e.filterCell || e.filter;
return /* @__PURE__ */ d.createElement(
h,
{
columnId: C(e.id),
navigatable: e.navigatable,
style: t,
key: s,
ariaColumnIndex: e.ariaColumnIndex,
ariaLabel: n ? g.toLanguageString(f, p[f]) : void 0,
className: b(
"k-table-td k-header",
F(o, e.field, e.locked)
)
},
n && /* @__PURE__ */ d.createElement(n, { field: e.field, filter: l, onFilterChange: c })
);
}));
};
export {
w as FILTER_ROW_CLASS,
u as FilterRow
};