@progress/kendo-react-data-tools
Version:
Includes React Pager & React Filter component, an intuitive interface to create complex filter descriptions. KendoReact Data Tools package
9 lines (8 loc) • 2.68 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
*-------------------------------------------------------------------------------------------
*/
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./utils.js"),K=e=>e==="ArrowLeft"||e==="ArrowRight"||e==="ArrowUp"||e==="ArrowDown"||e==="PageUp"||e==="PageDown"||e==="Home"||e==="End",d=(e,t,r,n,o,i)=>{if(n&&o==="inline")return!1;if(n&&o==="incell"){e.preventDefault(),e.stopPropagation();const u=f.getStackedCellContainer(t);if(!u)return!0;const C=Array.from(u.querySelectorAll(".k-grid-stack-cell")),S=C.indexOf(t);if(S===-1)return!0;const y=e.shiftKey?-1:1,h=S+y;return h<0||h>=C.length||i&&i(y),!0}const c=f.getStackedCellContainer(t);if(!c)return!1;const a=Array.from(c.querySelectorAll(".k-grid-stack-cell")),l=a.indexOf(t);if(l===-1)return!1;if(e.shiftKey){if(l===0)return e.stopPropagation(),e.preventDefault(),!0;e.preventDefault();const u=a[l-1];return u&&f.focusStackedCellElement(u,0),!0}if(l===a.length-1)return e.stopPropagation(),e.preventDefault(),!0;e.preventDefault();const s=a[l+1];return s&&f.focusStackedCellElement(s,0),!0},g=(e,t,r,n,o)=>n&&o==="incell"||n&&o==="inline"?!1:r===t?(e.preventDefault(),f.focusStackedCellElement(t,0),!0):!1,p=(e,t,r,n,o,i)=>{if(e.preventDefault(),e.stopPropagation(),o&&i==="incell"){const a=document.activeElement;return a&&t.contains(a)&&a.blur(),t.focus(),n&&n(),r&&r(),!0}if(o&&i==="inline")return r&&r(),!1;const c=f.getStackedCellContainer(t);return r&&r(),c&&c.focus(),!0},k=(e,t,r)=>{if(!t)return!1;const n=e.key,i=e.target.closest(".k-animation-container, .k-popup, .k-list-container");return r==="incell"&&K(n)&&!i||r==="inline"&&(n==="ArrowUp"||n==="ArrowDown")&&!i?(e.preventDefault(),e.stopPropagation(),!0):!1},w=e=>{const{event:t,cellElement:r,onKeyDown:n,onEscape:o,onExitEdit:i,onTabToNextCell:c,isInEdit:a,editMode:l}=e,s=t.target;k(t,a,l)||(t.key==="Tab"&&d(t,r,s,a,l,c),(t.key==="Enter"||t.key==="F2")&&g(t,r,s,a,l),t.key==="Escape"&&p(t,r,o,i,a,l),n&&n(t))},D={handleStackedKeyboardNavigation:w,handleStackedCellTabNavigation:d,handleStackedCellEnterKey:g,handleStackedCellEscapeKey:p,handleNavigationKeysInEditMode:k,isNavigationKey:K};exports.handleNavigationKeysInEditMode=k;exports.handleStackedCellEnterKey=g;exports.handleStackedCellEscapeKey=p;exports.handleStackedCellTabNavigation=d;exports.handleStackedKeyboardNavigation=w;exports.stackedKeyboardNavigationTools=D;