@progress/kendo-react-data-tools 8.2.0-develop.2 → 8.2.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/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/header/Header.js +1 -1
- package/header/Header.mjs +7 -3
- package/index.d.mts +54 -12
- package/index.d.ts +54 -12
- package/index.js +1 -1
- package/index.mjs +130 -126
- package/navigation/NavigatableSettings.js +8 -0
- package/navigation/NavigatableSettings.mjs +12 -0
- package/navigation/TableKeyboardNavigation.js +1 -1
- package/navigation/TableKeyboardNavigation.mjs +132 -105
- package/navigation/constants.js +1 -1
- package/navigation/constants.mjs +11 -9
- package/navigation/utils.js +1 -1
- package/navigation/utils.mjs +116 -71
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
package/index.mjs
CHANGED
|
@@ -12,143 +12,147 @@ 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 N, orderBy as s, 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 Ne } 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 } from "./filter/Filter.mjs";
|
|
50
|
+
import { Group as Eo } from "./filter/Group.mjs";
|
|
51
|
+
import { Operators as No, stringOperator as so, unaryOperator as Fo } from "./filter/operators.mjs";
|
|
52
|
+
import { ColumnMenuBooleanColumn as go, ColumnMenuDateColumn as Oo, ColumnMenuNumericColumn as Bo, ColumnMenuTextColumn as Ro } from "./columnmenu/ColumnMenu.mjs";
|
|
53
|
+
import { ColumnMenuFilterForm as Io, ColumnMenuForm as co } from "./columnmenu/ColumnMenuFilterForm.mjs";
|
|
54
|
+
import { ColumnMenuFilterLogic as Ko } from "./columnmenu/ColumnMenuFilterLogic.mjs";
|
|
55
|
+
import { ColumnMenuBooleanFilter as yo, ColumnMenuDateFilter as vo, ColumnMenuNumericFilter as Vo, ColumnMenuTextFilter as Yo } from "./columnmenu/ColumnMenuFilters.mjs";
|
|
56
|
+
import { ColumnMenuItem as Po } from "./columnmenu/ColumnMenuItem.mjs";
|
|
57
|
+
import { ColumnMenuOperators as wo } 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
|
+
go as ColumnMenuBooleanColumn,
|
|
65
|
+
yo as ColumnMenuBooleanFilter,
|
|
66
|
+
Oo as ColumnMenuDateColumn,
|
|
67
|
+
vo as ColumnMenuDateFilter,
|
|
68
|
+
Io as ColumnMenuFilterForm,
|
|
69
|
+
Ko as ColumnMenuFilterLogic,
|
|
70
|
+
co as ColumnMenuForm,
|
|
71
|
+
Po as ColumnMenuItem,
|
|
72
|
+
Bo as ColumnMenuNumericColumn,
|
|
73
|
+
Vo as ColumnMenuNumericFilter,
|
|
74
|
+
wo as ColumnMenuOperators,
|
|
75
|
+
Ro as ColumnMenuTextColumn,
|
|
76
|
+
Yo 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
|
+
Eo 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
|
+
Ne 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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
135
|
+
N as moveTreeItem,
|
|
136
|
+
je as nextColumn,
|
|
137
|
+
he as normalize,
|
|
138
|
+
s as orderBy,
|
|
139
|
+
de as populateClipboardData,
|
|
140
|
+
ke as readColumns,
|
|
141
|
+
fe as relativeContextElement,
|
|
142
|
+
F as removeItems,
|
|
143
|
+
B as setExpandedState,
|
|
144
|
+
R as setGroupIds,
|
|
145
|
+
Ce as setSelectedState,
|
|
146
|
+
so as stringOperator,
|
|
147
|
+
oo as tableColumnsVirtualization,
|
|
148
|
+
W as tableKeyboardNavigation,
|
|
149
|
+
U as tableKeyboardNavigationBodyAttributes,
|
|
150
|
+
w as tableKeyboardNavigationHeaderAttributes,
|
|
151
|
+
z as tableKeyboardNavigationScopeAttributes,
|
|
152
|
+
q as tableKeyboardNavigationTools,
|
|
149
153
|
b as treeToFlat,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
Fo as unaryOperator,
|
|
155
|
+
qe as updateLeft,
|
|
156
|
+
Je as updateRight,
|
|
157
|
+
I as useTableKeyboardNavigation
|
|
154
158
|
};
|
|
@@ -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 n=(e=>(e.incell="incell",e.inline="inline",e.popup="popup",e))(n||{});exports.NavigatableMode=n;
|
|
@@ -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 p = /* @__PURE__ */ ((n) => (n.incell = "incell", n.inline = "inline", n.popup = "popup", n))(p || {});
|
|
10
|
+
export {
|
|
11
|
+
p 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 c=require("@progress/kendo-react-common"),t=require("./utils.js"),p=require("./NavigatableSettings.js"),T=e=>{const{navigatable:l,contextStateRef:n,navigationStateRef:a,idPrefix:r}=e;l&&(n.current={activeId:"",level:0},a.current={activeElementIsFocused:!1,prevNavigationIndexes:void 0,idPrefix:r||c.guid(),navigationMatrix:[],lastHeaderIndex:-1})},R=e=>{const{scope:l,contextStateRef:n,navigationStateRef:a}=e;if(n.current&&a.current&&l){x(e);const r=t.getFirstDataCell(a.current.navigationMatrix);if(r){const o=t.tableKeyboardNavigationTools.getActiveNavDataElement(l,r);o&&(n.current.activeId=r,o.setAttribute("tabIndex","0"))}}},k=e=>{const{contextStateRef:l,navigationStateRef:n,document:a}=e;if(l.current&&n.current&&a){const r=c.getActiveElement(a),o=t.tableKeyboardNavigationTools.getNavigatableId(r);o&&o===l.current.activeId&&(n.current.activeElementIsFocused=!0)}},S=e=>{const{scope:l,contextStateRef:n,navigationStateRef:a,focusFirst:r,newEditableRow:o,singleEditRow:d,lastActiveElement:s}=e;if(r&&(T(e),R(e),t.focusFirstDataElement(e)),o&&!d||o&&d&&!s?t.focusFirstEditor(o):o&&d&&s&&s.focus(),x(e),n.current&&a.current&&l){if(!t.tableKeyboardNavigationTools.getActiveNavDataElement(l,n.current.activeId)){const u=t.getFirstDataCell(a.current.navigationMatrix),g=t.tableKeyboardNavigationTools.getActiveNavDataElement(l,u);u&&g&&(n.current.activeId=u,g.setAttribute("tabIndex","0"),a.current.activeElementIsFocused&&g.focus())}a.current.activeElementIsFocused=!1}},A=(e,l)=>{const{contextStateRef:n}=l;if(e.isDefaultPrevented()||!n.current)return;const a=e.target,r=t.tableKeyboardNavigationTools.getNavigatableId(a);if(r&&r!==n.current.activeId){const o=t.tableKeyboardNavigationTools.getClosestScope(a);if(!o)return;const d=t.tableKeyboardNavigationTools.getActiveNavDataElement(o,n.current.activeId);d&&!e.target.classList.contains("k-table-td")&&!e.target.classList.contains("k-detail-cell")&&d.setAttribute("tabIndex","-1"),a.setAttribute("tabIndex","0"),n.current.activeId=r}},h=async(e,l)=>{var N;const{contextStateRef:n,navigationStateRef:a,onNavigationAction:r}=l;if(e.isDefaultPrevented()||!n.current||!a.current)return;let o;if(e.keyCode===c.Keys.esc&&!l.navigatable.mode){o=t.tableKeyboardNavigationTools.getClosestNavigatableElement(e.target),t.tableKeyboardNavigationTools.focusElement({elementForFocus:o,event:e,contextStateRef:n});return}const d=e.target,s=d.className.indexOf("k-checkbox")===-1?d:t.tableKeyboardNavigationTools.getClosestNavigatableElement(d),y=t.tableKeyboardNavigationTools.getNavigatableId(s),u=y==null?void 0:y.endsWith("column"),g=t.tableKeyboardNavigationTools.getNavigatableLevel(s),f=t.tableKeyboardNavigationTools.getClosestScope(s),K=a.current.navigationMatrix,I=e.metaKey||e.ctrlKey,m=t.getCurrentIdIndexes(a,K,y);if(l.navigatable&&l.navigatable.mode===p.NavigatableMode.inline){if(e.keyCode===c.Keys.enter){const i=s.classList.contains("k-grid-remove-command"),b=s.classList.contains("k-grid-cancel-command"),E=t.tableKeyboardNavigationTools.getRowAriaRowIndex(s);if(i){setTimeout(()=>{const v=t.tableKeyboardNavigationTools.getRemoveButtonByAriaRowIndex(E.current)||t.tableKeyboardNavigationTools.getRemoveButtonByAriaRowIndex(E.prev);v&&v.focus()});return}else if(b&&s.parentElement){const v=(N=t.tableKeyboardNavigationTools.getClosestNavigatableElement(s))==null?void 0:N.getAttribute("data-keyboardnavid");setTimeout(()=>{v&&t.tableKeyboardNavigationTools.getTableCellByKeyboardNavId(v).focus()});return}}if(e.keyCode===c.Keys.esc){const i=t.tableKeyboardNavigationTools.getClosestCancelButton(s);i&&i.click();const b=await t.tableKeyboardNavigationTools.getClosestEditButton(s);b&&b.focus();return}}if(g!==void 0&&f){if(e.keyCode===c.Keys.enter){const i=t.tableKeyboardNavigationTools.getNavigatableElement(s,{level:g+1});if(i){t.tableKeyboardNavigationTools.focusElement({elementForFocus:i,event:e,contextStateRef:n,prevElement:s});return}else{o=t.tableKeyboardNavigationTools.getFocusableElements(s)[0],t.tableKeyboardNavigationTools.focusElement({elementForFocus:o,event:e,contextStateRef:n,prevElement:s});return}}if(e.keyCode===c.Keys.home&&m)if(I)t.focusFirstDataElement({scope:f,navigationStateRef:a,contextStateRef:n},e);else{const i=t.getFirstRowDataCell(a.current.navigationMatrix,m[0]);o=t.tableKeyboardNavigationTools.getActiveNavDataElement(f,i),t.tableKeyboardNavigationTools.focusElement({elementForFocus:o,event:e,contextStateRef:n})}if(e.keyCode===c.Keys.end&&m)if(I){const i=t.getLastDataCell(a.current.navigationMatrix);o=t.tableKeyboardNavigationTools.getActiveNavDataElement(f,i),t.tableKeyboardNavigationTools.focusElement({elementForFocus:o,event:e,contextStateRef:n})}else{const i=t.getLastRowDataCell(a.current.navigationMatrix,m[0]);o=t.tableKeyboardNavigationTools.getActiveNavDataElement(f,i),t.tableKeyboardNavigationTools.focusElement({elementForFocus:o,event:e,contextStateRef:n})}if(e.keyCode===c.Keys.up||e.keyCode===c.Keys.down||e.keyCode===c.Keys.left||e.keyCode===c.Keys.right){const i=e.keyCode===c.Keys.up||e.keyCode===c.Keys.left,b=e.keyCode===c.Keys.up||e.keyCode===c.Keys.down;if(m){const[E,v]=m,[C,D]=b?t.findNextIdByRowIndex(E,v,y,K,i):t.findNextIdByCellIndex(E,v,y,K,i);C&&(o=t.tableKeyboardNavigationTools.getActiveNavDataElement(f,C),t.tableKeyboardNavigationTools.focusElement({elementForFocus:o,event:e,contextStateRef:n,prevElement:s}),a.current.prevNavigationIndexes=D)}}if(I&&e.keyCode===c.Keys.left&&u){r&&r({focusElement:s,event:e,action:"reorderToLeft"}),e.preventDefault();return}if(I&&e.keyCode===c.Keys.right&&u){r&&r({focusElement:s,event:e,action:"reorderToRight"}),e.preventDefault();return}if(e.keyCode===c.Keys.pageUp){r&&r({focusElement:o,event:e,action:"moveToNextPage"}),e.preventDefault();return}if(e.keyCode===c.Keys.pageDown){r&&r({focusElement:o,event:e,action:"moveToPrevPage"}),e.preventDefault();return}r&&r({focusElement:o,event:e})}},x=e=>{const{navigationStateRef:l,scope:n}=e;if(!l.current||!n)return;const a=[],r=t.getHeaderElement(n),o=t.getBodyElement(n),d=t.getNoRecordsElement(n)||{children:[]};if(!r||!o)return;const s=Array.from(r.children),y=Array.from(o.children);[...s,...y,d].forEach((u,g)=>{Array.from(u.children).forEach(f=>{const K=t.getNavigatableId(f);if(!K)return;const I=f.rowSpan||1,m=f.colSpan||1;let N;for(let i=g,b=g+I;i<b;i++){if(a[i]||(a[i]=[]),N===void 0){const E=a[i].findIndex(v=>!v);N=E>-1?E:a[i].length}a[i][N]=K||""}for(let i=N+1,b=N+m;i<b;i++)a[g][i]=K||""})}),l.current.navigationMatrix=a.filter(u=>!!u),l.current.lastHeaderIndex=s.length-1},w={onConstructor:T,onComponentDidMount:R,onGetSnapshotBeforeUpdate:k,onComponentDidUpdate:S,onFocus:A,onKeyDown:h,generateMatrix:x,focusFirstDataElement:t.focusFirstDataElement};exports.tableKeyboardNavigation=w;
|