@progress/kendo-react-data-tools 7.3.0-develop.4 → 7.4.0-develop.1
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/index.d.mts +4 -14
- package/index.d.ts +4 -14
- package/index.js +1 -1
- package/index.mjs +119 -121
- package/navigation/TableKeyboardNavigation.js +1 -1
- package/navigation/TableKeyboardNavigation.mjs +64 -61
- package/navigation/constants.js +1 -1
- package/navigation/constants.mjs +15 -31
- package/navigation/utils.js +1 -1
- package/navigation/utils.mjs +68 -63
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
package/index.mjs
CHANGED
|
@@ -12,144 +12,142 @@ 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
|
|
16
|
-
import { getGroupIds as
|
|
17
|
-
import { useTableKeyboardNavigation as
|
|
18
|
-
import {
|
|
19
|
-
import { tableKeyboardNavigation as
|
|
20
|
-
import { TableKeyboardNavigationContext as
|
|
21
|
-
import { tableKeyboardNavigationTools as
|
|
22
|
-
import { TableSelection as
|
|
23
|
-
import { TABLE_COL_INDEX_ATTRIBUTE as
|
|
24
|
-
import { closestTagName as
|
|
25
|
-
import { ClipboardService as
|
|
26
|
-
import { ClipboardActionType as
|
|
27
|
-
import { createFilterComponent as
|
|
28
|
-
import { BooleanFilterCell as
|
|
29
|
-
import { DateFilterCell as
|
|
30
|
-
import { NumericFilterCell as
|
|
31
|
-
import { TextFilterCell as
|
|
15
|
+
import { createDataTree as A, extendDataItem as E, filterBy as T, flatData as d, getItemPath as _, modifySubItems as D, moveTreeItem as s, orderBy as F, removeItems as N, treeToFlat as g } from "./utils/data-operations.mjs";
|
|
16
|
+
import { getGroupIds as R, setExpandedState as O, setGroupIds as B } from "./utils/group-operations.mjs";
|
|
17
|
+
import { useTableKeyboardNavigation as c } from "./navigation/hooks.mjs";
|
|
18
|
+
import { KEYBOARD_NAV_DATA_BODY as K, KEYBOARD_NAV_DATA_HEADER as L, KEYBOARD_NAV_DATA_ID as y, KEYBOARD_NAV_DATA_LEVEL as M, KEYBOARD_NAV_DATA_SCOPE as v, KEYBOARD_NAV_DATA_ZONE as V, KEYBOARD_NAV_FILTER_COL_SUFFIX as Y, tableKeyboardNavigationBodyAttributes as H, tableKeyboardNavigationHeaderAttributes as P, tableKeyboardNavigationScopeAttributes as w } from "./navigation/constants.mjs";
|
|
19
|
+
import { tableKeyboardNavigation as h } from "./navigation/TableKeyboardNavigation.mjs";
|
|
20
|
+
import { TableKeyboardNavigationContext as U } from "./navigation/TableKeyboardNavigationContext.mjs";
|
|
21
|
+
import { tableKeyboardNavigationTools as W } from "./navigation/utils.mjs";
|
|
22
|
+
import { TableSelection as j } from "./selection/TableSelection.mjs";
|
|
23
|
+
import { TABLE_COL_INDEX_ATTRIBUTE as q, TABLE_PREVENT_SELECTION_ELEMENT as J, TABLE_ROW_INDEX_ATTRIBUTE as Q } from "./selection/constants.mjs";
|
|
24
|
+
import { closestTagName as ee, getColumnIndex as oe, getOffset as re, getRowIndex as te, getSelectedState as me, getSelectedStateFromKeyDown as le, getSelectionOptions as ae, relativeContextElement as ne, setSelectedState as pe } from "./selection/utils.mjs";
|
|
25
|
+
import { ClipboardService as xe } from "./clipboard/clipboard.service.mjs";
|
|
26
|
+
import { ClipboardActionType as fe, populateClipboardData as Ce } from "./clipboard/common.mjs";
|
|
27
|
+
import { createFilterComponent as Ee } from "./filteringCells/FilterComponent.mjs";
|
|
28
|
+
import { BooleanFilterCell as de } from "./filteringCells/BooleanFilter.mjs";
|
|
29
|
+
import { DateFilterCell as De } from "./filteringCells/DateFilter.mjs";
|
|
30
|
+
import { NumericFilterCell as Fe } from "./filteringCells/NumericFilter.mjs";
|
|
31
|
+
import { TextFilterCell as ge } from "./filteringCells/TextFilter.mjs";
|
|
32
32
|
import { ColumnDefaultProps as Re } from "./header/ColumnProps.mjs";
|
|
33
|
-
import { FILTER_ROW_CLASS as
|
|
34
|
-
import { Header as
|
|
35
|
-
import { HeaderCell as
|
|
36
|
-
import { HeaderRow as
|
|
37
|
-
import { HeaderSelectionCell as
|
|
38
|
-
import { normalize as
|
|
39
|
-
import { getIndex as
|
|
40
|
-
import { HeaderThElement as
|
|
41
|
-
import { tableColumnsVirtualization as
|
|
42
|
-
import { TextFilter as
|
|
43
|
-
import { NumericFilter as
|
|
44
|
-
import { DateFilter as
|
|
45
|
-
import { BooleanFilter as
|
|
46
|
-
import { EnumFilter as
|
|
47
|
-
import { Expression as
|
|
48
|
-
import { Filter as
|
|
49
|
-
import { Group as
|
|
50
|
-
import { Operators as
|
|
51
|
-
import { ColumnMenuBooleanColumn as
|
|
52
|
-
import { ColumnMenuFilterForm as
|
|
53
|
-
import { ColumnMenuFilterLogic as
|
|
54
|
-
import { ColumnMenuBooleanFilter as
|
|
55
|
-
import { ColumnMenuItem as
|
|
56
|
-
import { ColumnMenuOperators as
|
|
33
|
+
import { FILTER_ROW_CLASS as Be, FilterRow as Ie } from "./header/FilterRow.mjs";
|
|
34
|
+
import { Header as Se } from "./header/Header.mjs";
|
|
35
|
+
import { HeaderCell as Le } from "./header/HeaderCell.mjs";
|
|
36
|
+
import { HeaderRow as Me } from "./header/HeaderRow.mjs";
|
|
37
|
+
import { HeaderSelectionCell as Ve } from "./header/HeaderSelectionCell.mjs";
|
|
38
|
+
import { normalize as He } from "./header/SortSettings.mjs";
|
|
39
|
+
import { getIndex as we, isRtl as ze, mapColumns as he, nextColumn as Ge, readColumns as Ue, updateLeft as Xe, updateRight as We } from "./header/utils/index.mjs";
|
|
40
|
+
import { HeaderThElement as je } from "./header/HeaderThElement.mjs";
|
|
41
|
+
import { tableColumnsVirtualization as qe } from "./virtualization/columns.mjs";
|
|
42
|
+
import { TextFilter as Qe } from "./filter/filters/TextFilter.mjs";
|
|
43
|
+
import { NumericFilter as eo } from "./filter/filters/NumericFilter.mjs";
|
|
44
|
+
import { DateFilter as ro } from "./filter/filters/DateFilter.mjs";
|
|
45
|
+
import { BooleanFilter as mo } from "./filter/filters/BooleanFilter.mjs";
|
|
46
|
+
import { EnumFilter as ao } from "./filter/filters/EnumFilter.mjs";
|
|
47
|
+
import { Expression as po } from "./filter/Expression.mjs";
|
|
48
|
+
import { Filter as xo } from "./filter/Filter.mjs";
|
|
49
|
+
import { Group as fo } from "./filter/Group.mjs";
|
|
50
|
+
import { Operators as Ao, stringOperator as Eo, unaryOperator as To } from "./filter/operators.mjs";
|
|
51
|
+
import { ColumnMenuBooleanColumn as Do, ColumnMenuDateColumn as so, ColumnMenuNumericColumn as Fo, ColumnMenuTextColumn as No } from "./columnmenu/ColumnMenu.mjs";
|
|
52
|
+
import { ColumnMenuFilterForm as bo, ColumnMenuForm as Ro } from "./columnmenu/ColumnMenuFilterForm.mjs";
|
|
53
|
+
import { ColumnMenuFilterLogic as Bo } from "./columnmenu/ColumnMenuFilterLogic.mjs";
|
|
54
|
+
import { ColumnMenuBooleanFilter as co, ColumnMenuDateFilter as So, ColumnMenuNumericFilter as Ko, ColumnMenuTextFilter as Lo } from "./columnmenu/ColumnMenuFilters.mjs";
|
|
55
|
+
import { ColumnMenuItem as Mo } from "./columnmenu/ColumnMenuItem.mjs";
|
|
56
|
+
import { ColumnMenuOperators as Vo } from "./columnmenu/ColumnMenuOperators.mjs";
|
|
57
57
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
mo as BooleanFilter,
|
|
59
|
+
de as BooleanFilterCell,
|
|
60
|
+
fe as ClipboardActionType,
|
|
61
|
+
xe as ClipboardService,
|
|
62
62
|
Re as ColumnDefaultProps,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
Do as ColumnMenuBooleanColumn,
|
|
64
|
+
co as ColumnMenuBooleanFilter,
|
|
65
|
+
so as ColumnMenuDateColumn,
|
|
66
|
+
So as ColumnMenuDateFilter,
|
|
67
|
+
bo as ColumnMenuFilterForm,
|
|
68
|
+
Bo as ColumnMenuFilterLogic,
|
|
69
69
|
Ro as ColumnMenuForm,
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
Mo as ColumnMenuItem,
|
|
71
|
+
Fo as ColumnMenuNumericColumn,
|
|
72
72
|
Ko as ColumnMenuNumericFilter,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
Vo as ColumnMenuOperators,
|
|
74
|
+
No as ColumnMenuTextColumn,
|
|
75
|
+
Lo as ColumnMenuTextFilter,
|
|
76
76
|
m as ColumnResize,
|
|
77
77
|
a as ColumnResizer,
|
|
78
78
|
p as CommonDragLogic,
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
ro as DateFilter,
|
|
80
|
+
De as DateFilterCell,
|
|
81
81
|
x as DragClue,
|
|
82
82
|
f as DropClue,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
Ve as
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
K as KEYBOARD_NAV_DATA_HEADER,
|
|
83
|
+
ao as EnumFilter,
|
|
84
|
+
po as Expression,
|
|
85
|
+
Be as FILTER_ROW_CLASS,
|
|
86
|
+
xo as Filter,
|
|
87
|
+
Ie as FilterRow,
|
|
88
|
+
fo as Group,
|
|
89
|
+
Se as Header,
|
|
90
|
+
Le as HeaderCell,
|
|
91
|
+
Me as HeaderRow,
|
|
92
|
+
Ve as HeaderSelectionCell,
|
|
93
|
+
je as HeaderThElement,
|
|
94
|
+
K as KEYBOARD_NAV_DATA_BODY,
|
|
95
|
+
L as KEYBOARD_NAV_DATA_HEADER,
|
|
97
96
|
y as KEYBOARD_NAV_DATA_ID,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
M as KEYBOARD_NAV_DATA_LEVEL,
|
|
98
|
+
v as KEYBOARD_NAV_DATA_SCOPE,
|
|
99
|
+
V as KEYBOARD_NAV_DATA_ZONE,
|
|
100
|
+
Y as KEYBOARD_NAV_FILTER_COL_SUFFIX,
|
|
101
|
+
eo as NumericFilter,
|
|
102
|
+
Fe as NumericFilterCell,
|
|
103
|
+
Ao as Operators,
|
|
105
104
|
r as Pager,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
A as extendDataItem,
|
|
105
|
+
q as TABLE_COL_INDEX_ATTRIBUTE,
|
|
106
|
+
J as TABLE_PREVENT_SELECTION_ELEMENT,
|
|
107
|
+
Q as TABLE_ROW_INDEX_ATTRIBUTE,
|
|
108
|
+
U as TableKeyboardNavigationContext,
|
|
109
|
+
j as TableSelection,
|
|
110
|
+
Qe as TextFilter,
|
|
111
|
+
ge as TextFilterCell,
|
|
112
|
+
ee as closestTagName,
|
|
113
|
+
A as createDataTree,
|
|
114
|
+
Ee as createFilterComponent,
|
|
115
|
+
E as extendDataItem,
|
|
118
116
|
T as filterBy,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
117
|
+
d as flatData,
|
|
118
|
+
oe as getColumnIndex,
|
|
119
|
+
R as getGroupIds,
|
|
120
|
+
we as getIndex,
|
|
121
|
+
_ as getItemPath,
|
|
122
|
+
re as getOffset,
|
|
123
|
+
te as getRowIndex,
|
|
124
|
+
me as getSelectedState,
|
|
125
|
+
le as getSelectedStateFromKeyDown,
|
|
126
|
+
ae as getSelectionOptions,
|
|
127
|
+
ze as isRtl,
|
|
128
|
+
he as mapColumns,
|
|
131
129
|
D as modifySubItems,
|
|
132
130
|
s as moveTreeItem,
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
Ge as nextColumn,
|
|
132
|
+
He as normalize,
|
|
135
133
|
F as orderBy,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
Ce as populateClipboardData,
|
|
135
|
+
Ue as readColumns,
|
|
136
|
+
ne as relativeContextElement,
|
|
139
137
|
N as removeItems,
|
|
140
138
|
O as setExpandedState,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
B as setGroupIds,
|
|
140
|
+
pe as setSelectedState,
|
|
141
|
+
Eo as stringOperator,
|
|
142
|
+
qe as tableColumnsVirtualization,
|
|
143
|
+
h as tableKeyboardNavigation,
|
|
144
|
+
H as tableKeyboardNavigationBodyAttributes,
|
|
145
|
+
P as tableKeyboardNavigationHeaderAttributes,
|
|
146
|
+
w as tableKeyboardNavigationScopeAttributes,
|
|
147
|
+
W as tableKeyboardNavigationTools,
|
|
150
148
|
g as treeToFlat,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
To as unaryOperator,
|
|
150
|
+
Xe as updateLeft,
|
|
151
|
+
We as updateRight,
|
|
152
|
+
c as useTableKeyboardNavigation
|
|
155
153
|
};
|
|
@@ -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"),
|
|
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;
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import { guid as
|
|
10
|
-
import { tableKeyboardNavigationTools as
|
|
11
|
-
const
|
|
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
12
|
const { navigatable: o, contextStateRef: n, navigationStateRef: t, idPrefix: c } = e;
|
|
13
13
|
o && (n.current = {
|
|
14
14
|
activeId: "",
|
|
@@ -16,29 +16,32 @@ const w = (e) => {
|
|
|
16
16
|
}, t.current = {
|
|
17
17
|
activeElementIsFocused: !1,
|
|
18
18
|
prevNavigationIndexes: void 0,
|
|
19
|
-
idPrefix: c ||
|
|
19
|
+
idPrefix: c || S(),
|
|
20
20
|
navigationMatrix: [],
|
|
21
21
|
lastHeaderIndex: -1
|
|
22
22
|
});
|
|
23
|
-
},
|
|
23
|
+
}, w = (e) => {
|
|
24
24
|
const { scope: o, contextStateRef: n, navigationStateRef: t } = e;
|
|
25
25
|
if (n.current && t.current && o) {
|
|
26
|
-
|
|
27
|
-
const c = t.current.navigationMatrix
|
|
28
|
-
|
|
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"));
|
|
31
|
+
}
|
|
29
32
|
}
|
|
30
33
|
}, M = (e) => {
|
|
31
34
|
const { contextStateRef: o, navigationStateRef: n, document: t } = e;
|
|
32
35
|
if (o.current && n.current && t) {
|
|
33
|
-
const c =
|
|
36
|
+
const c = C(t), r = a.getNavigatableId(c);
|
|
34
37
|
r && r === o.current.activeId && (n.current.activeElementIsFocused = !0);
|
|
35
38
|
}
|
|
36
39
|
}, B = (e) => {
|
|
37
40
|
const { scope: o, contextStateRef: n, navigationStateRef: t } = e;
|
|
38
|
-
if (
|
|
39
|
-
if (!
|
|
40
|
-
const r = t.current.navigationMatrix[0][0],
|
|
41
|
-
r &&
|
|
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());
|
|
42
45
|
}
|
|
43
46
|
t.current.activeElementIsFocused = !1;
|
|
44
47
|
}
|
|
@@ -46,13 +49,13 @@ const w = (e) => {
|
|
|
46
49
|
const { contextStateRef: n } = o;
|
|
47
50
|
if (e.isDefaultPrevented() || !n.current)
|
|
48
51
|
return;
|
|
49
|
-
const t = e.target, c =
|
|
52
|
+
const t = e.target, c = a.getNavigatableId(t);
|
|
50
53
|
if (c && c !== n.current.activeId) {
|
|
51
|
-
const r =
|
|
54
|
+
const r = a.getClosestScope(t);
|
|
52
55
|
if (!r)
|
|
53
56
|
return;
|
|
54
|
-
const
|
|
55
|
-
|
|
57
|
+
const i = a.getActiveNavDataElement(r, n.current.activeId);
|
|
58
|
+
i && i.setAttribute("tabIndex", "-1"), t.setAttribute("tabIndex", "0"), n.current.activeId = c;
|
|
56
59
|
}
|
|
57
60
|
}, P = (e, o) => {
|
|
58
61
|
const {
|
|
@@ -62,80 +65,80 @@ const w = (e) => {
|
|
|
62
65
|
} = o;
|
|
63
66
|
if (e.isDefaultPrevented() || !n.current || !t.current)
|
|
64
67
|
return;
|
|
65
|
-
if (e.keyCode ===
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
+
if (e.keyCode === f.esc) {
|
|
69
|
+
const l = a.getClosestNavigatableElement(e.target);
|
|
70
|
+
a.focusElement({ elementForFocus: l, event: e, contextStateRef: n });
|
|
68
71
|
return;
|
|
69
72
|
}
|
|
70
|
-
const r = e.target, a =
|
|
71
|
-
if (
|
|
72
|
-
if (e.keyCode ===
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
elementForFocus:
|
|
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,
|
|
77
80
|
event: e,
|
|
78
81
|
contextStateRef: n,
|
|
79
|
-
prevElement:
|
|
82
|
+
prevElement: i
|
|
80
83
|
});
|
|
81
84
|
return;
|
|
82
85
|
} else {
|
|
83
|
-
const
|
|
84
|
-
|
|
86
|
+
const E = a.getFocusableElements(i)[0];
|
|
87
|
+
a.focusElement({ elementForFocus: E, event: e, contextStateRef: n, prevElement: i });
|
|
85
88
|
return;
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
|
-
if (e.keyCode ===
|
|
89
|
-
const
|
|
90
|
-
let
|
|
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;
|
|
91
94
|
if (t.current && t.current.prevNavigationIndexes) {
|
|
92
|
-
const [
|
|
93
|
-
|
|
95
|
+
const [d, s] = t.current.prevNavigationIndexes;
|
|
96
|
+
u[d][s] === v ? g = t.current.prevNavigationIndexes : g = y(u, v);
|
|
94
97
|
} else
|
|
95
|
-
|
|
96
|
-
if (
|
|
97
|
-
const [
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
-
|
|
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 });
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
|
-
},
|
|
108
|
+
}, N = (e) => {
|
|
106
109
|
const { navigationStateRef: o, scope: n } = e;
|
|
107
110
|
if (!o.current || !n)
|
|
108
111
|
return;
|
|
109
|
-
const t = [], c =
|
|
112
|
+
const t = [], c = R(n), r = A(n);
|
|
110
113
|
if (!c || !r)
|
|
111
114
|
return;
|
|
112
|
-
const
|
|
113
|
-
[...
|
|
114
|
-
Array.from(
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
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)
|
|
117
120
|
return;
|
|
118
|
-
const
|
|
119
|
-
let
|
|
120
|
-
for (let s =
|
|
121
|
-
if (t[s] || (t[s] = []),
|
|
122
|
-
const p = t[s].findIndex((
|
|
123
|
-
|
|
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;
|
|
124
127
|
}
|
|
125
|
-
t[s][
|
|
128
|
+
t[s][d] = l || "";
|
|
126
129
|
}
|
|
127
|
-
for (let s =
|
|
128
|
-
t[
|
|
130
|
+
for (let s = d + 1, x = d + g; s < x; s++)
|
|
131
|
+
t[I][s] = l || "";
|
|
129
132
|
});
|
|
130
|
-
}), o.current.navigationMatrix = t.filter((
|
|
133
|
+
}), o.current.navigationMatrix = t.filter((m) => !!m), o.current.lastHeaderIndex = i.length - 1;
|
|
131
134
|
}, U = {
|
|
132
|
-
onConstructor:
|
|
133
|
-
onComponentDidMount:
|
|
135
|
+
onConstructor: k,
|
|
136
|
+
onComponentDidMount: w,
|
|
134
137
|
onGetSnapshotBeforeUpdate: M,
|
|
135
138
|
onComponentDidUpdate: B,
|
|
136
139
|
onFocus: K,
|
|
137
140
|
onKeyDown: P,
|
|
138
|
-
generateMatrix:
|
|
141
|
+
generateMatrix: N
|
|
139
142
|
};
|
|
140
143
|
export {
|
|
141
144
|
U as tableKeyboardNavigation
|
package/navigation/constants.js
CHANGED
|
@@ -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 e="data-keyboardnavlevel",A="data-keyboardnavscope",t="data-keyboardnavheader",a="data-keyboardnavbody",_="data-keyboardnavid",o="data-keyboardnavzone",D="_filter",r={[A]:!0},E={[t]:!0},b={[a]:!0};exports.KEYBOARD_NAV_DATA_BODY=a;exports.KEYBOARD_NAV_DATA_HEADER=t;exports.KEYBOARD_NAV_DATA_ID=_;exports.KEYBOARD_NAV_DATA_LEVEL=e;exports.KEYBOARD_NAV_DATA_SCOPE=A;exports.KEYBOARD_NAV_DATA_ZONE=o;exports.KEYBOARD_NAV_FILTER_COL_SUFFIX=D;exports.tableKeyboardNavigationBodyAttributes=b;exports.tableKeyboardNavigationHeaderAttributes=E;exports.tableKeyboardNavigationScopeAttributes=r;
|
package/navigation/constants.mjs
CHANGED
|
@@ -6,38 +6,22 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"a[href]",
|
|
15
|
-
"area[href]",
|
|
16
|
-
"summary",
|
|
17
|
-
"iframe",
|
|
18
|
-
"object",
|
|
19
|
-
"embed",
|
|
20
|
-
"audio[controls]",
|
|
21
|
-
"video[controls]",
|
|
22
|
-
"[contenteditable]"
|
|
23
|
-
], E = [...t, "[tabindex]"], _ = [...t, "[tabindex]"].map((a) => a + ':not([tabindex="-1"])'), s = {
|
|
9
|
+
const A = "data-keyboardnavlevel", a = "data-keyboardnavscope", t = "data-keyboardnavheader", e = "data-keyboardnavbody", o = "data-keyboardnavid", _ = "data-keyboardnavzone", n = "_filter", d = {
|
|
10
|
+
[a]: !0
|
|
11
|
+
}, r = {
|
|
12
|
+
[t]: !0
|
|
13
|
+
}, b = {
|
|
24
14
|
[e]: !0
|
|
25
|
-
}, i = {
|
|
26
|
-
[o]: !0
|
|
27
|
-
}, c = {
|
|
28
|
-
[n]: !0
|
|
29
15
|
};
|
|
30
16
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
o as
|
|
34
|
-
A as
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
i as tableKeyboardNavigationHeaderAttributes,
|
|
42
|
-
s as tableKeyboardNavigationScopeAttributes
|
|
17
|
+
e as KEYBOARD_NAV_DATA_BODY,
|
|
18
|
+
t as KEYBOARD_NAV_DATA_HEADER,
|
|
19
|
+
o as KEYBOARD_NAV_DATA_ID,
|
|
20
|
+
A as KEYBOARD_NAV_DATA_LEVEL,
|
|
21
|
+
a as KEYBOARD_NAV_DATA_SCOPE,
|
|
22
|
+
_ as KEYBOARD_NAV_DATA_ZONE,
|
|
23
|
+
n as KEYBOARD_NAV_FILTER_COL_SUFFIX,
|
|
24
|
+
b as tableKeyboardNavigationBodyAttributes,
|
|
25
|
+
r as tableKeyboardNavigationHeaderAttributes,
|
|
26
|
+
d as tableKeyboardNavigationScopeAttributes
|
|
43
27
|
};
|
package/navigation/utils.js
CHANGED
|
@@ -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 s=require("@progress/kendo-react-common"),o=require("./constants.js"),i=(e,t,r="cell")=>`${t}_${e}_${r}`,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.parentElement&&e.parentElement.closest(`[${o.KEYBOARD_NAV_DATA_LEVEL}]`),N=(e,t)=>e.querySelector(`[${o.KEYBOARD_NAV_DATA_ID}='${t}']`),_=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})=>{let r=t.focusable?s.FOCUSABLE_ELEMENTS:s.TABBABLE_ELEMENTS;return Array.from(e.querySelectorAll(r.join(",")))},D=(e,t={level:0})=>{if(!e)return[];let r=s.FOCUSABLE_ELEMENTS.map(l=>l+`[${o.KEYBOARD_NAV_DATA_LEVEL}='${t.level}']`).join(",");return Array.from(e.querySelectorAll(r))},I=(e={level:0})=>{let t=s.FOCUSABLE_ELEMENTS.map(r=>r+`[${o.KEYBOARD_NAV_DATA_LEVEL}='${e.level}']`).join(",");return r=>r.matches(t)},m=e=>{const{elementForFocus:t,event:r,contextStateRef:l,prevElement:a}=e;if(l.current&&t&&t.focus){r.preventDefault();const n=t.querySelector(".k-checkbox-wrap .k-checkbox");n&&n.focus?n.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,r,l,a)=>{if(!r)return[];let n=e+(a?-1:1);for(;n>=0&&n<l.length;){const c=l[n][t];if(c!==r)return[c,[n,t]];n=n+(a?-1:1)}return[]},T=(e,t,r,l,a)=>{if(!r)return[];let n=t+(a?-1:1);for(;n>=0&&n<l[e].length;){const c=l[e][n];if(c!==r)return[c,[e,n]];n=n+(a?-1:1)}return[]},x=(e,t)=>{if(t){for(let r=0;r<e.length;r++)for(let l=0;l<e[r].length;l++)if(e[r][l]===t)return[r,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;
|