UNPKG

@progress/kendo-react-grid

Version:

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

10 lines (9 loc) 4.65 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 client"; "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),a=require("@progress/kendo-react-layout"),A=require("@progress/kendo-react-common"),b=require("../../utils/GridContext.js"),s=require("@progress/kendo-react-buttons"),l=require("@progress/kendo-svg-icons"),x=require("../adaptiveContext/GridToolbarAdaptiveContext.js"),N=require("@progress/kendo-react-intl"),n=require("../../messages/index.js"),M=require("../../columnMenu/GridColumnMenuItemGroup.js"),y=require("../../columnMenu/GridColumnMenuFilterUI.js"),G=require("../../columnMenu/GridColumnMenuItem.js"),w=require("../../columnMenu/adaptiveContent/GridActionSheetFooter.js"),B=t=>{const o=e.useContext(b.GridContext),{actionSheetRef:m,firstViewRef:k,secondViewRef:C}=e.useContext(x.GridToolbarAdaptiveContext),r=A.useAdaptiveModeContext(),c=N.useLocalization(),[d,E]=e.useState(""),g=o.dir==="rtl"?l.chevronRightIcon:l.chevronLeftIcon,v=c.toLanguageString(n.adaptiveColumnMenuFilterTitle,n.messages[n.adaptiveColumnMenuFilterTitle]),S={animation:!0,navigatable:!1,navigatableElements:[],expand:t.computedShow,animationStyles:r&&o.adaptiveColumnMenuRef<=r.small?{top:0,width:"100%",height:"100%"}:void 0,className:"k-adaptive-actionsheet",position:r&&o.adaptiveColumnMenuRef<=r.small?"fullscreen":void 0},I=()=>{t.onBackView&&t.onBackView(),o!=null&&o.mobileMode&&m.current.element.style.setProperty("--kendo-actionsheet-view-current",1)};return e.createElement(a.ActionSheet,{...S,ref:m,style:{"--kendo-actionsheet-view-current":1},onClose:t.onClose},e.createElement(a.ActionSheetView,{className:"k-actionsheet-view-animated",ref:k,style:{transitionDuration:"500ms",transitionProperty:"transform"}},e.createElement(a.ActionSheetHeader,null,e.createElement("div",{className:"k-actionsheet-titlebar-group"},e.createElement("div",{className:"k-actionsheet-title"},e.createElement("div",{className:"k-text-center"},v)),e.createElement("div",{className:"k-actionsheet-actions"},e.createElement(s.Button,{svgIcon:l.xIcon,onClick:t.onClose,fillMode:"flat"})))),e.createElement(a.ActionSheetContent,null,e.createElement("div",{className:"k-column-menu k-column-menu-lg"},t.filtered.map(i=>{var f,h;return e.createElement(M.GridColumnMenuItemGroup,{key:i.id},e.createElement("div",{className:"k-expander"},e.createElement(G.GridColumnMenuItem,{title:t.renderTitle(i),expandable:!0,expanded:!!((h=(f=t.expandState)==null?void 0:f.find(u=>u.column.field===i.field))!=null&&h.expanded),onClick:u=>(m.current.element.style.setProperty("--kendo-actionsheet-view-current",2),E(i.field),t.onFilterExpand(u,i))})))}))),e.createElement(a.ActionSheetFooter,null,e.createElement("div",{className:"k-actions k-actions-stretched k-actions-horizontal k-column-menu-footer"},e.createElement(s.Button,{svgIcon:l.filterClearIcon,onClick:t.handleClearAllFilters,size:"large"},c.toLanguageString(n.filterClearAllButton,n.messages[n.filterClearAllButton]))))),e.createElement(a.ActionSheetView,{className:"k-actionsheet-view-animated",ref:C,style:{transitionDuration:"500ms",transitionProperty:"transform"}},e.createElement(a.ActionSheetHeader,null,e.createElement("div",{className:"k-actionsheet-titlebar-group"},e.createElement("div",{className:"k-actionsheet-actions"},e.createElement(s.Button,{type:"button",onClick:I,svgIcon:g,fillMode:"flat"})),e.createElement("div",{className:"k-actionsheet-title"},e.createElement("div",{className:"k-text-center"},v+(d?` ${d}`:""))),e.createElement("div",{className:"k-actionsheet-actions"},e.createElement(s.Button,{type:"button",svgIcon:l.xIcon,onClick:t.onClose,fillMode:"flat"})))),e.createElement(a.ActionSheetContent,null,e.createElement("form",{className:"k-filter-menu",onSubmit:t.submit,onReset:t.clear},e.createElement("div",{className:"k-filter-menu-container"},t.FilterUI?e.createElement(t.FilterUI,{...t.filterUIProps}):e.createElement(y.GridColumnMenuFilterUI,{...t.filterUIProps})))),e.createElement(a.ActionSheetFooter,null,e.createElement(w.GridActionSheetFooterContent,{onApply:t.submit,onReset:t.clear,submitMessage:c.toLanguageString(n.filterSubmitButton,n.messages[n.filterSubmitButton]),resetMessage:c.toLanguageString(n.filterClearButton,n.messages[n.filterClearButton])}))))};exports.GridAdaptiveToolbarFilter=B;