@progress/kendo-react-data-tools 8.2.0-develop.9 → 8.2.1-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/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
|
@@ -6,170 +6,254 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import { guid as
|
|
10
|
-
import { focusFirstDataElement as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import { guid as P, getActiveElement as H, enableNavigatableContainer as S, Keys as s, disableNavigatableContainer as O, keepFocusInContainer as U, TABBABLE_ELEMENTS as V } from "@progress/kendo-react-common";
|
|
10
|
+
import { focusFirstDataElement as w, getFirstDataCell as T, tableKeyboardNavigationTools as t, focusFirstEditor as q, getCurrentIdIndexes as G, getFirstRowDataCell as W, getLastRowDataCell as _, getLastDataCell as $, getHeaderElement as j, getBodyElement as z, getNoRecordsElement as J, getNavigatableId as Q, findNextIdByRowIndex as F, findNextIdByCellIndex as X } from "./utils.mjs";
|
|
11
|
+
import { NavigatableMode as D } from "./NavigatableSettings.mjs";
|
|
12
|
+
const M = (e) => {
|
|
13
|
+
const { navigatable: l, contextStateRef: o, navigationStateRef: n, idPrefix: i } = e;
|
|
14
|
+
l && (o.current = {
|
|
14
15
|
activeId: "",
|
|
15
16
|
level: 0
|
|
16
|
-
},
|
|
17
|
+
}, n.current = {
|
|
17
18
|
activeElementIsFocused: !1,
|
|
18
19
|
prevNavigationIndexes: void 0,
|
|
19
|
-
idPrefix:
|
|
20
|
+
idPrefix: i || P(),
|
|
20
21
|
navigationMatrix: [],
|
|
21
22
|
lastHeaderIndex: -1
|
|
22
23
|
});
|
|
23
|
-
},
|
|
24
|
-
const { scope:
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
const
|
|
30
|
-
|
|
24
|
+
}, L = (e) => {
|
|
25
|
+
const { scope: l, contextStateRef: o, navigationStateRef: n } = e;
|
|
26
|
+
if (o.current && n.current && l) {
|
|
27
|
+
h(e);
|
|
28
|
+
const i = T(n.current.navigationMatrix);
|
|
29
|
+
if (i) {
|
|
30
|
+
const f = t.getActiveNavDataElement(l, i);
|
|
31
|
+
f && (o.current.activeId = i, f.setAttribute("tabIndex", "0"));
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
},
|
|
34
|
-
const { contextStateRef:
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
|
|
34
|
+
}, Y = (e) => {
|
|
35
|
+
const { contextStateRef: l, navigationStateRef: o, document: n } = e;
|
|
36
|
+
if (l.current && o.current && n) {
|
|
37
|
+
const i = H(n), f = t.getNavigatableId(i);
|
|
38
|
+
f && f === l.current.activeId && (o.current.activeElementIsFocused = !0);
|
|
38
39
|
}
|
|
39
|
-
},
|
|
40
|
-
const { scope:
|
|
41
|
-
if (
|
|
42
|
-
if (!
|
|
43
|
-
const
|
|
44
|
-
|
|
40
|
+
}, Z = (e) => {
|
|
41
|
+
const { scope: l, contextStateRef: o, navigationStateRef: n, focusFirst: i, newEditableRow: f, singleEditRow: c, lastActiveElement: v, navigatable: a } = e;
|
|
42
|
+
if (i && (M(e), L(e), w(e)), (!a || a && a.mode === D.inline) && (f && !c || f && c && !v) ? q(f) : a && a.mode === D.inline && f && c && v && v.focus(), h(e), o.current && n.current && l) {
|
|
43
|
+
if (!t.getActiveNavDataElement(l, o.current.activeId)) {
|
|
44
|
+
const E = l.className.indexOf("k-treelist") === -1 ? T(n.current.navigationMatrix) : n.current.navigationMatrix[0][0], I = t.getActiveNavDataElement(l, E);
|
|
45
|
+
E && I && (o.current.activeId = E, I.setAttribute("tabIndex", "0"), n.current.activeElementIsFocused && I.focus());
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
+
n.current.activeElementIsFocused = !1;
|
|
47
48
|
}
|
|
48
|
-
},
|
|
49
|
-
const { contextStateRef:
|
|
50
|
-
if (e.isDefaultPrevented() || !
|
|
49
|
+
}, ee = (e, l) => {
|
|
50
|
+
const { contextStateRef: o } = l;
|
|
51
|
+
if (e.isDefaultPrevented() || !o.current)
|
|
51
52
|
return;
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
53
|
+
const n = e.target, i = t.getNavigatableId(n);
|
|
54
|
+
if (i && i !== o.current.activeId) {
|
|
55
|
+
const f = t.getClosestScope(n);
|
|
56
|
+
if (!f)
|
|
56
57
|
return;
|
|
57
|
-
const
|
|
58
|
-
|
|
58
|
+
const c = t.getActiveNavDataElement(f, o.current.activeId);
|
|
59
|
+
c && !e.target.classList.contains("k-table-td") && !e.target.classList.contains("k-detail-cell") && c.setAttribute("tabIndex", "-1"), n.setAttribute("tabIndex", "0"), o.current.activeId = i;
|
|
60
|
+
} else if (n.closest(".k-filtercell") && l.navigatable) {
|
|
61
|
+
const f = n.closest(".k-table-th");
|
|
62
|
+
S(f);
|
|
59
63
|
}
|
|
60
|
-
},
|
|
64
|
+
}, te = async (e, l) => {
|
|
65
|
+
var N, p, R, A;
|
|
61
66
|
const {
|
|
62
|
-
contextStateRef:
|
|
63
|
-
navigationStateRef:
|
|
64
|
-
onNavigationAction:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
contextStateRef: o,
|
|
68
|
+
navigationStateRef: n,
|
|
69
|
+
onNavigationAction: i,
|
|
70
|
+
columns: f
|
|
71
|
+
} = l;
|
|
72
|
+
if (e.isDefaultPrevented() || !o.current || !n.current)
|
|
67
73
|
return;
|
|
68
|
-
let
|
|
69
|
-
if (e.keyCode === l.
|
|
70
|
-
|
|
74
|
+
let c;
|
|
75
|
+
if (e.keyCode === s.esc && !l.navigatable.mode) {
|
|
76
|
+
c = t.getClosestNavigatableElement(e.target), t.focusElement({ elementForFocus: c, event: e, contextStateRef: o }), e.target.closest(".k-filtercell") && c && l.navigatable && O(c);
|
|
71
77
|
return;
|
|
72
78
|
}
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
if (e.keyCode ===
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
const v = e.target, a = v.className.indexOf("k-checkbox") === -1 ? v : t.getClosestNavigatableElement(v), m = t.getNavigatableId(a) || ((N = t.getParentCell(a)) == null ? void 0 : N.getAttribute("data-keyboardnavid")), E = m == null ? void 0 : m.endsWith("column"), I = t.getNavigatableLevel(a), x = t.getClosestScope(a), y = n.current.navigationMatrix, k = e.metaKey || e.ctrlKey, u = G(n, y, m), C = a.closest(".k-table-th");
|
|
80
|
+
if (l.navigatable && l.navigatable.mode === D.inline) {
|
|
81
|
+
if (e.keyCode === s.enter) {
|
|
82
|
+
const d = a.classList.contains("k-grid-remove-command"), r = a.classList.contains("k-grid-cancel-command"), g = t.getRowAriaRowIndex(a);
|
|
83
|
+
if (d) {
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
const b = t.getRemoveButtonByAriaRowIndex(g.current) || t.getRemoveButtonByAriaRowIndex(g.prev);
|
|
86
|
+
b && b.focus();
|
|
87
|
+
});
|
|
88
|
+
return;
|
|
89
|
+
} else if (r && a.parentElement) {
|
|
90
|
+
const b = (p = t.getClosestNavigatableElement(a)) == null ? void 0 : p.getAttribute("data-keyboardnavid");
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
b && t.getTableCellByKeyboardNavId(b).focus();
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (e.keyCode === s.esc) {
|
|
98
|
+
const d = t.getClosestCancelButton(a);
|
|
99
|
+
d && d.click();
|
|
100
|
+
const r = await t.getClosestEditButton(a);
|
|
101
|
+
r && r.focus();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
} else if (l.navigatable && l.navigatable.mode === D.incell) {
|
|
105
|
+
const d = (R = a.closest(".k-table-td")) == null ? void 0 : R.classList.contains("k-grid-edit-cell");
|
|
106
|
+
if (e.keyCode === s.esc) {
|
|
107
|
+
a.focus(), a.blur();
|
|
108
|
+
const r = v && v.parentElement && v.parentElement.closest(".k-grid-edit-row"), g = t.getClosestCellNavId(a), b = await t.waitForElementToBeVisible(`[data-keyboardnavid='${g}']:not(.k-grid-edit-cell)`, r);
|
|
109
|
+
b && b.focus();
|
|
110
|
+
} else if (e.keyCode === s.enter) {
|
|
111
|
+
let r;
|
|
112
|
+
if (u) {
|
|
113
|
+
const [g, b] = u;
|
|
114
|
+
r = F(g, b, m, y, !1);
|
|
115
|
+
}
|
|
116
|
+
if (!d)
|
|
117
|
+
(A = t.getParentCell(a)) == null || A.click();
|
|
118
|
+
else if (d && r) {
|
|
119
|
+
const g = r && r[0] && t.getTableCellByKeyboardNavId(r[0]);
|
|
120
|
+
g && g.click();
|
|
121
|
+
}
|
|
122
|
+
} else if (e.keyCode === s.left) {
|
|
123
|
+
if (d)
|
|
124
|
+
return;
|
|
125
|
+
} else if (e.keyCode === s.right) {
|
|
126
|
+
if (d)
|
|
127
|
+
return;
|
|
128
|
+
} else if (e.keyCode === s.up) {
|
|
129
|
+
if (d)
|
|
130
|
+
return;
|
|
131
|
+
} else if (e.keyCode === s.down) {
|
|
132
|
+
if (d)
|
|
133
|
+
return;
|
|
134
|
+
} else if (e.keyCode === s.tab && d) {
|
|
135
|
+
if (e.shiftKey) {
|
|
136
|
+
const r = u && f && t.getPrevEditableCell(u, f, m, y);
|
|
137
|
+
if (r && r.prevCell && r.prevCell.click(), r && r.elementToFocus !== "gridcell") {
|
|
138
|
+
a.blur();
|
|
139
|
+
const g = t.getClosestCellNavId(a);
|
|
140
|
+
setTimeout(() => {
|
|
141
|
+
g && t.getTableCellByKeyboardNavId(g).focus();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
} else {
|
|
146
|
+
const r = u && f && t.getNextEditableCell(u, f, m, y);
|
|
147
|
+
if (r && r.nextCell && r.elementToFocus === "gridcell" && r.nextCell.click(), r && r.elementToFocus !== "gridcell") {
|
|
148
|
+
a.blur();
|
|
149
|
+
const g = t.getClosestCellNavId(a);
|
|
150
|
+
g && t.getTableCellByKeyboardNavId(g).focus();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
e.preventDefault();
|
|
154
|
+
}
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (a.closest(".k-filtercell") && C && l.navigatable && U(e, C, V), I !== void 0 && x) {
|
|
159
|
+
if (e.keyCode === s.enter) {
|
|
160
|
+
const d = t.getNavigatableElement(a, { level: I + 1 });
|
|
161
|
+
if (d) {
|
|
162
|
+
t.focusElement({
|
|
163
|
+
elementForFocus: d,
|
|
80
164
|
event: e,
|
|
81
|
-
contextStateRef:
|
|
82
|
-
prevElement:
|
|
165
|
+
contextStateRef: o,
|
|
166
|
+
prevElement: a
|
|
83
167
|
});
|
|
84
168
|
return;
|
|
85
169
|
} else {
|
|
86
|
-
|
|
170
|
+
a.querySelector(".k-filtercell") && l.navigatable && S(a), c = t.getFocusableElements(a)[0], t.focusElement({ elementForFocus: c, event: e, contextStateRef: o, prevElement: a });
|
|
87
171
|
return;
|
|
88
172
|
}
|
|
89
173
|
}
|
|
90
|
-
if (e.keyCode ===
|
|
91
|
-
if (
|
|
92
|
-
|
|
174
|
+
if (e.keyCode === s.home && u)
|
|
175
|
+
if (k)
|
|
176
|
+
w(
|
|
93
177
|
{
|
|
94
|
-
scope:
|
|
95
|
-
navigationStateRef:
|
|
96
|
-
contextStateRef:
|
|
178
|
+
scope: x,
|
|
179
|
+
navigationStateRef: n,
|
|
180
|
+
contextStateRef: o
|
|
97
181
|
},
|
|
98
182
|
e
|
|
99
183
|
);
|
|
100
184
|
else {
|
|
101
|
-
const
|
|
102
|
-
|
|
185
|
+
const d = W(n.current.navigationMatrix, u[0]);
|
|
186
|
+
c = t.getActiveNavDataElement(x, d), t.focusElement({ elementForFocus: c, event: e, contextStateRef: o });
|
|
103
187
|
}
|
|
104
|
-
if (e.keyCode ===
|
|
105
|
-
if (
|
|
106
|
-
const
|
|
107
|
-
|
|
188
|
+
if (e.keyCode === s.end && u)
|
|
189
|
+
if (k) {
|
|
190
|
+
const d = $(n.current.navigationMatrix);
|
|
191
|
+
c = t.getActiveNavDataElement(x, d), t.focusElement({ elementForFocus: c, event: e, contextStateRef: o });
|
|
108
192
|
} else {
|
|
109
|
-
const
|
|
110
|
-
|
|
193
|
+
const d = _(n.current.navigationMatrix, u[0]);
|
|
194
|
+
c = t.getActiveNavDataElement(x, d), t.focusElement({ elementForFocus: c, event: e, contextStateRef: o });
|
|
111
195
|
}
|
|
112
|
-
if (e.keyCode ===
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
-
const [
|
|
116
|
-
|
|
196
|
+
if (e.keyCode === s.up || e.keyCode === s.down || e.keyCode === s.left || e.keyCode === s.right) {
|
|
197
|
+
const d = e.keyCode === s.up || e.keyCode === s.left, r = e.keyCode === s.up || e.keyCode === s.down;
|
|
198
|
+
if (u) {
|
|
199
|
+
const [g, b] = u, [B, K] = r ? F(g, b, m, y, d) : X(g, b, m, y, d);
|
|
200
|
+
B && (c = t.getActiveNavDataElement(x, B), t.focusElement({ elementForFocus: c, event: e, contextStateRef: o, prevElement: a }), n.current.prevNavigationIndexes = K);
|
|
117
201
|
}
|
|
118
202
|
}
|
|
119
|
-
if (
|
|
120
|
-
|
|
203
|
+
if (k && e.keyCode === s.left && E) {
|
|
204
|
+
i && i({ focusElement: a, event: e, action: "reorderToLeft" }), e.preventDefault();
|
|
121
205
|
return;
|
|
122
206
|
}
|
|
123
|
-
if (
|
|
124
|
-
|
|
207
|
+
if (k && e.keyCode === s.right && E) {
|
|
208
|
+
i && i({ focusElement: a, event: e, action: "reorderToRight" }), e.preventDefault();
|
|
125
209
|
return;
|
|
126
210
|
}
|
|
127
|
-
if (e.keyCode ===
|
|
128
|
-
|
|
211
|
+
if (e.keyCode === s.pageUp) {
|
|
212
|
+
i && i({ focusElement: c, event: e, action: "moveToNextPage" }), e.preventDefault();
|
|
129
213
|
return;
|
|
130
214
|
}
|
|
131
|
-
if (e.keyCode ===
|
|
132
|
-
|
|
215
|
+
if (e.keyCode === s.pageDown) {
|
|
216
|
+
i && i({ focusElement: c, event: e, action: "moveToPrevPage" }), e.preventDefault();
|
|
133
217
|
return;
|
|
134
218
|
}
|
|
135
|
-
|
|
219
|
+
i && i({ focusElement: c, event: e });
|
|
136
220
|
}
|
|
137
|
-
},
|
|
138
|
-
const { navigationStateRef:
|
|
139
|
-
if (!
|
|
221
|
+
}, h = (e) => {
|
|
222
|
+
const { navigationStateRef: l, scope: o } = e;
|
|
223
|
+
if (!l.current || !o)
|
|
140
224
|
return;
|
|
141
|
-
const
|
|
142
|
-
if (!
|
|
225
|
+
const n = [], i = j(o), f = z(o), c = J(o) || { children: [] };
|
|
226
|
+
if (!i || !f)
|
|
143
227
|
return;
|
|
144
|
-
const
|
|
145
|
-
[...
|
|
146
|
-
Array.from(
|
|
147
|
-
const
|
|
148
|
-
if (!
|
|
228
|
+
const v = Array.from(i.children), a = Array.from(f.children);
|
|
229
|
+
[...v, ...a, c].forEach((m, E) => {
|
|
230
|
+
Array.from(m.children).forEach((I) => {
|
|
231
|
+
const x = Q(I);
|
|
232
|
+
if (!x)
|
|
149
233
|
return;
|
|
150
|
-
const
|
|
151
|
-
let
|
|
152
|
-
for (let
|
|
153
|
-
if (
|
|
154
|
-
const
|
|
155
|
-
|
|
234
|
+
const y = I.rowSpan || 1, k = I.colSpan || 1;
|
|
235
|
+
let u;
|
|
236
|
+
for (let C = E, N = E + y; C < N; C++) {
|
|
237
|
+
if (n[C] || (n[C] = []), u === void 0) {
|
|
238
|
+
const p = n[C].findIndex((R) => !R);
|
|
239
|
+
u = p > -1 ? p : n[C].length;
|
|
156
240
|
}
|
|
157
|
-
|
|
241
|
+
n[C][u] = x || "";
|
|
158
242
|
}
|
|
159
|
-
for (let
|
|
160
|
-
|
|
243
|
+
for (let C = u + 1, N = u + k; C < N; C++)
|
|
244
|
+
n[E][C] = x || "";
|
|
161
245
|
});
|
|
162
|
-
}),
|
|
163
|
-
},
|
|
164
|
-
onConstructor:
|
|
165
|
-
onComponentDidMount:
|
|
166
|
-
onGetSnapshotBeforeUpdate:
|
|
167
|
-
onComponentDidUpdate:
|
|
168
|
-
onFocus:
|
|
169
|
-
onKeyDown:
|
|
170
|
-
generateMatrix:
|
|
171
|
-
focusFirstDataElement:
|
|
246
|
+
}), l.current.navigationMatrix = n.filter((m) => !!m), l.current.lastHeaderIndex = v.length - 1;
|
|
247
|
+
}, le = {
|
|
248
|
+
onConstructor: M,
|
|
249
|
+
onComponentDidMount: L,
|
|
250
|
+
onGetSnapshotBeforeUpdate: Y,
|
|
251
|
+
onComponentDidUpdate: Z,
|
|
252
|
+
onFocus: ee,
|
|
253
|
+
onKeyDown: te,
|
|
254
|
+
generateMatrix: h,
|
|
255
|
+
focusFirstDataElement: w
|
|
172
256
|
};
|
|
173
257
|
export {
|
|
174
|
-
|
|
258
|
+
le as tableKeyboardNavigation
|
|
175
259
|
};
|
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 a="data-keyboardnavlevel",A="data-keyboardnavscope",_="data-keyboardnavheader",t="data-keyboardnavbody",e="data-keyboardnavid",o="data-keyboardnavzone",D="_filter",E="k-grid-cancel-command",d="k-grid-edit-command",N={[A]:!0},n={[_]:!0},r={[t]:!0};exports.KEYBOARD_NAV_CANCEL_BUTTON_CLASS=E;exports.KEYBOARD_NAV_DATA_BODY=t;exports.KEYBOARD_NAV_DATA_HEADER=_;exports.KEYBOARD_NAV_DATA_ID=e;exports.KEYBOARD_NAV_DATA_LEVEL=a;exports.KEYBOARD_NAV_DATA_SCOPE=A;exports.KEYBOARD_NAV_DATA_ZONE=o;exports.KEYBOARD_NAV_EDIT_BUTTON_CLASS=d;exports.KEYBOARD_NAV_FILTER_COL_SUFFIX=D;exports.tableKeyboardNavigationBodyAttributes=r;exports.tableKeyboardNavigationHeaderAttributes=n;exports.tableKeyboardNavigationScopeAttributes=N;
|
package/navigation/constants.mjs
CHANGED
|
@@ -6,22 +6,24 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
const
|
|
9
|
+
const e = "data-keyboardnavlevel", a = "data-keyboardnavscope", t = "data-keyboardnavheader", A = "data-keyboardnavbody", o = "data-keyboardnavid", _ = "data-keyboardnavzone", n = "_filter", d = "k-grid-cancel-command", r = "k-grid-edit-command", c = {
|
|
10
10
|
[a]: !0
|
|
11
|
-
},
|
|
11
|
+
}, D = {
|
|
12
12
|
[t]: !0
|
|
13
|
-
},
|
|
14
|
-
[
|
|
13
|
+
}, E = {
|
|
14
|
+
[A]: !0
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
d as KEYBOARD_NAV_CANCEL_BUTTON_CLASS,
|
|
18
|
+
A as KEYBOARD_NAV_DATA_BODY,
|
|
18
19
|
t as KEYBOARD_NAV_DATA_HEADER,
|
|
19
20
|
o as KEYBOARD_NAV_DATA_ID,
|
|
20
|
-
|
|
21
|
+
e as KEYBOARD_NAV_DATA_LEVEL,
|
|
21
22
|
a as KEYBOARD_NAV_DATA_SCOPE,
|
|
22
23
|
_ as KEYBOARD_NAV_DATA_ZONE,
|
|
24
|
+
r as KEYBOARD_NAV_EDIT_BUTTON_CLASS,
|
|
23
25
|
n as KEYBOARD_NAV_FILTER_COL_SUFFIX,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
E as tableKeyboardNavigationBodyAttributes,
|
|
27
|
+
D as tableKeyboardNavigationHeaderAttributes,
|
|
28
|
+
c as tableKeyboardNavigationScopeAttributes
|
|
27
29
|
};
|
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 g=require("@progress/kendo-react-common"),a=require("./constants.js"),m=(e,t,n="cell")=>`${t}_${e}_${n}`,B=e=>{if(e)return parseInt(e.getAttribute(a.KEYBOARD_NAV_DATA_LEVEL)||"",10)},b=e=>{if(!e)return;const t=e.getAttribute(a.KEYBOARD_NAV_DATA_ID);return t||void 0},A=e=>e?!!e.getAttribute(a.KEYBOARD_NAV_DATA_ID):!1,x=(e,t={level:0})=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_LEVEL}='${t.level}']`),N=e=>e&&e.parentElement&&e.parentElement.closest(`[${a.KEYBOARD_NAV_DATA_LEVEL}]`),v=(e,t)=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_ID}='${t}']`),y=e=>e&&e.parentElement&&e.parentElement.closest(`[${a.KEYBOARD_NAV_DATA_SCOPE}]`),w=e=>{const t=e&&e.parentElement&&e.parentElement.closest(".k-grid-edit-row");return t&&t.querySelector("."+a.KEYBOARD_NAV_CANCEL_BUTTON_CLASS)},T=e=>document.querySelector(`[aria-rowindex="${e}"] .k-grid-remove-command`),u=e=>document.querySelector(`[data-keyboardnavid="${e}"]`),p=e=>{var r;const t=e&&e.parentElement&&e.parentElement.closest(".k-table-row");let n;return(r=t==null?void 0:t.parentElement)==null||r.childNodes.forEach(l=>{if(t===l){const o=l.previousSibling;n={current:t.getAttribute("aria-rowindex"),prev:o&&o.getAttribute("aria-rowindex")}}}),n};async function R(e,t,n=5e3){const r=Date.now();if(t)for(;Date.now()-r<n;){const l=t.querySelector(e);if(l)return l;await new Promise(o=>setTimeout(o,20))}return!1}const L=async e=>{const t=e&&e.parentElement&&e.parentElement.closest(".k-grid-edit-row");return await R("."+a.KEYBOARD_NAV_EDIT_BUTTON_CLASS,t)},S=e=>(e==null?void 0:e.closest(".k-table-td"))||null,F=e=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_HEADER}]`),O=e=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_BODY}]`),W=e=>e.querySelector(".k-grid-norecords"),X=e=>{const t=e.querySelector(".k-grid-edit-cell"),n=t&&t.querySelector("input");n?n.focus():(t==null?void 0:t.firstChild).focus()},h=(e,t)=>{const{scope:n,navigationStateRef:r,contextStateRef:l}=e;if(!r.current||!n)return;const o=M(r.current.navigationMatrix),s=v(n,o);C({elementForFocus:s,contextStateRef:l,event:t})},V=(e,t={focusable:!1})=>{const n=t.focusable?g.FOCUSABLE_ELEMENTS:g.TABBABLE_ELEMENTS;return Array.from(e.querySelectorAll(n.join(",")))},$=(e,t={level:0})=>{if(!e)return[];const n=g.FOCUSABLE_ELEMENTS.map(r=>r+`[${a.KEYBOARD_NAV_DATA_LEVEL}='${t.level}']`).join(",");return Array.from(e.querySelectorAll(n))},k=(e={level:0})=>{const t=g.FOCUSABLE_ELEMENTS.map(n=>n+`[${a.KEYBOARD_NAV_DATA_LEVEL}='${e.level}']`).join(",");return n=>n.matches(t)},C=e=>{const{elementForFocus:t,event:n,contextStateRef:r,prevElement:l}=e;if(r.current&&t&&t.focus){n==null||n.preventDefault();const o=t.querySelector(".k-checkbox-wrap .k-checkbox");o&&o.focus?o.focus():t.focus(),A(t)&&(t.setAttribute("tabIndex","0"),r.current.activeId=b(t)),l&&A(l)&&l.setAttribute("tabIndex","-1")}},K=e=>e.current?e.current.idPrefix:"",q=(e,t,n,r,l)=>{if(!n)return[];let o=e+(l?-1:1);for(;o>=0&&o<r.length;){const s=r[o][t];if(s!==n)return[s,[o,t]];o=o+(l?-1:1)}return[]},d=(e,t,n,r,l)=>{if(!n)return[];let o=t+(l?-1:1);for(;o>=0&&r[e]&&o<r[e].length;){const s=r[e][o];if(s!==n)return[s,[e,o]];o=o+(l?-1:1)}return[]},f=(e,t)=>{if(t){for(let n=0;n<e.length;n++)for(let r=0;r<e[n].length;r++)if(e[n][r]===t)return[n,r]}},_=(e,t,n)=>{let r;do if(e=e+1,r=t[n-e],r&&r.editable)break;while(n-e>=0);return r},Y=(e,t,n,r)=>{var I;let l;const[o,s]=e;let c;const i=0,E=t.length;return c=_(i,t,s),c?l=d(o,c.ariaColumnIndex,n,r,!0):(c=_(i,t,E),l=d(o-1,c.ariaColumnIndex,n,r,!0)),{prevCell:l&&l[0]&&u(l[0]),elementToFocus:l&&l[0]&&((I=u(l[0]))==null?void 0:I.getAttribute("role"))}},D=(e,t,n)=>{let r;do if(e=e+1,r=t[n+e],r&&r.editable)break;while(n+e-1<t.length);return r},P=(e,t,n,r)=>{var o;let l;if(e){const[s,c]=e;let i,E=0;i=D(E,t,c),i?l=d(s,i.ariaColumnIndex,n,r,!0):(E=-1,i=D(E,t,0),l=d(s+1,i.ariaColumnIndex,n,r,!0))}return{nextCell:l&&l[0]&&u(l[0]),elementToFocus:l&&l[0]&&((o=u(l[0]))==null?void 0:o.getAttribute("role"))}},U=e=>e.current?e.current.navigationMatrix.length:0,M=e=>e.flat().find(t=>t.endsWith("cell")),z=e=>e.flat().reverse().find(t=>t.endsWith("cell")),G=(e,t)=>e[t][0],J=(e,t)=>Array.from(e[t]).reverse()[0],j=e=>e?`${e}${a.KEYBOARD_NAV_FILTER_COL_SUFFIX}`:"",Q=(e,t,n)=>{let r;if(e.current&&e.current.prevNavigationIndexes){const[l,o]=e.current.prevNavigationIndexes,s=t[l];s&&s[o]===n?r=e.current.prevNavigationIndexes:r=f(t,n)}else r=f(t,n);return r},H=e=>{var t;return((t=N(e))==null?void 0:t.getAttribute("data-keyboardnavid"))||e.getAttribute("data-keyboardnavid")},Z={generateNavigatableId:m,getNavigatableId:b,getNavigatableLevel:B,getNavigatableElement:x,getClosestNavigatableElement:N,getActiveNavDataElement:v,getClosestScope:y,getHeaderElement:F,getBodyElement:O,getFocusableElements:V,getNavigatableElements:$,filterNavigatableElements:k,focusElement:C,getIdPrefix:K,isNavigatable:A,findNextIdByRowIndex:q,findNextIdByCellIndex:d,findId:f,getNextNavigationIndex:U,getFilterColumnId:j,focusFirstDataElement:h,getClosestCancelButton:w,getClosestEditButton:L,getRowAriaRowIndex:p,getRemoveButtonByAriaRowIndex:T,getTableCellByKeyboardNavId:u,getParentCell:S,waitForElementToBeVisible:R,getNextEditableCell:P,getPrevEditableCell:Y,getClosestCellNavId:H};exports.filterNavigatableElements=k;exports.findId=f;exports.findNextIdByCellIndex=d;exports.findNextIdByRowIndex=q;exports.focusElement=C;exports.focusFirstDataElement=h;exports.focusFirstEditor=X;exports.generateNavigatableId=m;exports.getActiveNavDataElement=v;exports.getBodyElement=O;exports.getClosestCancelButton=w;exports.getClosestCellNavId=H;exports.getClosestEditButton=L;exports.getClosestNavigatableElement=N;exports.getClosestScope=y;exports.getCurrentIdIndexes=Q;exports.getFilterColumnId=j;exports.getFirstDataCell=M;exports.getFirstRowDataCell=G;exports.getFocusableElements=V;exports.getHeaderElement=F;exports.getIdPrefix=K;exports.getLastDataCell=z;exports.getLastRowDataCell=J;exports.getNavigatableElement=x;exports.getNavigatableElements=$;exports.getNavigatableId=b;exports.getNavigatableLevel=B;exports.getNextEditableCell=P;exports.getNextNavigationIndex=U;exports.getNoRecordsElement=W;exports.getParentCell=S;exports.getPrevEditableCell=Y;exports.getRemoveButtonByAriaRowIndex=T;exports.getRowAriaRowIndex=p;exports.getTableCellByKeyboardNavId=u;exports.isNavigatable=A;exports.tableKeyboardNavigationTools=Z;
|