@progress/kendo-react-data-tools 8.2.0-develop.8 → 8.2.0
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/dist/cdn/js/kendo-react-datatools.js +1 -1
- package/drag/ColumnDraggable.js +1 -1
- package/drag/ColumnDraggable.mjs +2 -1
- package/drag/ColumnResizer.js +1 -1
- package/drag/ColumnResizer.mjs +1 -0
- package/filter/Expression.js +1 -1
- package/filter/Expression.mjs +12 -10
- package/filter/Filter.js +1 -1
- package/filter/Filter.mjs +103 -35
- package/filter/Group.js +1 -1
- package/filter/Group.mjs +17 -17
- package/filter/filters/DateFilter.js +1 -1
- package/filter/filters/DateFilter.mjs +4 -3
- package/filter/filters/EnumFilter.js +1 -1
- package/filter/filters/EnumFilter.mjs +2 -1
- package/filter/filters/NumericFilter.js +1 -1
- package/filter/filters/NumericFilter.mjs +2 -1
- package/filter/filters/TextFilter.js +1 -1
- package/filter/filters/TextFilter.mjs +2 -1
- package/header/FilterRow.js +1 -1
- package/header/FilterRow.mjs +34 -27
- package/header/Header.js +1 -1
- package/header/Header.mjs +7 -3
- package/header/HeaderThElement.js +1 -1
- package/header/HeaderThElement.mjs +27 -23
- package/index.d.mts +86 -12
- package/index.d.ts +86 -12
- package/index.js +1 -1
- package/index.mjs +130 -125
- package/navigation/NavigatableSettings.js +8 -0
- package/navigation/NavigatableSettings.mjs +12 -0
- package/navigation/TableKeyboardNavigation.js +1 -1
- package/navigation/TableKeyboardNavigation.mjs +197 -113
- package/navigation/constants.js +1 -1
- package/navigation/constants.mjs +11 -9
- package/navigation/utils.js +1 -1
- package/navigation/utils.mjs +173 -80
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
package/index.mjs
CHANGED
|
@@ -12,143 +12,148 @@ import { ColumnResizer as a } from "./drag/ColumnResizer.mjs";
|
|
|
12
12
|
import { CommonDragLogic as p } from "./drag/CommonDragLogic.mjs";
|
|
13
13
|
import { DragClue as x } from "./drag/DragClue.mjs";
|
|
14
14
|
import { DropClue as f } from "./drag/DropClue.mjs";
|
|
15
|
-
import { createDataTree as A, extendDataItem as
|
|
16
|
-
import { getGroupIds as
|
|
17
|
-
import { useTableKeyboardNavigation as
|
|
18
|
-
import { KEYBOARD_NAV_DATA_BODY as K, KEYBOARD_NAV_DATA_HEADER as
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
15
|
+
import { createDataTree as A, extendDataItem as _, filterBy as T, flatData as E, getItemPath as d, modifySubItems as D, moveTreeItem as s, orderBy as N, removeItems as F, treeToFlat as b } from "./utils/data-operations.mjs";
|
|
16
|
+
import { getGroupIds as O, setExpandedState as B, setGroupIds as R } from "./utils/group-operations.mjs";
|
|
17
|
+
import { useTableKeyboardNavigation as I } from "./navigation/hooks.mjs";
|
|
18
|
+
import { KEYBOARD_NAV_CANCEL_BUTTON_CLASS as L, KEYBOARD_NAV_DATA_BODY as K, KEYBOARD_NAV_DATA_HEADER as M, KEYBOARD_NAV_DATA_ID as y, KEYBOARD_NAV_DATA_LEVEL as v, KEYBOARD_NAV_DATA_SCOPE as V, KEYBOARD_NAV_DATA_ZONE as Y, KEYBOARD_NAV_EDIT_BUTTON_CLASS as H, KEYBOARD_NAV_FILTER_COL_SUFFIX as P, tableKeyboardNavigationBodyAttributes as U, tableKeyboardNavigationHeaderAttributes as w, tableKeyboardNavigationScopeAttributes as z } from "./navigation/constants.mjs";
|
|
19
|
+
import { NavigatableMode as G } from "./navigation/NavigatableSettings.mjs";
|
|
20
|
+
import { tableKeyboardNavigation as W } from "./navigation/TableKeyboardNavigation.mjs";
|
|
21
|
+
import { TableKeyboardNavigationContext as j } from "./navigation/TableKeyboardNavigationContext.mjs";
|
|
22
|
+
import { tableKeyboardNavigationTools as q } from "./navigation/utils.mjs";
|
|
23
|
+
import { TableSelection as Q } from "./selection/TableSelection.mjs";
|
|
24
|
+
import { TABLE_COL_INDEX_ATTRIBUTE as ee, TABLE_PREVENT_SELECTION_ELEMENT as oe, TABLE_ROW_INDEX_ATTRIBUTE as re } from "./selection/constants.mjs";
|
|
25
|
+
import { closestTagName as me, getColumnIndex as le, getOffset as ae, getRowIndex as ne, getSelectedState as pe, getSelectedStateFromKeyDown as ie, getSelectionOptions as xe, isInNonSelectable as ue, relativeContextElement as fe, setSelectedState as Ce } from "./selection/utils.mjs";
|
|
26
|
+
import { ClipboardService as _e } from "./clipboard/clipboard.service.mjs";
|
|
27
|
+
import { ClipboardActionType as Ee, populateClipboardData as de } from "./clipboard/common.mjs";
|
|
28
|
+
import { createFilterComponent as se } from "./filteringCells/FilterComponent.mjs";
|
|
29
|
+
import { BooleanFilterCell as Fe } from "./filteringCells/BooleanFilter.mjs";
|
|
30
|
+
import { DateFilterCell as ge } from "./filteringCells/DateFilter.mjs";
|
|
31
|
+
import { NumericFilterCell as Be } from "./filteringCells/NumericFilter.mjs";
|
|
32
|
+
import { TextFilterCell as Se } from "./filteringCells/TextFilter.mjs";
|
|
33
|
+
import { ColumnDefaultProps as ce } from "./header/ColumnProps.mjs";
|
|
34
|
+
import { FILTER_ROW_CLASS as Ke, FilterRow as Me } from "./header/FilterRow.mjs";
|
|
35
|
+
import { Header as ve } from "./header/Header.mjs";
|
|
36
|
+
import { HeaderCell as Ye } from "./header/HeaderCell.mjs";
|
|
37
|
+
import { HeaderRow as Pe } from "./header/HeaderRow.mjs";
|
|
38
|
+
import { HeaderSelectionCell as we } from "./header/HeaderSelectionCell.mjs";
|
|
39
|
+
import { normalize as he } from "./header/SortSettings.mjs";
|
|
40
|
+
import { getIndex as Xe, isRtl as We, mapColumns as Ze, nextColumn as je, readColumns as ke, updateLeft as qe, updateRight as Je } from "./header/utils/index.mjs";
|
|
41
|
+
import { HeaderThElement as $e } from "./header/HeaderThElement.mjs";
|
|
42
|
+
import { tableColumnsVirtualization as oo } from "./virtualization/columns.mjs";
|
|
43
|
+
import { TextFilter as to } from "./filter/filters/TextFilter.mjs";
|
|
44
|
+
import { NumericFilter as lo } from "./filter/filters/NumericFilter.mjs";
|
|
45
|
+
import { DateFilter as no } from "./filter/filters/DateFilter.mjs";
|
|
46
|
+
import { BooleanFilter as io } from "./filter/filters/BooleanFilter.mjs";
|
|
47
|
+
import { EnumFilter as uo } from "./filter/filters/EnumFilter.mjs";
|
|
48
|
+
import { Expression as Co } from "./filter/Expression.mjs";
|
|
49
|
+
import { Filter as _o, selectors as To } from "./filter/Filter.mjs";
|
|
50
|
+
import { Group as Do } from "./filter/Group.mjs";
|
|
51
|
+
import { Operators as No, stringOperator as Fo, unaryOperator as bo } from "./filter/operators.mjs";
|
|
52
|
+
import { ColumnMenuBooleanColumn as Oo, ColumnMenuDateColumn as Bo, ColumnMenuNumericColumn as Ro, ColumnMenuTextColumn as So } from "./columnmenu/ColumnMenu.mjs";
|
|
53
|
+
import { ColumnMenuFilterForm as co, ColumnMenuForm as Lo } from "./columnmenu/ColumnMenuFilterForm.mjs";
|
|
54
|
+
import { ColumnMenuFilterLogic as Mo } from "./columnmenu/ColumnMenuFilterLogic.mjs";
|
|
55
|
+
import { ColumnMenuBooleanFilter as vo, ColumnMenuDateFilter as Vo, ColumnMenuNumericFilter as Yo, ColumnMenuTextFilter as Ho } from "./columnmenu/ColumnMenuFilters.mjs";
|
|
56
|
+
import { ColumnMenuItem as Uo } from "./columnmenu/ColumnMenuItem.mjs";
|
|
57
|
+
import { ColumnMenuOperators as zo } from "./columnmenu/ColumnMenuOperators.mjs";
|
|
57
58
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
59
|
+
io as BooleanFilter,
|
|
60
|
+
Fe as BooleanFilterCell,
|
|
61
|
+
Ee as ClipboardActionType,
|
|
62
|
+
_e as ClipboardService,
|
|
63
|
+
ce as ColumnDefaultProps,
|
|
64
|
+
Oo as ColumnMenuBooleanColumn,
|
|
65
|
+
vo as ColumnMenuBooleanFilter,
|
|
66
|
+
Bo as ColumnMenuDateColumn,
|
|
67
|
+
Vo as ColumnMenuDateFilter,
|
|
68
|
+
co as ColumnMenuFilterForm,
|
|
69
|
+
Mo as ColumnMenuFilterLogic,
|
|
70
|
+
Lo as ColumnMenuForm,
|
|
71
|
+
Uo as ColumnMenuItem,
|
|
72
|
+
Ro as ColumnMenuNumericColumn,
|
|
73
|
+
Yo as ColumnMenuNumericFilter,
|
|
74
|
+
zo as ColumnMenuOperators,
|
|
75
|
+
So as ColumnMenuTextColumn,
|
|
76
|
+
Ho as ColumnMenuTextFilter,
|
|
76
77
|
m as ColumnResize,
|
|
77
78
|
a as ColumnResizer,
|
|
78
79
|
p as CommonDragLogic,
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
no as DateFilter,
|
|
81
|
+
ge as DateFilterCell,
|
|
81
82
|
x as DragClue,
|
|
82
83
|
f as DropClue,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
uo as EnumFilter,
|
|
85
|
+
Co as Expression,
|
|
86
|
+
Ke as FILTER_ROW_CLASS,
|
|
87
|
+
_o as Filter,
|
|
88
|
+
Me as FilterRow,
|
|
89
|
+
Do as Group,
|
|
90
|
+
ve as Header,
|
|
91
|
+
Ye as HeaderCell,
|
|
92
|
+
Pe as HeaderRow,
|
|
93
|
+
we as HeaderSelectionCell,
|
|
94
|
+
$e as HeaderThElement,
|
|
95
|
+
L as KEYBOARD_NAV_CANCEL_BUTTON_CLASS,
|
|
94
96
|
K as KEYBOARD_NAV_DATA_BODY,
|
|
95
|
-
|
|
97
|
+
M as KEYBOARD_NAV_DATA_HEADER,
|
|
96
98
|
y as KEYBOARD_NAV_DATA_ID,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
v as KEYBOARD_NAV_DATA_LEVEL,
|
|
100
|
+
V as KEYBOARD_NAV_DATA_SCOPE,
|
|
101
|
+
Y as KEYBOARD_NAV_DATA_ZONE,
|
|
102
|
+
H as KEYBOARD_NAV_EDIT_BUTTON_CLASS,
|
|
103
|
+
P as KEYBOARD_NAV_FILTER_COL_SUFFIX,
|
|
104
|
+
G as NavigatableMode,
|
|
105
|
+
lo as NumericFilter,
|
|
106
|
+
Be as NumericFilterCell,
|
|
107
|
+
No as Operators,
|
|
104
108
|
r as Pager,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
ee as TABLE_COL_INDEX_ATTRIBUTE,
|
|
110
|
+
oe as TABLE_PREVENT_SELECTION_ELEMENT,
|
|
111
|
+
re as TABLE_ROW_INDEX_ATTRIBUTE,
|
|
112
|
+
j as TableKeyboardNavigationContext,
|
|
113
|
+
Q as TableSelection,
|
|
114
|
+
to as TextFilter,
|
|
115
|
+
Se as TextFilterCell,
|
|
116
|
+
me as closestTagName,
|
|
113
117
|
A as createDataTree,
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
se as createFilterComponent,
|
|
119
|
+
_ as extendDataItem,
|
|
116
120
|
T as filterBy,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
121
|
+
E as flatData,
|
|
122
|
+
le as getColumnIndex,
|
|
123
|
+
O as getGroupIds,
|
|
124
|
+
Xe as getIndex,
|
|
125
|
+
d as getItemPath,
|
|
126
|
+
ae as getOffset,
|
|
127
|
+
ne as getRowIndex,
|
|
128
|
+
pe as getSelectedState,
|
|
129
|
+
ie as getSelectedStateFromKeyDown,
|
|
130
|
+
xe as getSelectionOptions,
|
|
131
|
+
ue as isInNonSelectable,
|
|
132
|
+
We as isRtl,
|
|
133
|
+
Ze as mapColumns,
|
|
130
134
|
D as modifySubItems,
|
|
131
135
|
s as moveTreeItem,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
w as
|
|
148
|
-
|
|
136
|
+
je as nextColumn,
|
|
137
|
+
he as normalize,
|
|
138
|
+
N as orderBy,
|
|
139
|
+
de as populateClipboardData,
|
|
140
|
+
ke as readColumns,
|
|
141
|
+
fe as relativeContextElement,
|
|
142
|
+
F as removeItems,
|
|
143
|
+
To as selectors,
|
|
144
|
+
B as setExpandedState,
|
|
145
|
+
R as setGroupIds,
|
|
146
|
+
Ce as setSelectedState,
|
|
147
|
+
Fo as stringOperator,
|
|
148
|
+
oo as tableColumnsVirtualization,
|
|
149
|
+
W as tableKeyboardNavigation,
|
|
150
|
+
U as tableKeyboardNavigationBodyAttributes,
|
|
151
|
+
w as tableKeyboardNavigationHeaderAttributes,
|
|
152
|
+
z as tableKeyboardNavigationScopeAttributes,
|
|
153
|
+
q as tableKeyboardNavigationTools,
|
|
149
154
|
b as treeToFlat,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
155
|
+
bo as unaryOperator,
|
|
156
|
+
qe as updateLeft,
|
|
157
|
+
Je as updateRight,
|
|
158
|
+
I as useTableKeyboardNavigation
|
|
154
159
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var i=(e=>(e.incell="incell",e.inline="inline",e))(i||{});exports.NavigatableMode=i;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
var e = /* @__PURE__ */ ((n) => (n.incell = "incell", n.inline = "inline", n))(e || {});
|
|
10
|
+
export {
|
|
11
|
+
e as NavigatableMode
|
|
12
|
+
};
|
|
@@ -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
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@progress/kendo-react-common"),t=require("./utils.js"),p=require("./NavigatableSettings.js"),F=e=>{const{navigatable:n,contextStateRef:i,navigationStateRef:o,idPrefix:r}=e;n&&(i.current={activeId:"",level:0},o.current={activeElementIsFocused:!1,prevNavigationIndexes:void 0,idPrefix:r||l.guid(),navigationMatrix:[],lastHeaderIndex:-1})},h=e=>{const{scope:n,contextStateRef:i,navigationStateRef:o}=e;if(i.current&&o.current&&n){R(e);const r=t.getFirstDataCell(o.current.navigationMatrix);if(r){const g=t.tableKeyboardNavigationTools.getActiveNavDataElement(n,r);g&&(i.current.activeId=r,g.setAttribute("tabIndex","0"))}}},S=e=>{const{contextStateRef:n,navigationStateRef:i,document:o}=e;if(n.current&&i.current&&o){const r=l.getActiveElement(o),g=t.tableKeyboardNavigationTools.getNavigatableId(r);g&&g===n.current.activeId&&(i.current.activeElementIsFocused=!0)}},B=e=>{const{scope:n,contextStateRef:i,navigationStateRef:o,focusFirst:r,newEditableRow:g,singleEditRow:c,lastActiveElement:v,navigatable:a}=e;if(r&&(F(e),h(e),t.focusFirstDataElement(e)),(!a||a&&a.mode===p.NavigatableMode.inline)&&(g&&!c||g&&c&&!v)?t.focusFirstEditor(g):a&&a.mode===p.NavigatableMode.inline&&g&&c&&v&&v.focus(),R(e),i.current&&o.current&&n){if(!t.tableKeyboardNavigationTools.getActiveNavDataElement(n,i.current.activeId)){const N=n.className.indexOf("k-treelist")===-1?t.getFirstDataCell(o.current.navigationMatrix):o.current.navigationMatrix[0][0],C=t.tableKeyboardNavigationTools.getActiveNavDataElement(n,N);N&&C&&(i.current.activeId=N,C.setAttribute("tabIndex","0"),o.current.activeElementIsFocused&&C.focus())}o.current.activeElementIsFocused=!1}},M=(e,n)=>{const{contextStateRef:i}=n;if(e.isDefaultPrevented()||!i.current)return;const o=e.target,r=t.tableKeyboardNavigationTools.getNavigatableId(o);if(r&&r!==i.current.activeId){const g=t.tableKeyboardNavigationTools.getClosestScope(o);if(!g)return;const c=t.tableKeyboardNavigationTools.getActiveNavDataElement(g,i.current.activeId);c&&!e.target.classList.contains("k-table-td")&&!e.target.classList.contains("k-detail-cell")&&c.setAttribute("tabIndex","-1"),o.setAttribute("tabIndex","0"),i.current.activeId=r}else if(o.closest(".k-filtercell")&&n.navigatable){const g=o.closest(".k-table-th");l.enableNavigatableContainer(g)}},L=async(e,n)=>{var T,x,k,D;const{contextStateRef:i,navigationStateRef:o,onNavigationAction:r,columns:g}=n;if(e.isDefaultPrevented()||!i.current||!o.current)return;let c;if(e.keyCode===l.Keys.esc&&!n.navigatable.mode){c=t.tableKeyboardNavigationTools.getClosestNavigatableElement(e.target),t.tableKeyboardNavigationTools.focusElement({elementForFocus:c,event:e,contextStateRef:i}),e.target.closest(".k-filtercell")&&c&&n.navigatable&&l.disableNavigatableContainer(c);return}const v=e.target,a=v.className.indexOf("k-checkbox")===-1?v:t.tableKeyboardNavigationTools.getClosestNavigatableElement(v),u=t.tableKeyboardNavigationTools.getNavigatableId(a)||((T=t.tableKeyboardNavigationTools.getParentCell(a))==null?void 0:T.getAttribute("data-keyboardnavid")),N=u==null?void 0:u.endsWith("column"),C=t.tableKeyboardNavigationTools.getNavigatableLevel(a),K=t.tableKeyboardNavigationTools.getClosestScope(a),E=o.current.navigationMatrix,I=e.metaKey||e.ctrlKey,b=t.getCurrentIdIndexes(o,E,u),y=a.closest(".k-table-th");if(n.navigatable&&n.navigatable.mode===p.NavigatableMode.inline){if(e.keyCode===l.Keys.enter){const d=a.classList.contains("k-grid-remove-command"),s=a.classList.contains("k-grid-cancel-command"),f=t.tableKeyboardNavigationTools.getRowAriaRowIndex(a);if(d){setTimeout(()=>{const m=t.tableKeyboardNavigationTools.getRemoveButtonByAriaRowIndex(f.current)||t.tableKeyboardNavigationTools.getRemoveButtonByAriaRowIndex(f.prev);m&&m.focus()});return}else if(s&&a.parentElement){const m=(x=t.tableKeyboardNavigationTools.getClosestNavigatableElement(a))==null?void 0:x.getAttribute("data-keyboardnavid");setTimeout(()=>{m&&t.tableKeyboardNavigationTools.getTableCellByKeyboardNavId(m).focus()});return}}if(e.keyCode===l.Keys.esc){const d=t.tableKeyboardNavigationTools.getClosestCancelButton(a);d&&d.click();const s=await t.tableKeyboardNavigationTools.getClosestEditButton(a);s&&s.focus();return}}else if(n.navigatable&&n.navigatable.mode===p.NavigatableMode.incell){const d=(k=a.closest(".k-table-td"))==null?void 0:k.classList.contains("k-grid-edit-cell");if(e.keyCode===l.Keys.esc){a.focus(),a.blur();const s=v&&v.parentElement&&v.parentElement.closest(".k-grid-edit-row"),f=t.tableKeyboardNavigationTools.getClosestCellNavId(a),m=await t.tableKeyboardNavigationTools.waitForElementToBeVisible(`[data-keyboardnavid='${f}']:not(.k-grid-edit-cell)`,s);m&&m.focus()}else if(e.keyCode===l.Keys.enter){let s;if(b){const[f,m]=b;s=t.findNextIdByRowIndex(f,m,u,E,!1)}if(!d)(D=t.tableKeyboardNavigationTools.getParentCell(a))==null||D.click();else if(d&&s){const f=s&&s[0]&&t.tableKeyboardNavigationTools.getTableCellByKeyboardNavId(s[0]);f&&f.click()}}else if(e.keyCode===l.Keys.left){if(d)return}else if(e.keyCode===l.Keys.right){if(d)return}else if(e.keyCode===l.Keys.up){if(d)return}else if(e.keyCode===l.Keys.down){if(d)return}else if(e.keyCode===l.Keys.tab&&d){if(e.shiftKey){const s=b&&g&&t.tableKeyboardNavigationTools.getPrevEditableCell(b,g,u,E);if(s&&s.prevCell&&s.prevCell.click(),s&&s.elementToFocus!=="gridcell"){a.blur();const f=t.tableKeyboardNavigationTools.getClosestCellNavId(a);setTimeout(()=>{f&&t.tableKeyboardNavigationTools.getTableCellByKeyboardNavId(f).focus()})}e.preventDefault()}else{const s=b&&g&&t.tableKeyboardNavigationTools.getNextEditableCell(b,g,u,E);if(s&&s.nextCell&&s.elementToFocus==="gridcell"&&s.nextCell.click(),s&&s.elementToFocus!=="gridcell"){a.blur();const f=t.tableKeyboardNavigationTools.getClosestCellNavId(a);f&&t.tableKeyboardNavigationTools.getTableCellByKeyboardNavId(f).focus();return}e.preventDefault()}e.preventDefault()}}if(a.closest(".k-filtercell")&&y&&n.navigatable&&l.keepFocusInContainer(e,y,l.TABBABLE_ELEMENTS),C!==void 0&&K){if(e.keyCode===l.Keys.enter){const d=t.tableKeyboardNavigationTools.getNavigatableElement(a,{level:C+1});if(d){t.tableKeyboardNavigationTools.focusElement({elementForFocus:d,event:e,contextStateRef:i,prevElement:a});return}else{a.querySelector(".k-filtercell")&&n.navigatable&&l.enableNavigatableContainer(a),c=t.tableKeyboardNavigationTools.getFocusableElements(a)[0],t.tableKeyboardNavigationTools.focusElement({elementForFocus:c,event:e,contextStateRef:i,prevElement:a});return}}if(e.keyCode===l.Keys.home&&b)if(I)t.focusFirstDataElement({scope:K,navigationStateRef:o,contextStateRef:i},e);else{const d=t.getFirstRowDataCell(o.current.navigationMatrix,b[0]);c=t.tableKeyboardNavigationTools.getActiveNavDataElement(K,d),t.tableKeyboardNavigationTools.focusElement({elementForFocus:c,event:e,contextStateRef:i})}if(e.keyCode===l.Keys.end&&b)if(I){const d=t.getLastDataCell(o.current.navigationMatrix);c=t.tableKeyboardNavigationTools.getActiveNavDataElement(K,d),t.tableKeyboardNavigationTools.focusElement({elementForFocus:c,event:e,contextStateRef:i})}else{const d=t.getLastRowDataCell(o.current.navigationMatrix,b[0]);c=t.tableKeyboardNavigationTools.getActiveNavDataElement(K,d),t.tableKeyboardNavigationTools.focusElement({elementForFocus:c,event:e,contextStateRef:i})}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,s=e.keyCode===l.Keys.up||e.keyCode===l.Keys.down;if(b){const[f,m]=b,[w,A]=s?t.findNextIdByRowIndex(f,m,u,E,d):t.findNextIdByCellIndex(f,m,u,E,d);w&&(c=t.tableKeyboardNavigationTools.getActiveNavDataElement(K,w),t.tableKeyboardNavigationTools.focusElement({elementForFocus:c,event:e,contextStateRef:i,prevElement:a}),o.current.prevNavigationIndexes=A)}}if(I&&e.keyCode===l.Keys.left&&N){r&&r({focusElement:a,event:e,action:"reorderToLeft"}),e.preventDefault();return}if(I&&e.keyCode===l.Keys.right&&N){r&&r({focusElement:a,event:e,action:"reorderToRight"}),e.preventDefault();return}if(e.keyCode===l.Keys.pageUp){r&&r({focusElement:c,event:e,action:"moveToNextPage"}),e.preventDefault();return}if(e.keyCode===l.Keys.pageDown){r&&r({focusElement:c,event:e,action:"moveToPrevPage"}),e.preventDefault();return}r&&r({focusElement:c,event:e})}},R=e=>{const{navigationStateRef:n,scope:i}=e;if(!n.current||!i)return;const o=[],r=t.getHeaderElement(i),g=t.getBodyElement(i),c=t.getNoRecordsElement(i)||{children:[]};if(!r||!g)return;const v=Array.from(r.children),a=Array.from(g.children);[...v,...a,c].forEach((u,N)=>{Array.from(u.children).forEach(C=>{const K=t.getNavigatableId(C);if(!K)return;const E=C.rowSpan||1,I=C.colSpan||1;let b;for(let y=N,T=N+E;y<T;y++){if(o[y]||(o[y]=[]),b===void 0){const x=o[y].findIndex(k=>!k);b=x>-1?x:o[y].length}o[y][b]=K||""}for(let y=b+1,T=b+I;y<T;y++)o[N][y]=K||""})}),n.current.navigationMatrix=o.filter(u=>!!u),n.current.lastHeaderIndex=v.length-1},P={onConstructor:F,onComponentDidMount:h,onGetSnapshotBeforeUpdate:S,onComponentDidUpdate:B,onFocus:M,onKeyDown:L,generateMatrix:R,focusFirstDataElement:t.focusFirstDataElement};exports.tableKeyboardNavigation=P;
|