UNPKG

@progress/kendo-react-grid

Version:

React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package

9 lines (8 loc) 3.01 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 P=require("react"),E=require("../cells/GridFilterCell.js"),d=require("../filterCommon.js"),k=require("@progress/kendo-react-data-tools"),F=require("../messages/index.js"),S=require("@progress/kendo-react-common"),f=require("../utils/index.js"),x=require("./client/GridFilterCellContainer.js"),h=require("./client/GridFilterCellElementContainer.js");function w(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(a,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return a.default=t,Object.freeze(a)}const i=w(P),L="k-table-row k-filter-row",G=t=>{const a=(e,r)=>{let l=`${r?"k-grid-header-sticky":""}`;return t.sort&&t.sort.filter(c=>c.field===e).length>0&&(l+=" k-sorted"),l},n=t.filter&&t.filter.filters||[],s=e=>{if(e===void 0)return;const r=n.filter(l=>l.field===e);return r.length?r[0]:void 0};let q=0,v=-1;const I=t.columns.filter(e=>e.children.length===0).map(e=>{const r=d.getFilterType(e.filter),l=s(e.field),c=`${e.field} ${t.localization.toLanguageString(F.filterAriaLabel,F.messages[F.filterAriaLabel])}`;let C=l&&l.value;C===void 0&&(C=r==="text"?"":null);const u=e.filterable&&{field:e.field,title:e.filterTitle,value:C,operator:l&&l.operator,operators:d.operatorMap(t.filterOperators[r]||[],t.localization),booleanValues:d.operatorMap(d.booleanFilterValues,t.localization),filterType:r,ariaLabel:e.columnType==="reorder"?"":c,size:t.size},b=e.declarationIndex>=0?++v:--q,o={columnId:k.tableKeyboardNavigationTools.getFilterColumnId(e.id),navigatable:e.navigatable||t.navigatable,className:S.classNames("k-table-td",a(e.field,e.locked)||void 0),role:"gridcell",ariaLabel:e.columnType==="reorder"?void 0:c,ariaColumnIndex:e.ariaColumnIndex},y=f.clientColumn(e),R={column:y,filter:t.filter,field:e.field,tdProps:o,thProps:o};let m=null;u&&e.columnType!=="reorder"&&(m=i.createElement(x.GridFilterCellContainer,{...R,isClient:f.isClientReference(E.GridFilterCell)},i.createElement(E.GridFilterCell,{...u})));const g=f.resolveCells(t.cells,e.cells);if(g&&g.filterCell){const T=g.filterCell,O=f.isClientReference(T);return i.createElement(x.GridFilterCellContainer,{key:b,...R,isClient:O,isCustom:!0},i.createElement(T,{key:b,...u,tdProps:o,thProps:o,index:v},m))}return i.createElement(h.GridFilterCellElementContainer,{key:b,column:y},i.createElement(k.HeaderTdElement,{...o},m))});return i.createElement("tr",{className:L,"aria-rowindex":t.ariaRowIndex,role:"row"},I)};exports.FILTER_ROW_CLASS=L;exports.FilterRow=G;