@progress/kendo-react-data-tools 7.5.0-develop.2 → 7.5.0-develop.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -94,9 +94,6 @@ export declare interface BooleanFilterProps extends TextFilterProps {
94
94
  defaultItem?: any;
95
95
  }
96
96
 
97
- /**
98
- * @hidden
99
- */
100
97
  export declare interface CellProps {
101
98
  /**
102
99
  * @hidden
@@ -199,11 +196,11 @@ export declare interface ClipboardDataEvent {
199
196
  */
200
197
  type: ClipboardActionType;
201
198
  /**
202
- * Represents the native clipboard event.
199
+ * Represents the native [ClipboardEvent]({% slug api_grid_gridcellssettings %})
203
200
  */
204
201
  nativeEvent?: ClipboardEvent;
205
202
  /**
206
- * All the Grid columns.
203
+ * All the Grid columns. It takes value of type of [ColumnBaseProps]({% slug api_data-tools_columnbaseprops %})<[CellProps]({% slug api_data-tools_cellprops %})>[]
207
204
  */
208
205
  columns: ColumnBaseProps[];
209
206
  /**
@@ -277,9 +274,6 @@ export declare interface ClipboardSettings {
277
274
  /** @hidden */
278
275
  export declare const closestTagName: (target: HTMLElement | null, tagName: 'TD' | 'TR' | 'TABLE') => HTMLElement | null;
279
276
 
280
- /**
281
- * @hidden
282
- */
283
277
  export declare interface ColumnBaseProps<CellProps = CellProps> {
284
278
  /**
285
279
  * The field to which the column is bound.
@@ -1647,6 +1641,7 @@ export declare class Pager extends React_2.Component<PagerProps, PagerState> {
1647
1641
  messagesMap: PropTypes.Requireable<(...args: any[]) => any>;
1648
1642
  size: PropTypes.Requireable<string | null>;
1649
1643
  dir: PropTypes.Requireable<string>;
1644
+ disabled: PropTypes.Requireable<boolean>;
1650
1645
  };
1651
1646
  /**
1652
1647
  * @hidden
@@ -1656,6 +1651,7 @@ export declare class Pager extends React_2.Component<PagerProps, PagerState> {
1656
1651
  info: boolean;
1657
1652
  type: string;
1658
1653
  size: string;
1654
+ disabled: boolean;
1659
1655
  };
1660
1656
  private _element;
1661
1657
  private get isRtl();
@@ -1769,6 +1765,10 @@ export declare interface PagerProps {
1769
1765
  * By default, navigation is disabled and the Pager content is accessible in the normal tab sequence.
1770
1766
  */
1771
1767
  navigatable?: boolean;
1768
+ /**
1769
+ * Controls the disabled state of the Pager. Defaults to `false`.
1770
+ */
1771
+ disabled?: boolean;
1772
1772
  }
1773
1773
 
1774
1774
  /**
@@ -1990,7 +1990,7 @@ export declare interface TableDragSelectionReleaseEvent {
1990
1990
  */
1991
1991
  export declare const tableKeyboardNavigation: {
1992
1992
  onConstructor: (options: {
1993
- navigatable: boolean | undefined;
1993
+ navigatable?: boolean | undefined;
1994
1994
  contextStateRef: {
1995
1995
  current?: TableKeyboardNavigationContextType;
1996
1996
  };
@@ -2025,6 +2025,7 @@ export declare const tableKeyboardNavigation: {
2025
2025
  navigationStateRef: {
2026
2026
  current?: TableKeyboardNavigationStateType;
2027
2027
  };
2028
+ focusFirst?: boolean;
2028
2029
  }) => void;
2029
2030
  onFocus: (event: React_2.FocusEvent<HTMLDivElement>, options: {
2030
2031
  contextStateRef: {
@@ -2041,6 +2042,7 @@ export declare const tableKeyboardNavigation: {
2041
2042
  onNavigationAction?: ((options: {
2042
2043
  event: React_2.KeyboardEvent<HTMLElement>;
2043
2044
  focusElement: any;
2045
+ action?: "moveToNextPage" | "moveToPrevPage" | "reorderToLeft" | "reorderToRight" | undefined;
2044
2046
  }) => void) | undefined;
2045
2047
  }) => void;
2046
2048
  generateMatrix: (options: {
@@ -2049,6 +2051,15 @@ export declare const tableKeyboardNavigation: {
2049
2051
  current?: TableKeyboardNavigationStateType;
2050
2052
  };
2051
2053
  }) => void;
2054
+ focusFirstDataElement: (options: {
2055
+ scope?: HTMLElement | undefined;
2056
+ contextStateRef: {
2057
+ current?: TableKeyboardNavigationContextType | undefined;
2058
+ };
2059
+ navigationStateRef: {
2060
+ current?: TableKeyboardNavigationStateType | undefined;
2061
+ };
2062
+ }, event?: any) => void;
2052
2063
  };
2053
2064
 
2054
2065
  /**
@@ -2100,7 +2111,7 @@ export declare interface TableKeyboardNavigationStateType {
2100
2111
  * @hidden
2101
2112
  */
2102
2113
  export declare const tableKeyboardNavigationTools: {
2103
- generateNavigatableId: (navigationId: string, idPrefix: string, type?: 'column' | 'cell' | 'nodata') => string;
2114
+ generateNavigatableId: (navigationId: string, idPrefix: string, type?: 'column' | 'cell' | 'group' | 'expand' | 'nodata') => string;
2104
2115
  getNavigatableId: (element: Element | null) => string | undefined;
2105
2116
  getNavigatableLevel: (element: Element | null) => number | undefined;
2106
2117
  getNavigatableElement: (scope: HTMLElement, options?: {
@@ -2126,7 +2137,7 @@ export declare const tableKeyboardNavigationTools: {
2126
2137
  contextStateRef: {
2127
2138
  current?: TableKeyboardNavigationContextType;
2128
2139
  };
2129
- event: any;
2140
+ event?: any;
2130
2141
  }) => void;
2131
2142
  getIdPrefix: (navigationStateRef: {
2132
2143
  current?: TableKeyboardNavigationStateType;
@@ -2153,6 +2164,15 @@ export declare const tableKeyboardNavigationTools: {
2153
2164
  current?: TableKeyboardNavigationStateType;
2154
2165
  }) => number;
2155
2166
  getFilterColumnId: (columnId: string) => string;
2167
+ focusFirstDataElement: (options: {
2168
+ scope?: HTMLElement;
2169
+ contextStateRef: {
2170
+ current?: TableKeyboardNavigationContextType;
2171
+ };
2172
+ navigationStateRef: {
2173
+ current?: TableKeyboardNavigationStateType;
2174
+ };
2175
+ }, event?: any) => void;
2156
2176
  };
2157
2177
 
2158
2178
  /** @hidden */
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@progress/kendo-react-common"),a=require("./utils.js"),K=e=>{const{navigatable:i,contextStateRef:o,navigationStateRef:t,idPrefix:r}=e;i&&(o.current={activeId:"",level:0},t.current={activeElementIsFocused:!1,prevNavigationIndexes:void 0,idPrefix:r||l.guid(),navigationMatrix:[],lastHeaderIndex:-1})},p=e=>{const{scope:i,contextStateRef:o,navigationStateRef:t}=e;if(o.current&&t.current&&i){E(e);const r=t.current.navigationMatrix.flat().find(n=>n.endsWith("cell"));if(r){const n=a.tableKeyboardNavigationTools.getActiveNavDataElement(i,r);n&&(o.current.activeId=r,n.setAttribute("tabIndex","0"))}}},S=e=>{const{contextStateRef:i,navigationStateRef:o,document:t}=e;if(i.current&&o.current&&t){const r=l.getActiveElement(t),n=a.tableKeyboardNavigationTools.getNavigatableId(r);n&&n===i.current.activeId&&(o.current.activeElementIsFocused=!0)}},T=e=>{const{scope:i,contextStateRef:o,navigationStateRef:t}=e;if(E(e),o.current&&t.current&&i){if(!a.tableKeyboardNavigationTools.getActiveNavDataElement(i,o.current.activeId)){const n=t.current.navigationMatrix[0][0],c=a.tableKeyboardNavigationTools.getActiveNavDataElement(i,n);n&&c&&(o.current.activeId=n,c.setAttribute("tabIndex","0"),t.current.activeElementIsFocused&&c.focus())}t.current.activeElementIsFocused=!1}},C=(e,i)=>{const{contextStateRef:o}=i;if(e.isDefaultPrevented()||!o.current)return;const t=e.target,r=a.tableKeyboardNavigationTools.getNavigatableId(t);if(r&&r!==o.current.activeId){const n=a.tableKeyboardNavigationTools.getClosestScope(t);if(!n)return;const c=a.tableKeyboardNavigationTools.getActiveNavDataElement(n,o.current.activeId);c&&c.setAttribute("tabIndex","-1"),t.setAttribute("tabIndex","0"),o.current.activeId=r}},h=(e,i)=>{const{contextStateRef:o,navigationStateRef:t,onNavigationAction:r}=i;if(e.isDefaultPrevented()||!o.current||!t.current)return;if(e.keyCode===l.Keys.esc){const d=a.tableKeyboardNavigationTools.getClosestNavigatableElement(e.target);a.tableKeyboardNavigationTools.focusElement({elementForFocus:d,event:e,contextStateRef:o});return}const n=e.target,c=n.className.indexOf("k-checkbox")===-1?n:a.tableKeyboardNavigationTools.getClosestNavigatableElement(n),g=a.tableKeyboardNavigationTools.getNavigatableId(c),b=a.tableKeyboardNavigationTools.getNavigatableLevel(c),m=a.tableKeyboardNavigationTools.getClosestScope(c),f=t.current.navigationMatrix;if(b!==void 0&&m){if(e.keyCode===l.Keys.enter){const d=a.tableKeyboardNavigationTools.getNavigatableElement(c,{level:b+1});if(d){a.tableKeyboardNavigationTools.focusElement({elementForFocus:d,event:e,contextStateRef:o,prevElement:c});return}else{const I=a.tableKeyboardNavigationTools.getFocusableElements(c)[0];a.tableKeyboardNavigationTools.focusElement({elementForFocus:I,event:e,contextStateRef:o,prevElement:c});return}}if(e.keyCode===l.Keys.up||e.keyCode===l.Keys.down||e.keyCode===l.Keys.left||e.keyCode===l.Keys.right){const d=e.keyCode===l.Keys.up||e.keyCode===l.Keys.left,I=e.keyCode===l.Keys.up||e.keyCode===l.Keys.down;let v;if(t.current&&t.current.prevNavigationIndexes){const[u,s]=t.current.prevNavigationIndexes;f[u][s]===g?v=t.current.prevNavigationIndexes:v=a.findId(f,g)}else v=a.findId(f,g);if(v){const[u,s]=v,[y,N]=I?a.findNextIdByRowIndex(u,s,g,f,d):a.findNextIdByCellIndex(u,s,g,f,d);if(y){const x=a.tableKeyboardNavigationTools.getActiveNavDataElement(m,y);a.tableKeyboardNavigationTools.focusElement({elementForFocus:x,event:e,contextStateRef:o,prevElement:c}),t.current.prevNavigationIndexes=N,r&&r({focusElement:x,event:e})}}}}},E=e=>{const{navigationStateRef:i,scope:o}=e;if(!i.current||!o)return;const t=[],r=a.getHeaderElement(o),n=a.getBodyElement(o);if(!r||!n)return;const c=Array.from(r.children),g=Array.from(n.children);[...c,...g].forEach((b,m)=>{Array.from(b.children).forEach(f=>{const d=a.getNavigatableId(f);if(!d)return;const I=f.rowSpan||1,v=f.colSpan||1;let u;for(let s=m,y=m+I;s<y;s++){if(t[s]||(t[s]=[]),u===void 0){const N=t[s].findIndex(x=>!x);u=N>-1?N:t[s].length}t[s][u]=d||""}for(let s=u+1,y=u+v;s<y;s++)t[m][s]=d||""})}),i.current.navigationMatrix=t.filter(b=>!!b),i.current.lastHeaderIndex=c.length-1},R={onConstructor:K,onComponentDidMount:p,onGetSnapshotBeforeUpdate:S,onComponentDidUpdate:T,onFocus:C,onKeyDown:h,generateMatrix:E};exports.tableKeyboardNavigation=R;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@progress/kendo-react-common"),t=require("./utils.js"),C=e=>{const{navigatable:r,contextStateRef:o,navigationStateRef:a,idPrefix:i}=e;r&&(o.current={activeId:"",level:0},a.current={activeElementIsFocused:!1,prevNavigationIndexes:void 0,idPrefix:i||s.guid(),navigationMatrix:[],lastHeaderIndex:-1})},D=e=>{const{scope:r,contextStateRef:o,navigationStateRef:a}=e;if(o.current&&a.current&&r){I(e);const i=t.getFirstDataCell(a.current.navigationMatrix);if(i){const n=t.tableKeyboardNavigationTools.getActiveNavDataElement(r,i);n&&(o.current.activeId=i,n.setAttribute("tabIndex","0"))}}},T=e=>{const{contextStateRef:r,navigationStateRef:o,document:a}=e;if(r.current&&o.current&&a){const i=s.getActiveElement(a),n=t.tableKeyboardNavigationTools.getNavigatableId(i);n&&n===r.current.activeId&&(o.current.activeElementIsFocused=!0)}},R=e=>{const{scope:r,contextStateRef:o,navigationStateRef:a,focusFirst:i}=e;if(i&&(C(e),D(e),t.focusFirstDataElement(e)),I(e),o.current&&a.current&&r){if(!t.tableKeyboardNavigationTools.getActiveNavDataElement(r,o.current.activeId)){const f=t.getFirstDataCell(a.current.navigationMatrix),c=t.tableKeyboardNavigationTools.getActiveNavDataElement(r,f);f&&c&&(o.current.activeId=f,c.setAttribute("tabIndex","0"),a.current.activeElementIsFocused&&c.focus())}a.current.activeElementIsFocused=!1}},S=(e,r)=>{const{contextStateRef:o}=r;if(e.isDefaultPrevented()||!o.current)return;const a=e.target,i=t.tableKeyboardNavigationTools.getNavigatableId(a);if(i&&i!==o.current.activeId){const n=t.tableKeyboardNavigationTools.getClosestScope(a);if(!n)return;const f=t.tableKeyboardNavigationTools.getActiveNavDataElement(n,o.current.activeId);f&&f.setAttribute("tabIndex","-1"),a.setAttribute("tabIndex","0"),o.current.activeId=i}},h=(e,r)=>{const{contextStateRef:o,navigationStateRef:a,onNavigationAction:i}=r;if(e.isDefaultPrevented()||!o.current||!a.current)return;let n;if(e.keyCode===s.Keys.esc){n=t.tableKeyboardNavigationTools.getClosestNavigatableElement(e.target),t.tableKeyboardNavigationTools.focusElement({elementForFocus:n,event:e,contextStateRef:o});return}const f=e.target,c=f.className.indexOf("k-checkbox")===-1?f:t.tableKeyboardNavigationTools.getClosestNavigatableElement(f),g=t.tableKeyboardNavigationTools.getNavigatableId(c),y=g==null?void 0:g.endsWith("column"),m=t.tableKeyboardNavigationTools.getNavigatableLevel(c),u=t.tableKeyboardNavigationTools.getClosestScope(c),v=a.current.navigationMatrix,N=e.metaKey||e.ctrlKey,b=t.getCurrentIdIndexes(a,v,g);if(m!==void 0&&u){if(e.keyCode===s.Keys.enter){const l=t.tableKeyboardNavigationTools.getNavigatableElement(c,{level:m+1});if(l){t.tableKeyboardNavigationTools.focusElement({elementForFocus:l,event:e,contextStateRef:o,prevElement:c});return}else{n=t.tableKeyboardNavigationTools.getFocusableElements(c)[0],t.tableKeyboardNavigationTools.focusElement({elementForFocus:n,event:e,contextStateRef:o,prevElement:c});return}}if(e.keyCode===s.Keys.home&&b)if(N)t.focusFirstDataElement({scope:u,navigationStateRef:a,contextStateRef:o},e);else{const l=t.getFirstRowDataCell(a.current.navigationMatrix,b[0]);n=t.tableKeyboardNavigationTools.getActiveNavDataElement(u,l),t.tableKeyboardNavigationTools.focusElement({elementForFocus:n,event:e,contextStateRef:o})}if(e.keyCode===s.Keys.end&&b)if(N){const l=t.getLastDataCell(a.current.navigationMatrix);n=t.tableKeyboardNavigationTools.getActiveNavDataElement(u,l),t.tableKeyboardNavigationTools.focusElement({elementForFocus:n,event:e,contextStateRef:o})}else{const l=t.getLastRowDataCell(a.current.navigationMatrix,b[0]);n=t.tableKeyboardNavigationTools.getActiveNavDataElement(u,l),t.tableKeyboardNavigationTools.focusElement({elementForFocus:n,event:e,contextStateRef:o})}if(e.keyCode===s.Keys.up||e.keyCode===s.Keys.down||e.keyCode===s.Keys.left||e.keyCode===s.Keys.right){const l=e.keyCode===s.Keys.up||e.keyCode===s.Keys.left,d=e.keyCode===s.Keys.up||e.keyCode===s.Keys.down;if(b){const[E,K]=b,[x,p]=d?t.findNextIdByRowIndex(E,K,g,v,l):t.findNextIdByCellIndex(E,K,g,v,l);x&&(n=t.tableKeyboardNavigationTools.getActiveNavDataElement(u,x),t.tableKeyboardNavigationTools.focusElement({elementForFocus:n,event:e,contextStateRef:o,prevElement:c}),a.current.prevNavigationIndexes=p)}}if(N&&e.keyCode===s.Keys.left&&y){i&&i({focusElement:c,event:e,action:"reorderToLeft"}),e.preventDefault();return}if(N&&e.keyCode===s.Keys.right&&y){i&&i({focusElement:c,event:e,action:"reorderToRight"}),e.preventDefault();return}if(e.keyCode===s.Keys.pageUp){i&&i({focusElement:n,event:e,action:"moveToNextPage"}),e.preventDefault();return}if(e.keyCode===s.Keys.pageDown){i&&i({focusElement:n,event:e,action:"moveToPrevPage"}),e.preventDefault();return}i&&i({focusElement:n,event:e})}},I=e=>{const{navigationStateRef:r,scope:o}=e;if(!r.current||!o)return;const a=[],i=t.getHeaderElement(o),n=t.getBodyElement(o),f=t.getNoRecordsElement(o)||{children:[]};if(!i||!n)return;const c=Array.from(i.children),g=Array.from(n.children);[...c,...g,f].forEach((y,m)=>{Array.from(y.children).forEach(u=>{const v=t.getNavigatableId(u);if(!v)return;const N=u.rowSpan||1,b=u.colSpan||1;let l;for(let d=m,E=m+N;d<E;d++){if(a[d]||(a[d]=[]),l===void 0){const K=a[d].findIndex(x=>!x);l=K>-1?K:a[d].length}a[d][l]=v||""}for(let d=l+1,E=l+b;d<E;d++)a[m][d]=v||""})}),r.current.navigationMatrix=a.filter(y=>!!y),r.current.lastHeaderIndex=c.length-1},F={onConstructor:C,onComponentDidMount:D,onGetSnapshotBeforeUpdate:T,onComponentDidUpdate:R,onFocus:S,onKeyDown:h,generateMatrix:I,focusFirstDataElement:t.focusFirstDataElement};exports.tableKeyboardNavigation=F;
@@ -6,140 +6,170 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import { guid as S, getActiveElement as C, Keys as f } from "@progress/kendo-react-common";
10
- import { tableKeyboardNavigationTools as a, findId as y, findNextIdByRowIndex as h, findNextIdByCellIndex as F, getHeaderElement as R, getBodyElement as A, getNavigatableId as D } from "./utils.mjs";
11
- const k = (e) => {
12
- const { navigatable: o, contextStateRef: n, navigationStateRef: t, idPrefix: c } = e;
13
- o && (n.current = {
9
+ import { guid as k, getActiveElement as A, Keys as l } from "@progress/kendo-react-common";
10
+ import { focusFirstDataElement as D, getFirstDataCell as N, tableKeyboardNavigationTools as o, getCurrentIdIndexes as F, getFirstRowDataCell as w, getLastRowDataCell as M, getLastDataCell as P, getHeaderElement as K, getBodyElement as L, getNoRecordsElement as T, getNavigatableId as B, findNextIdByRowIndex as H, findNextIdByCellIndex as U } from "./utils.mjs";
11
+ const R = (e) => {
12
+ const { navigatable: c, contextStateRef: n, navigationStateRef: t, idPrefix: r } = e;
13
+ c && (n.current = {
14
14
  activeId: "",
15
15
  level: 0
16
16
  }, t.current = {
17
17
  activeElementIsFocused: !1,
18
18
  prevNavigationIndexes: void 0,
19
- idPrefix: c || S(),
19
+ idPrefix: r || k(),
20
20
  navigationMatrix: [],
21
21
  lastHeaderIndex: -1
22
22
  });
23
- }, w = (e) => {
24
- const { scope: o, contextStateRef: n, navigationStateRef: t } = e;
25
- if (n.current && t.current && o) {
26
- N(e);
27
- const c = t.current.navigationMatrix.flat().find((r) => r.endsWith("cell"));
28
- if (c) {
29
- const r = a.getActiveNavDataElement(o, c);
30
- r && (n.current.activeId = c, r.setAttribute("tabIndex", "0"));
23
+ }, h = (e) => {
24
+ const { scope: c, contextStateRef: n, navigationStateRef: t } = e;
25
+ if (n.current && t.current && c) {
26
+ b(e);
27
+ const r = N(t.current.navigationMatrix);
28
+ if (r) {
29
+ const a = o.getActiveNavDataElement(c, r);
30
+ a && (n.current.activeId = r, a.setAttribute("tabIndex", "0"));
31
31
  }
32
32
  }
33
- }, M = (e) => {
34
- const { contextStateRef: o, navigationStateRef: n, document: t } = e;
35
- if (o.current && n.current && t) {
36
- const c = C(t), r = a.getNavigatableId(c);
37
- r && r === o.current.activeId && (n.current.activeElementIsFocused = !0);
33
+ }, O = (e) => {
34
+ const { contextStateRef: c, navigationStateRef: n, document: t } = e;
35
+ if (c.current && n.current && t) {
36
+ const r = A(t), a = o.getNavigatableId(r);
37
+ a && a === c.current.activeId && (n.current.activeElementIsFocused = !0);
38
38
  }
39
- }, B = (e) => {
40
- const { scope: o, contextStateRef: n, navigationStateRef: t } = e;
41
- if (N(e), n.current && t.current && o) {
42
- if (!a.getActiveNavDataElement(o, n.current.activeId)) {
43
- const r = t.current.navigationMatrix[0][0], i = a.getActiveNavDataElement(o, r);
44
- r && i && (n.current.activeId = r, i.setAttribute("tabIndex", "0"), t.current.activeElementIsFocused && i.focus());
39
+ }, G = (e) => {
40
+ const { scope: c, contextStateRef: n, navigationStateRef: t, focusFirst: r } = e;
41
+ if (r && (R(e), h(e), D(e)), b(e), n.current && t.current && c) {
42
+ if (!o.getActiveNavDataElement(c, n.current.activeId)) {
43
+ const f = N(t.current.navigationMatrix), i = o.getActiveNavDataElement(c, f);
44
+ f && i && (n.current.activeId = f, i.setAttribute("tabIndex", "0"), t.current.activeElementIsFocused && i.focus());
45
45
  }
46
46
  t.current.activeElementIsFocused = !1;
47
47
  }
48
- }, K = (e, o) => {
49
- const { contextStateRef: n } = o;
48
+ }, V = (e, c) => {
49
+ const { contextStateRef: n } = c;
50
50
  if (e.isDefaultPrevented() || !n.current)
51
51
  return;
52
- const t = e.target, c = a.getNavigatableId(t);
53
- if (c && c !== n.current.activeId) {
54
- const r = a.getClosestScope(t);
55
- if (!r)
52
+ const t = e.target, r = o.getNavigatableId(t);
53
+ if (r && r !== n.current.activeId) {
54
+ const a = o.getClosestScope(t);
55
+ if (!a)
56
56
  return;
57
- const i = a.getActiveNavDataElement(r, n.current.activeId);
58
- i && i.setAttribute("tabIndex", "-1"), t.setAttribute("tabIndex", "0"), n.current.activeId = c;
57
+ const f = o.getActiveNavDataElement(a, n.current.activeId);
58
+ f && f.setAttribute("tabIndex", "-1"), t.setAttribute("tabIndex", "0"), n.current.activeId = r;
59
59
  }
60
- }, P = (e, o) => {
60
+ }, W = (e, c) => {
61
61
  const {
62
62
  contextStateRef: n,
63
63
  navigationStateRef: t,
64
- onNavigationAction: c
65
- } = o;
64
+ onNavigationAction: r
65
+ } = c;
66
66
  if (e.isDefaultPrevented() || !n.current || !t.current)
67
67
  return;
68
- if (e.keyCode === f.esc) {
69
- const l = a.getClosestNavigatableElement(e.target);
70
- a.focusElement({ elementForFocus: l, event: e, contextStateRef: n });
68
+ let a;
69
+ if (e.keyCode === l.esc) {
70
+ a = o.getClosestNavigatableElement(e.target), o.focusElement({ elementForFocus: a, event: e, contextStateRef: n });
71
71
  return;
72
72
  }
73
- const r = e.target, i = r.className.indexOf("k-checkbox") === -1 ? r : a.getClosestNavigatableElement(r), v = a.getNavigatableId(i), m = a.getNavigatableLevel(i), I = a.getClosestScope(i), u = t.current.navigationMatrix;
74
- if (m !== void 0 && I) {
75
- if (e.keyCode === f.enter) {
76
- const l = a.getNavigatableElement(i, { level: m + 1 });
77
- if (l) {
78
- a.focusElement({
79
- elementForFocus: l,
73
+ const f = e.target, i = f.className.indexOf("k-checkbox") === -1 ? f : o.getClosestNavigatableElement(f), g = o.getNavigatableId(i), E = g == null ? void 0 : g.endsWith("column"), x = o.getNavigatableLevel(i), u = o.getClosestScope(i), v = t.current.navigationMatrix, I = e.metaKey || e.ctrlKey, m = F(t, v, g);
74
+ if (x !== void 0 && u) {
75
+ if (e.keyCode === l.enter) {
76
+ const s = o.getNavigatableElement(i, { level: x + 1 });
77
+ if (s) {
78
+ o.focusElement({
79
+ elementForFocus: s,
80
80
  event: e,
81
81
  contextStateRef: n,
82
82
  prevElement: i
83
83
  });
84
84
  return;
85
85
  } else {
86
- const E = a.getFocusableElements(i)[0];
87
- a.focusElement({ elementForFocus: E, event: e, contextStateRef: n, prevElement: i });
86
+ a = o.getFocusableElements(i)[0], o.focusElement({ elementForFocus: a, event: e, contextStateRef: n, prevElement: i });
88
87
  return;
89
88
  }
90
89
  }
91
- if (e.keyCode === f.up || e.keyCode === f.down || e.keyCode === f.left || e.keyCode === f.right) {
92
- const l = e.keyCode === f.up || e.keyCode === f.left, E = e.keyCode === f.up || e.keyCode === f.down;
93
- let g;
94
- if (t.current && t.current.prevNavigationIndexes) {
95
- const [d, s] = t.current.prevNavigationIndexes;
96
- u[d][s] === v ? g = t.current.prevNavigationIndexes : g = y(u, v);
97
- } else
98
- g = y(u, v);
99
- if (g) {
100
- const [d, s] = g, [x, p] = E ? h(d, s, v, u, l) : F(d, s, v, u, l);
101
- if (x) {
102
- const b = a.getActiveNavDataElement(I, x);
103
- a.focusElement({ elementForFocus: b, event: e, contextStateRef: n, prevElement: i }), t.current.prevNavigationIndexes = p, c && c({ focusElement: b, event: e });
104
- }
90
+ if (e.keyCode === l.home && m)
91
+ if (I)
92
+ D(
93
+ {
94
+ scope: u,
95
+ navigationStateRef: t,
96
+ contextStateRef: n
97
+ },
98
+ e
99
+ );
100
+ else {
101
+ const s = w(t.current.navigationMatrix, m[0]);
102
+ a = o.getActiveNavDataElement(u, s), o.focusElement({ elementForFocus: a, event: e, contextStateRef: n });
103
+ }
104
+ if (e.keyCode === l.end && m)
105
+ if (I) {
106
+ const s = P(t.current.navigationMatrix);
107
+ a = o.getActiveNavDataElement(u, s), o.focusElement({ elementForFocus: a, event: e, contextStateRef: n });
108
+ } else {
109
+ const s = M(t.current.navigationMatrix, m[0]);
110
+ a = o.getActiveNavDataElement(u, s), o.focusElement({ elementForFocus: a, event: e, contextStateRef: n });
105
111
  }
112
+ if (e.keyCode === l.up || e.keyCode === l.down || e.keyCode === l.left || e.keyCode === l.right) {
113
+ const s = e.keyCode === l.up || e.keyCode === l.left, d = e.keyCode === l.up || e.keyCode === l.down;
114
+ if (m) {
115
+ const [p, C] = m, [y, S] = d ? H(p, C, g, v, s) : U(p, C, g, v, s);
116
+ y && (a = o.getActiveNavDataElement(u, y), o.focusElement({ elementForFocus: a, event: e, contextStateRef: n, prevElement: i }), t.current.prevNavigationIndexes = S);
117
+ }
118
+ }
119
+ if (I && e.keyCode === l.left && E) {
120
+ r && r({ focusElement: i, event: e, action: "reorderToLeft" }), e.preventDefault();
121
+ return;
122
+ }
123
+ if (I && e.keyCode === l.right && E) {
124
+ r && r({ focusElement: i, event: e, action: "reorderToRight" }), e.preventDefault();
125
+ return;
126
+ }
127
+ if (e.keyCode === l.pageUp) {
128
+ r && r({ focusElement: a, event: e, action: "moveToNextPage" }), e.preventDefault();
129
+ return;
130
+ }
131
+ if (e.keyCode === l.pageDown) {
132
+ r && r({ focusElement: a, event: e, action: "moveToPrevPage" }), e.preventDefault();
133
+ return;
106
134
  }
135
+ r && r({ focusElement: a, event: e });
107
136
  }
108
- }, N = (e) => {
109
- const { navigationStateRef: o, scope: n } = e;
110
- if (!o.current || !n)
137
+ }, b = (e) => {
138
+ const { navigationStateRef: c, scope: n } = e;
139
+ if (!c.current || !n)
111
140
  return;
112
- const t = [], c = R(n), r = A(n);
113
- if (!c || !r)
141
+ const t = [], r = K(n), a = L(n), f = T(n) || { children: [] };
142
+ if (!r || !a)
114
143
  return;
115
- const i = Array.from(c.children), v = Array.from(r.children);
116
- [...i, ...v].forEach((m, I) => {
117
- Array.from(m.children).forEach((u) => {
118
- const l = D(u);
119
- if (!l)
144
+ const i = Array.from(r.children), g = Array.from(a.children);
145
+ [...i, ...g, f].forEach((E, x) => {
146
+ Array.from(E.children).forEach((u) => {
147
+ const v = B(u);
148
+ if (!v)
120
149
  return;
121
- const E = u.rowSpan || 1, g = u.colSpan || 1;
122
- let d;
123
- for (let s = I, x = I + E; s < x; s++) {
124
- if (t[s] || (t[s] = []), d === void 0) {
125
- const p = t[s].findIndex((b) => !b);
126
- d = p > -1 ? p : t[s].length;
150
+ const I = u.rowSpan || 1, m = u.colSpan || 1;
151
+ let s;
152
+ for (let d = x, p = x + I; d < p; d++) {
153
+ if (t[d] || (t[d] = []), s === void 0) {
154
+ const C = t[d].findIndex((y) => !y);
155
+ s = C > -1 ? C : t[d].length;
127
156
  }
128
- t[s][d] = l || "";
157
+ t[d][s] = v || "";
129
158
  }
130
- for (let s = d + 1, x = d + g; s < x; s++)
131
- t[I][s] = l || "";
159
+ for (let d = s + 1, p = s + m; d < p; d++)
160
+ t[x][d] = v || "";
132
161
  });
133
- }), o.current.navigationMatrix = t.filter((m) => !!m), o.current.lastHeaderIndex = i.length - 1;
134
- }, U = {
135
- onConstructor: k,
136
- onComponentDidMount: w,
137
- onGetSnapshotBeforeUpdate: M,
138
- onComponentDidUpdate: B,
139
- onFocus: K,
140
- onKeyDown: P,
141
- generateMatrix: N
162
+ }), c.current.navigationMatrix = t.filter((E) => !!E), c.current.lastHeaderIndex = i.length - 1;
163
+ }, z = {
164
+ onConstructor: R,
165
+ onComponentDidMount: h,
166
+ onGetSnapshotBeforeUpdate: O,
167
+ onComponentDidUpdate: G,
168
+ onFocus: V,
169
+ onKeyDown: W,
170
+ generateMatrix: b,
171
+ focusFirstDataElement: D
142
172
  };
143
173
  export {
144
- U as tableKeyboardNavigation
174
+ z as tableKeyboardNavigation
145
175
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@progress/kendo-react-common"),o=require("./constants.js"),i=(e,t,n="cell")=>`${t}_${e}_${n}`,A=e=>{if(e)return parseInt(e.getAttribute(o.KEYBOARD_NAV_DATA_LEVEL)||"",10)},E=e=>{if(!e)return;const t=e.getAttribute(o.KEYBOARD_NAV_DATA_ID);return t||void 0},u=e=>e?!!e.getAttribute(o.KEYBOARD_NAV_DATA_ID):!1,g=(e,t={level:0})=>e.querySelector(`[${o.KEYBOARD_NAV_DATA_LEVEL}='${t.level}']`),d=e=>e&&e.parentElement&&e.parentElement.closest(`[${o.KEYBOARD_NAV_DATA_LEVEL}]`),N=(e,t)=>e.querySelector(`[${o.KEYBOARD_NAV_DATA_ID}='${t}']`),_=e=>e&&e.parentElement&&e.parentElement.closest(`[${o.KEYBOARD_NAV_DATA_SCOPE}]`),f=e=>e.querySelector(`[${o.KEYBOARD_NAV_DATA_HEADER}]`),b=e=>e.querySelector(`[${o.KEYBOARD_NAV_DATA_BODY}]`),v=(e,t={focusable:!1})=>{const n=t.focusable?s.FOCUSABLE_ELEMENTS:s.TABBABLE_ELEMENTS;return Array.from(e.querySelectorAll(n.join(",")))},D=(e,t={level:0})=>{if(!e)return[];const n=s.FOCUSABLE_ELEMENTS.map(l=>l+`[${o.KEYBOARD_NAV_DATA_LEVEL}='${t.level}']`).join(",");return Array.from(e.querySelectorAll(n))},I=(e={level:0})=>{const t=s.FOCUSABLE_ELEMENTS.map(n=>n+`[${o.KEYBOARD_NAV_DATA_LEVEL}='${e.level}']`).join(",");return n=>n.matches(t)},m=e=>{const{elementForFocus:t,event:n,contextStateRef:l,prevElement:a}=e;if(l.current&&t&&t.focus){n.preventDefault();const r=t.querySelector(".k-checkbox-wrap .k-checkbox");r&&r.focus?r.focus():t.focus(),u(t)&&(t.setAttribute("tabIndex","0"),l.current.activeId=E(t)),a&&u(a)&&a.setAttribute("tabIndex","-1")}},B=e=>e.current?e.current.idPrefix:"",L=(e,t,n,l,a)=>{if(!n)return[];let r=e+(a?-1:1);for(;r>=0&&r<l.length;){const c=l[r][t];if(c!==n)return[c,[r,t]];r=r+(a?-1:1)}return[]},T=(e,t,n,l,a)=>{if(!n)return[];let r=t+(a?-1:1);for(;r>=0&&r<l[e].length;){const c=l[e][r];if(c!==n)return[c,[e,r]];r=r+(a?-1:1)}return[]},x=(e,t)=>{if(t){for(let n=0;n<e.length;n++)for(let l=0;l<e[n].length;l++)if(e[n][l]===t)return[n,l]}},y=e=>e.current?e.current.navigationMatrix.length:0,O=e=>e?`${e}${o.KEYBOARD_NAV_FILTER_COL_SUFFIX}`:"",S={generateNavigatableId:i,getNavigatableId:E,getNavigatableLevel:A,getNavigatableElement:g,getClosestNavigatableElement:d,getActiveNavDataElement:N,getClosestScope:_,getHeaderElement:f,getBodyElement:b,getFocusableElements:v,getNavigatableElements:D,filterNavigatableElements:I,focusElement:m,getIdPrefix:B,isNavigatable:u,findNextIdByRowIndex:L,findNextIdByCellIndex:T,findId:x,getNextNavigationIndex:y,getFilterColumnId:O};exports.filterNavigatableElements=I;exports.findId=x;exports.findNextIdByCellIndex=T;exports.findNextIdByRowIndex=L;exports.focusElement=m;exports.generateNavigatableId=i;exports.getActiveNavDataElement=N;exports.getBodyElement=b;exports.getClosestNavigatableElement=d;exports.getClosestScope=_;exports.getFilterColumnId=O;exports.getFocusableElements=v;exports.getHeaderElement=f;exports.getIdPrefix=B;exports.getNavigatableElement=g;exports.getNavigatableElements=D;exports.getNavigatableId=E;exports.getNavigatableLevel=A;exports.getNextNavigationIndex=y;exports.isNavigatable=u;exports.tableKeyboardNavigationTools=S;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@progress/kendo-react-common"),a=require("./constants.js"),d=(e,t,r="cell")=>`${t}_${e}_${r}`,f=e=>{if(e)return parseInt(e.getAttribute(a.KEYBOARD_NAV_DATA_LEVEL)||"",10)},E=e=>{if(!e)return;const t=e.getAttribute(a.KEYBOARD_NAV_DATA_ID);return t||void 0},u=e=>e?!!e.getAttribute(a.KEYBOARD_NAV_DATA_ID):!1,N=(e,t={level:0})=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_LEVEL}='${t.level}']`),_=e=>e&&e.parentElement&&e.parentElement.closest(`[${a.KEYBOARD_NAV_DATA_LEVEL}]`),g=(e,t)=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_ID}='${t}']`),D=e=>e&&e.parentElement&&e.parentElement.closest(`[${a.KEYBOARD_NAV_DATA_SCOPE}]`),I=e=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_HEADER}]`),v=e=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_BODY}]`),O=e=>e.querySelector(".k-grid-norecords"),b=(e,t)=>{const{scope:r,navigationStateRef:n,contextStateRef:o}=e;if(!n.current||!r)return;const l=R(n.current.navigationMatrix),s=g(r,l);A({elementForFocus:s,contextStateRef:o,event:t})},m=(e,t={focusable:!1})=>{const r=t.focusable?c.FOCUSABLE_ELEMENTS:c.TABBABLE_ELEMENTS;return Array.from(e.querySelectorAll(r.join(",")))},x=(e,t={level:0})=>{if(!e)return[];const r=c.FOCUSABLE_ELEMENTS.map(n=>n+`[${a.KEYBOARD_NAV_DATA_LEVEL}='${t.level}']`).join(",");return Array.from(e.querySelectorAll(r))},C=(e={level:0})=>{const t=c.FOCUSABLE_ELEMENTS.map(r=>r+`[${a.KEYBOARD_NAV_DATA_LEVEL}='${e.level}']`).join(",");return r=>r.matches(t)},A=e=>{const{elementForFocus:t,event:r,contextStateRef:n,prevElement:o}=e;if(n.current&&t&&t.focus){r==null||r.preventDefault();const l=t.querySelector(".k-checkbox-wrap .k-checkbox");l&&l.focus?l.focus():t.focus(),u(t)&&(t.setAttribute("tabIndex","0"),n.current.activeId=E(t)),o&&u(o)&&o.setAttribute("tabIndex","-1")}},B=e=>e.current?e.current.idPrefix:"",L=(e,t,r,n,o)=>{if(!r)return[];let l=e+(o?-1:1);for(;l>=0&&l<n.length;){const s=n[l][t];if(s!==r)return[s,[l,t]];l=l+(o?-1:1)}return[]},y=(e,t,r,n,o)=>{if(!r)return[];let l=t+(o?-1:1);for(;l>=0&&l<n[e].length;){const s=n[e][l];if(s!==r)return[s,[e,l]];l=l+(o?-1:1)}return[]},i=(e,t)=>{if(t){for(let r=0;r<e.length;r++)for(let n=0;n<e[r].length;n++)if(e[r][n]===t)return[r,n]}},F=e=>e.current?e.current.navigationMatrix.length:0,R=e=>e.flat().find(t=>t.endsWith("cell")),S=e=>e.flat().reverse().find(t=>t.endsWith("cell")),V=(e,t)=>e[t][0],$=(e,t)=>Array.from(e[t]).reverse()[0],T=e=>e?`${e}${a.KEYBOARD_NAV_FILTER_COL_SUFFIX}`:"",p=(e,t,r)=>{let n;if(e.current&&e.current.prevNavigationIndexes){const[o,l]=e.current.prevNavigationIndexes;t[o][l]===r?n=e.current.prevNavigationIndexes:n=i(t,r)}else n=i(t,r);return n},K={generateNavigatableId:d,getNavigatableId:E,getNavigatableLevel:f,getNavigatableElement:N,getClosestNavigatableElement:_,getActiveNavDataElement:g,getClosestScope:D,getHeaderElement:I,getBodyElement:v,getFocusableElements:m,getNavigatableElements:x,filterNavigatableElements:C,focusElement:A,getIdPrefix:B,isNavigatable:u,findNextIdByRowIndex:L,findNextIdByCellIndex:y,findId:i,getNextNavigationIndex:F,getFilterColumnId:T,focusFirstDataElement:b};exports.filterNavigatableElements=C;exports.findId=i;exports.findNextIdByCellIndex=y;exports.findNextIdByRowIndex=L;exports.focusElement=A;exports.focusFirstDataElement=b;exports.generateNavigatableId=d;exports.getActiveNavDataElement=g;exports.getBodyElement=v;exports.getClosestNavigatableElement=_;exports.getClosestScope=D;exports.getCurrentIdIndexes=p;exports.getFilterColumnId=T;exports.getFirstDataCell=R;exports.getFirstRowDataCell=V;exports.getFocusableElements=m;exports.getHeaderElement=I;exports.getIdPrefix=B;exports.getLastDataCell=S;exports.getLastRowDataCell=$;exports.getNavigatableElement=N;exports.getNavigatableElements=x;exports.getNavigatableId=E;exports.getNavigatableLevel=f;exports.getNextNavigationIndex=F;exports.getNoRecordsElement=O;exports.isNavigatable=u;exports.tableKeyboardNavigationTools=K;