@progress/kendo-vue-data-tools 8.1.0-develop.4 → 8.1.0-develop.6
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-vue-datatools.js +1 -1
- package/index.js +1 -1
- package/index.mjs +121 -117
- package/navigation/TableKeyboardNavigation.js +1 -1
- package/navigation/TableKeyboardNavigation.mjs +142 -142
- package/navigation/constants.d.ts +20 -0
- package/navigation/constants.js +1 -1
- package/navigation/constants.mjs +23 -15
- package/navigation/utils.d.ts +10 -0
- package/navigation/utils.js +1 -1
- package/navigation/utils.mjs +101 -97
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
- package/selection/TableSelection.js +1 -1
- package/selection/TableSelection.mjs +7 -8
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { getDefaultSlots as
|
|
8
|
+
import { getDefaultSlots as P, Keys as s, disableNavigatableContainer as S, keepFocusInContainer as L, TABBABLE_ELEMENTS as V, enableNavigatableContainer as R, guid as _ } from "@progress/kendo-vue-common";
|
|
9
9
|
import { KEYBOARD_NAV_DATA_ID as H, KEYBOARD_NAV_DATA_LEVEL as O } from "./constants.mjs";
|
|
10
|
-
import { getHeaderElement as U, getBodyElement as z,
|
|
11
|
-
import { defineComponent as
|
|
12
|
-
import { NavigatableMode as
|
|
13
|
-
const
|
|
10
|
+
import { getHeaderElement as U, getBodyElement as z, getTopPinnedElement as G, getBottomPinnedElement as $, getNoRecordsElement as W, getNavigatableId as Y, tableKeyboardNavigationTools as i, getCurrentIdIndexes as q, getFirstDataCell as T, findNextIdByRowIndex as K, getFirstRowDataCell as j, focusFirstDataElement as J, getLastRowDataCell as Q, getLastDataCell as X, findNextIdByCellIndex as Z } from "./utils.mjs";
|
|
11
|
+
import { defineComponent as ee } from "vue";
|
|
12
|
+
import { NavigatableMode as F } from "./NavigatableSettings.mjs";
|
|
13
|
+
const le = /* @__PURE__ */ ee({
|
|
14
14
|
name: "KendoTableKeyboardNavigationProvider",
|
|
15
15
|
props: {
|
|
16
16
|
navigatable: {
|
|
@@ -47,7 +47,7 @@ const oe = /* @__PURE__ */ X({
|
|
|
47
47
|
created() {
|
|
48
48
|
const {
|
|
49
49
|
navigatable: e,
|
|
50
|
-
id:
|
|
50
|
+
id: o
|
|
51
51
|
} = this.$props;
|
|
52
52
|
e && (this.kbContext = {
|
|
53
53
|
activeId: "",
|
|
@@ -55,7 +55,7 @@ const oe = /* @__PURE__ */ X({
|
|
|
55
55
|
}, this.navigation = {
|
|
56
56
|
activeElementIsFocused: !1,
|
|
57
57
|
prevNavigationIndexes: void 0,
|
|
58
|
-
idPrefix:
|
|
58
|
+
idPrefix: o || _(),
|
|
59
59
|
navigationMatrix: [],
|
|
60
60
|
lastHeaderIndex: -1
|
|
61
61
|
});
|
|
@@ -64,12 +64,12 @@ const oe = /* @__PURE__ */ X({
|
|
|
64
64
|
scrollElementIntoViewForVirtualization(e) {
|
|
65
65
|
if (!e || typeof e.scrollIntoView != "function") return;
|
|
66
66
|
const {
|
|
67
|
-
scrollable:
|
|
68
|
-
columnVirtualization:
|
|
67
|
+
scrollable: o,
|
|
68
|
+
columnVirtualization: a
|
|
69
69
|
} = this.$props;
|
|
70
|
-
(
|
|
71
|
-
block:
|
|
72
|
-
inline:
|
|
70
|
+
(o === "virtual" || a) && e.scrollIntoView({
|
|
71
|
+
block: o === "virtual" ? "center" : void 0,
|
|
72
|
+
inline: a ? "center" : void 0,
|
|
73
73
|
behavior: "auto"
|
|
74
74
|
});
|
|
75
75
|
},
|
|
@@ -82,78 +82,78 @@ const oe = /* @__PURE__ */ X({
|
|
|
82
82
|
},
|
|
83
83
|
onComponentDidMount(e) {
|
|
84
84
|
const {
|
|
85
|
-
scope:
|
|
85
|
+
scope: o = this.scope
|
|
86
86
|
} = e;
|
|
87
|
-
if (this.kbContext && this.navigation &&
|
|
88
|
-
this.scope =
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
const l = i.getActiveNavDataElement(
|
|
92
|
-
l && (this.kbContext.activeId =
|
|
87
|
+
if (this.kbContext && this.navigation && o) {
|
|
88
|
+
this.scope = o, this.generateMatrix(e);
|
|
89
|
+
const a = T(this.navigation.navigationMatrix);
|
|
90
|
+
if (a) {
|
|
91
|
+
const l = i.getActiveNavDataElement(o, a);
|
|
92
|
+
l && (this.kbContext.activeId = a, l.setAttribute("tabIndex", "0"));
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
onGetSnapshotBeforeUpdate(e) {
|
|
97
97
|
if (this.kbContext && this.navigation && document) {
|
|
98
|
-
const
|
|
99
|
-
|
|
98
|
+
const o = document.activeElement, a = i.getNavigatableId(o);
|
|
99
|
+
a && a === this.kbContext.activeId && (this.navigation.activeElementIsFocused = !0);
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
|
-
conditionallyFocusElement(e,
|
|
103
|
-
if (
|
|
102
|
+
conditionallyFocusElement(e, o, a) {
|
|
103
|
+
if (o) {
|
|
104
104
|
e();
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
const l = document.activeElement;
|
|
108
|
-
l && l !== document.body &&
|
|
108
|
+
l && l !== document.body && a && !a.contains(l) || e();
|
|
109
109
|
},
|
|
110
110
|
onComponentDidUpdate(e) {
|
|
111
|
-
var
|
|
111
|
+
var n, f;
|
|
112
112
|
const {
|
|
113
|
-
scope:
|
|
114
|
-
focusFirst:
|
|
113
|
+
scope: o,
|
|
114
|
+
focusFirst: a,
|
|
115
115
|
newEditableRow: l,
|
|
116
116
|
singleEditRow: c,
|
|
117
|
-
lastActiveElement:
|
|
117
|
+
lastActiveElement: u,
|
|
118
118
|
navigatable: r,
|
|
119
|
-
userInitiatedEdit:
|
|
119
|
+
userInitiatedEdit: b
|
|
120
120
|
} = e;
|
|
121
|
-
if (
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
this.navigation.activeElementIsFocused && ((
|
|
121
|
+
if (a && (this.onConstructor(e), this.onComponentDidMount(e), this.focusFirstDataElement(e)), (!r || r && r.mode === F.inline) && (l && !c || l && c && !u) ? this.conditionallyFocusElement(() => this.focusFirstEditor(l), b, o) : r && r.mode === F.inline && l && c && u && this.conditionallyFocusElement(() => u.focus(), b, o), this.generateMatrix(e), this.kbContext && this.navigation && o) {
|
|
122
|
+
const E = i.getActiveNavDataElement(o, this.kbContext.activeId);
|
|
123
|
+
if (E)
|
|
124
|
+
this.navigation.activeElementIsFocused && ((f = (n = this.navigation) == null ? void 0 : n.prevNavigationIndexes) == null ? void 0 : f.length) > 0 && E !== document.activeElement && E.focus();
|
|
125
125
|
else {
|
|
126
|
-
const
|
|
127
|
-
|
|
126
|
+
const I = o.className.indexOf("k-treelist") === -1 ? T(this.navigation.navigationMatrix) : this.navigation.navigationMatrix[0][0], y = i.getActiveNavDataElement(o, I);
|
|
127
|
+
I && y && (this.kbContext.activeId = I, y.setAttribute("tabIndex", "0"), this.navigation.activeElementIsFocused && y.focus());
|
|
128
128
|
}
|
|
129
129
|
this.navigation.activeElementIsFocused = !1;
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
|
-
onFocus(e,
|
|
133
|
-
const
|
|
134
|
-
if (e.defaultPrevented || !
|
|
132
|
+
onFocus(e, o) {
|
|
133
|
+
const a = this.kbContext;
|
|
134
|
+
if (e.defaultPrevented || !a)
|
|
135
135
|
return;
|
|
136
136
|
const l = e.target, c = i.getNavigatableId(l);
|
|
137
|
-
if (c && c !==
|
|
138
|
-
const
|
|
139
|
-
if (!
|
|
137
|
+
if (c && c !== a.activeId) {
|
|
138
|
+
const u = i.getClosestScope(l);
|
|
139
|
+
if (!u)
|
|
140
140
|
return;
|
|
141
|
-
const r = i.getActiveNavDataElement(
|
|
142
|
-
r && !e.target.classList.contains("k-table-td") && !e.target.classList.contains("k-detail-cell") && r.setAttribute("tabIndex", "-1"), l.setAttribute("tabIndex", "0"),
|
|
143
|
-
} else if (l.closest(".k-filtercell") && (
|
|
144
|
-
const
|
|
145
|
-
R(
|
|
141
|
+
const r = i.getActiveNavDataElement(u, a.activeId);
|
|
142
|
+
r && !e.target.classList.contains("k-table-td") && !e.target.classList.contains("k-detail-cell") && r.setAttribute("tabIndex", "-1"), l.setAttribute("tabIndex", "0"), a.activeId = c;
|
|
143
|
+
} else if (l.closest(".k-filtercell") && (o != null && o.navigatable)) {
|
|
144
|
+
const u = l.closest(".k-table-td");
|
|
145
|
+
R(u);
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
|
-
async onKeyDown(e,
|
|
149
|
-
var
|
|
148
|
+
async onKeyDown(e, o) {
|
|
149
|
+
var x, m, D, A;
|
|
150
150
|
const {
|
|
151
|
-
kbContext:
|
|
151
|
+
kbContext: a = this.kbContext,
|
|
152
152
|
navigation: l = this.navigation,
|
|
153
153
|
onNavigationAction: c,
|
|
154
|
-
columns:
|
|
155
|
-
} =
|
|
156
|
-
if (e.defaultPrevented || !
|
|
154
|
+
columns: u
|
|
155
|
+
} = o;
|
|
156
|
+
if (e.defaultPrevented || !a || !l)
|
|
157
157
|
return;
|
|
158
158
|
let r;
|
|
159
159
|
if (e.keyCode === s.esc) {
|
|
@@ -161,22 +161,22 @@ const oe = /* @__PURE__ */ X({
|
|
|
161
161
|
i.focusElement({
|
|
162
162
|
elementForFocus: t,
|
|
163
163
|
event: e,
|
|
164
|
-
kbContext:
|
|
165
|
-
}), e.target.closest(".k-filtercell") && t &&
|
|
164
|
+
kbContext: a
|
|
165
|
+
}), e.target.closest(".k-filtercell") && t && o.navigatable && S(t);
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
168
|
+
const b = e.target, n = b.className.indexOf("k-checkbox") === -1 ? b : i.getClosestNavigatableElement(b), f = i.getNavigatableId(n), E = f == null ? void 0 : f.endsWith("column"), I = f == null ? void 0 : f.endsWith("column_filter"), y = i.getNavigatableLevel(n), v = i.getClosestScope(n), C = l.navigationMatrix, k = e.metaKey || e.ctrlKey, g = q(l, C, f), w = n.closest(".k-table-td"), N = (x = n.closest(".k-table-td")) == null ? void 0 : x.classList.contains("k-grid-edit-cell");
|
|
169
|
+
if (o.navigatable && o.navigatable.mode === F.inline) {
|
|
170
170
|
if (e.keyCode === s.enter) {
|
|
171
|
-
const t =
|
|
171
|
+
const t = n.classList.contains("k-grid-remove-command"), d = n.classList.contains("k-grid-cancel-command"), h = i.getRowAriaRowIndex(n);
|
|
172
172
|
if (t) {
|
|
173
173
|
setTimeout(() => {
|
|
174
174
|
const p = i.getRemoveButtonByAriaRowIndex(h.current) || i.getRemoveButtonByAriaRowIndex(h.prev);
|
|
175
175
|
p && p.focus();
|
|
176
176
|
});
|
|
177
177
|
return;
|
|
178
|
-
} else if (
|
|
179
|
-
const p = (
|
|
178
|
+
} else if (d && n.parentElement) {
|
|
179
|
+
const p = (m = i.getClosestNavigatableElement(n)) == null ? void 0 : m.getAttribute("data-keyboardnavid");
|
|
180
180
|
setTimeout(() => {
|
|
181
181
|
p && i.getTableCellByKeyboardNavId(p).focus();
|
|
182
182
|
});
|
|
@@ -184,49 +184,49 @@ const oe = /* @__PURE__ */ X({
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
if (e.keyCode === s.esc) {
|
|
187
|
-
const t = i.getClosestCancelButton(
|
|
187
|
+
const t = i.getClosestCancelButton(n);
|
|
188
188
|
t && t.click();
|
|
189
|
-
const
|
|
190
|
-
|
|
189
|
+
const d = await i.getClosestEditButton(n);
|
|
190
|
+
d && d.focus();
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
|
-
} else if (
|
|
193
|
+
} else if (o.navigatable && o.navigatable.mode === F.incell) {
|
|
194
194
|
if (e.keyCode === s.esc) {
|
|
195
|
-
|
|
196
|
-
const t = ((
|
|
195
|
+
n.focus(), n.blur();
|
|
196
|
+
const t = ((D = b == null ? void 0 : b.parentElement) == null ? void 0 : D.closest(".k-grid-edit-row")) || null, d = i.getClosestCellNavId(n), h = await i.waitForElementToBeVisible(`[data-keyboardnavid='${d}']:not(.k-grid-edit-cell)`, t);
|
|
197
197
|
h && h.focus();
|
|
198
198
|
} else if (e.keyCode === s.enter) {
|
|
199
199
|
let t;
|
|
200
|
-
if (
|
|
201
|
-
const [
|
|
202
|
-
t = K(
|
|
200
|
+
if (g) {
|
|
201
|
+
const [d, h] = g;
|
|
202
|
+
t = K(d, h, f, C, !1);
|
|
203
203
|
}
|
|
204
|
-
if (!
|
|
205
|
-
(
|
|
206
|
-
else if (
|
|
207
|
-
const
|
|
208
|
-
|
|
204
|
+
if (!N)
|
|
205
|
+
(A = i.getParentCell(n)) == null || A.click();
|
|
206
|
+
else if (N && t) {
|
|
207
|
+
const d = (t == null ? void 0 : t[0]) && i.getTableCellByKeyboardNavId(t[0]);
|
|
208
|
+
d == null || d.click();
|
|
209
209
|
}
|
|
210
210
|
} else if (e.keyCode === s.left || e.keyCode === s.right || e.keyCode === s.up || e.keyCode === s.down) {
|
|
211
|
-
if (
|
|
211
|
+
if (N)
|
|
212
212
|
return;
|
|
213
|
-
} else if (e.key === "Tab" &&
|
|
213
|
+
} else if (e.key === "Tab" && N) {
|
|
214
214
|
if (e.shiftKey) {
|
|
215
|
-
const t =
|
|
215
|
+
const t = g && u && i.getPrevEditableCell(g, u, f, C);
|
|
216
216
|
if (t != null && t.prevCell && t.prevCell.click(), t && t.elementToFocus !== "gridcell") {
|
|
217
|
-
|
|
218
|
-
const
|
|
217
|
+
n.blur();
|
|
218
|
+
const d = i.getClosestCellNavId(n);
|
|
219
219
|
setTimeout(() => {
|
|
220
|
-
|
|
220
|
+
d && i.getTableCellByKeyboardNavId(d).focus();
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
223
|
e.preventDefault();
|
|
224
224
|
} else {
|
|
225
|
-
const t =
|
|
225
|
+
const t = g && u && i.getNextEditableCell(g, u, f, C);
|
|
226
226
|
if (t != null && t.nextCell && t.elementToFocus === "gridcell" && t.nextCell.click(), t && t.elementToFocus !== "gridcell") {
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
|
|
227
|
+
n.blur();
|
|
228
|
+
const d = i.getClosestCellNavId(n);
|
|
229
|
+
d && i.getTableCellByKeyboardNavId(d).focus();
|
|
230
230
|
return;
|
|
231
231
|
}
|
|
232
232
|
e.preventDefault();
|
|
@@ -234,85 +234,85 @@ const oe = /* @__PURE__ */ X({
|
|
|
234
234
|
e.preventDefault();
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
if (
|
|
238
|
-
|
|
237
|
+
if (n.closest(".k-filtercell") && w && o.navigatable) {
|
|
238
|
+
L(e, w, V);
|
|
239
239
|
return;
|
|
240
240
|
}
|
|
241
|
-
if (
|
|
241
|
+
if (y !== void 0 && v) {
|
|
242
242
|
if (e.keyCode === s.enter) {
|
|
243
|
-
const t = i.getNavigatableElement(
|
|
244
|
-
level:
|
|
243
|
+
const t = i.getNavigatableElement(n, {
|
|
244
|
+
level: y + 1
|
|
245
245
|
});
|
|
246
246
|
if (t) {
|
|
247
247
|
i.focusElement({
|
|
248
248
|
elementForFocus: t,
|
|
249
249
|
event: e,
|
|
250
|
-
kbContext:
|
|
251
|
-
prevElement:
|
|
250
|
+
kbContext: a,
|
|
251
|
+
prevElement: n
|
|
252
252
|
});
|
|
253
253
|
return;
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
n.querySelector(".k-filtercell") && o.navigatable && R(n), r = i.getFocusableElements(n)[0], i.focusElement({
|
|
256
256
|
elementForFocus: r,
|
|
257
257
|
event: e,
|
|
258
|
-
kbContext:
|
|
259
|
-
prevElement:
|
|
258
|
+
kbContext: a,
|
|
259
|
+
prevElement: n
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
|
-
if (e.keyCode === s.home &&
|
|
263
|
-
if (
|
|
264
|
-
|
|
265
|
-
scope:
|
|
262
|
+
if (e.keyCode === s.home && g)
|
|
263
|
+
if (k)
|
|
264
|
+
J({
|
|
265
|
+
scope: v,
|
|
266
266
|
navigation: l,
|
|
267
|
-
kbContext:
|
|
267
|
+
kbContext: a
|
|
268
268
|
}, e);
|
|
269
269
|
else {
|
|
270
|
-
const t =
|
|
271
|
-
r = i.getActiveNavDataElement(
|
|
270
|
+
const t = j(l.navigationMatrix, g[0]);
|
|
271
|
+
r = i.getActiveNavDataElement(v, t), i.focusElement({
|
|
272
272
|
elementForFocus: r,
|
|
273
273
|
event: e,
|
|
274
|
-
kbContext:
|
|
274
|
+
kbContext: a
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
|
-
if (e.keyCode === s.end &&
|
|
278
|
-
if (
|
|
279
|
-
const t =
|
|
280
|
-
r = i.getActiveNavDataElement(
|
|
277
|
+
if (e.keyCode === s.end && g)
|
|
278
|
+
if (k) {
|
|
279
|
+
const t = X(l.navigationMatrix);
|
|
280
|
+
r = i.getActiveNavDataElement(v, t), i.focusElement({
|
|
281
281
|
elementForFocus: r,
|
|
282
282
|
event: e,
|
|
283
|
-
kbContext:
|
|
283
|
+
kbContext: a
|
|
284
284
|
});
|
|
285
285
|
} else {
|
|
286
|
-
const t =
|
|
287
|
-
r = i.getActiveNavDataElement(
|
|
286
|
+
const t = Q(l.navigationMatrix, g[0]);
|
|
287
|
+
r = i.getActiveNavDataElement(v, t), i.focusElement({
|
|
288
288
|
elementForFocus: r,
|
|
289
289
|
event: e,
|
|
290
|
-
kbContext:
|
|
290
|
+
kbContext: a
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
293
|
if (e.keyCode === s.up || e.keyCode === s.down || e.keyCode === s.left || e.keyCode === s.right) {
|
|
294
|
-
const t = e.keyCode === s.up || e.keyCode === s.left,
|
|
295
|
-
if (
|
|
296
|
-
const [h, p] =
|
|
297
|
-
B && (r = i.getActiveNavDataElement(
|
|
294
|
+
const t = e.keyCode === s.up || e.keyCode === s.left, d = e.keyCode === s.up || e.keyCode === s.down;
|
|
295
|
+
if (g) {
|
|
296
|
+
const [h, p] = g, [B, M] = d ? K(h, p, f, C, t) : Z(h, p, f, C, t);
|
|
297
|
+
B && (r = i.getActiveNavDataElement(v, B), i.focusElement({
|
|
298
298
|
elementForFocus: r,
|
|
299
299
|
event: e,
|
|
300
|
-
kbContext:
|
|
301
|
-
prevElement:
|
|
300
|
+
kbContext: a,
|
|
301
|
+
prevElement: n
|
|
302
302
|
}), l.prevNavigationIndexes = M, this.scrollElementIntoViewForVirtualization(r));
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
if (
|
|
305
|
+
if (k && e.keyCode === s.left && E) {
|
|
306
306
|
c && c({
|
|
307
|
-
focusElement:
|
|
307
|
+
focusElement: n,
|
|
308
308
|
event: e,
|
|
309
309
|
action: "reorderToLeft"
|
|
310
310
|
}), e.preventDefault();
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
|
-
if (
|
|
313
|
+
if (k && e.keyCode === s.right && E) {
|
|
314
314
|
c && c({
|
|
315
|
-
focusElement:
|
|
315
|
+
focusElement: n,
|
|
316
316
|
event: e,
|
|
317
317
|
action: "reorderToRight"
|
|
318
318
|
}), e.preventDefault();
|
|
@@ -334,7 +334,7 @@ const oe = /* @__PURE__ */ X({
|
|
|
334
334
|
}), e.preventDefault();
|
|
335
335
|
return;
|
|
336
336
|
}
|
|
337
|
-
if (!
|
|
337
|
+
if (!E && !I && !N && (e.keyCode === s.space || e.keyCode === s.enter || e.shiftKey && (e.keyCode === s.up || e.keyCode === s.down || e.keyCode === s.left || e.keyCode === s.right))) {
|
|
338
338
|
c && c({
|
|
339
339
|
focusElement: r,
|
|
340
340
|
event: e,
|
|
@@ -350,44 +350,44 @@ const oe = /* @__PURE__ */ X({
|
|
|
350
350
|
},
|
|
351
351
|
generateMatrix(e) {
|
|
352
352
|
const {
|
|
353
|
-
navigation:
|
|
354
|
-
scope:
|
|
353
|
+
navigation: o = this.navigation,
|
|
354
|
+
scope: a
|
|
355
355
|
} = e;
|
|
356
|
-
if (!
|
|
356
|
+
if (!o || !a)
|
|
357
357
|
return;
|
|
358
|
-
const l = [], c = U(
|
|
359
|
-
if (!c || !
|
|
358
|
+
const l = [], c = U(a), u = z(a), r = G(a), b = $(a);
|
|
359
|
+
if (!c || !u)
|
|
360
360
|
return;
|
|
361
|
-
const
|
|
361
|
+
const n = Array.from(c.children), f = r ? Array.from(r.children) : [], E = Array.from(u.children), I = b ? Array.from(b.children) : [], y = W(a) || {
|
|
362
362
|
children: []
|
|
363
363
|
};
|
|
364
|
-
[...
|
|
365
|
-
Array.from(
|
|
366
|
-
const
|
|
367
|
-
if (!
|
|
364
|
+
[...n, ...f, ...E, ...I, y].forEach((v, C) => {
|
|
365
|
+
Array.from(v.children).forEach((k) => {
|
|
366
|
+
const g = Y(k);
|
|
367
|
+
if (!g)
|
|
368
368
|
return;
|
|
369
|
-
const
|
|
370
|
-
let
|
|
371
|
-
for (let
|
|
372
|
-
if (l[
|
|
373
|
-
const
|
|
374
|
-
|
|
369
|
+
const w = k.rowSpan || 1, N = k.colSpan || 1;
|
|
370
|
+
let x;
|
|
371
|
+
for (let m = C, D = C + w; m < D; m++) {
|
|
372
|
+
if (l[m] || (l[m] = []), x === void 0) {
|
|
373
|
+
const A = l[m].findIndex((t) => !t);
|
|
374
|
+
x = A > -1 ? A : l[m].length;
|
|
375
375
|
}
|
|
376
|
-
l[
|
|
376
|
+
l[m][x] = g || "";
|
|
377
377
|
}
|
|
378
|
-
for (let
|
|
379
|
-
l[
|
|
378
|
+
for (let m = x + 1, D = x + N; m < D; m++)
|
|
379
|
+
l[C][m] = g || "";
|
|
380
380
|
});
|
|
381
|
-
}),
|
|
381
|
+
}), o.navigationMatrix = l.filter((v) => !!v), o.lastHeaderIndex = n.length - 1;
|
|
382
382
|
}
|
|
383
383
|
},
|
|
384
384
|
/**
|
|
385
385
|
* @hidden
|
|
386
386
|
*/
|
|
387
387
|
render() {
|
|
388
|
-
return
|
|
388
|
+
return P(this)[0];
|
|
389
389
|
}
|
|
390
390
|
});
|
|
391
391
|
export {
|
|
392
|
-
|
|
392
|
+
le as TableKeyboardNavigationProvider
|
|
393
393
|
};
|
|
@@ -21,6 +21,14 @@ export declare const KEYBOARD_NAV_DATA_HEADER = "data-keyboardnavheader";
|
|
|
21
21
|
* @hidden
|
|
22
22
|
*/
|
|
23
23
|
export declare const KEYBOARD_NAV_DATA_BODY = "data-keyboardnavbody";
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
export declare const KEYBOARD_NAV_DATA_TOP_PINNED = "data-keyboardnavtoppinned";
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
export declare const KEYBOARD_NAV_DATA_BOTTOM_PINNED = "data-keyboardnavbottompinned";
|
|
24
32
|
/**
|
|
25
33
|
* @hidden
|
|
26
34
|
*/
|
|
@@ -59,3 +67,15 @@ export declare const tableKeyboardNavigationHeaderAttributes: {
|
|
|
59
67
|
export declare const tableKeyboardNavigationBodyAttributes: {
|
|
60
68
|
"data-keyboardnavbody": boolean;
|
|
61
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* @hidden
|
|
72
|
+
*/
|
|
73
|
+
export declare const tableKeyboardNavigationTopPinnedAttributes: {
|
|
74
|
+
"data-keyboardnavtoppinned": boolean;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* @hidden
|
|
78
|
+
*/
|
|
79
|
+
export declare const tableKeyboardNavigationBottomPinnedAttributes: {
|
|
80
|
+
"data-keyboardnavbottompinned": boolean;
|
|
81
|
+
};
|
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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o="data-keyboardnavlevel",t="data-keyboardnavscope",A="data-keyboardnavheader",a="data-keyboardnavbody",_="data-keyboardnavtoppinned",e="data-keyboardnavbottompinned",n="data-keyboardnavid",D="data-keyboardnavzone",N="_filter",d="k-grid-cancel-command",i="k-grid-edit-command",E={[t]:!0},r={[A]:!0},b={[a]:!0},O={[_]:!0},T={[e]:!0};exports.KEYBOARD_NAV_CANCEL_BUTTON_CLASS=d;exports.KEYBOARD_NAV_DATA_BODY=a;exports.KEYBOARD_NAV_DATA_BOTTOM_PINNED=e;exports.KEYBOARD_NAV_DATA_HEADER=A;exports.KEYBOARD_NAV_DATA_ID=n;exports.KEYBOARD_NAV_DATA_LEVEL=o;exports.KEYBOARD_NAV_DATA_SCOPE=t;exports.KEYBOARD_NAV_DATA_TOP_PINNED=_;exports.KEYBOARD_NAV_DATA_ZONE=D;exports.KEYBOARD_NAV_EDIT_BUTTON_CLASS=i;exports.KEYBOARD_NAV_FILTER_COL_SUFFIX=N;exports.tableKeyboardNavigationBodyAttributes=b;exports.tableKeyboardNavigationBottomPinnedAttributes=T;exports.tableKeyboardNavigationHeaderAttributes=r;exports.tableKeyboardNavigationScopeAttributes=E;exports.tableKeyboardNavigationTopPinnedAttributes=O;
|
package/navigation/constants.mjs
CHANGED
|
@@ -5,24 +5,32 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const n = "data-keyboardnavlevel", t = "data-keyboardnavscope", a = "data-keyboardnavheader", o = "data-keyboardnavbody", A = "data-keyboardnavtoppinned", e = "data-keyboardnavbottompinned", _ = "data-keyboardnavid", d = "data-keyboardnavzone", r = "_filter", b = "k-grid-cancel-command", D = "k-grid-edit-command", i = {
|
|
9
|
+
[t]: !0
|
|
10
|
+
}, N = {
|
|
9
11
|
[a]: !0
|
|
10
12
|
}, c = {
|
|
11
|
-
[
|
|
12
|
-
},
|
|
13
|
+
[o]: !0
|
|
14
|
+
}, s = {
|
|
13
15
|
[A]: !0
|
|
16
|
+
}, E = {
|
|
17
|
+
[e]: !0
|
|
14
18
|
};
|
|
15
19
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
d as
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
b as KEYBOARD_NAV_CANCEL_BUTTON_CLASS,
|
|
21
|
+
o as KEYBOARD_NAV_DATA_BODY,
|
|
22
|
+
e as KEYBOARD_NAV_DATA_BOTTOM_PINNED,
|
|
23
|
+
a as KEYBOARD_NAV_DATA_HEADER,
|
|
24
|
+
_ as KEYBOARD_NAV_DATA_ID,
|
|
25
|
+
n as KEYBOARD_NAV_DATA_LEVEL,
|
|
26
|
+
t as KEYBOARD_NAV_DATA_SCOPE,
|
|
27
|
+
A as KEYBOARD_NAV_DATA_TOP_PINNED,
|
|
28
|
+
d as KEYBOARD_NAV_DATA_ZONE,
|
|
29
|
+
D as KEYBOARD_NAV_EDIT_BUTTON_CLASS,
|
|
30
|
+
r as KEYBOARD_NAV_FILTER_COL_SUFFIX,
|
|
31
|
+
c as tableKeyboardNavigationBodyAttributes,
|
|
32
|
+
E as tableKeyboardNavigationBottomPinnedAttributes,
|
|
33
|
+
N as tableKeyboardNavigationHeaderAttributes,
|
|
34
|
+
i as tableKeyboardNavigationScopeAttributes,
|
|
35
|
+
s as tableKeyboardNavigationTopPinnedAttributes
|
|
28
36
|
};
|
package/navigation/utils.d.ts
CHANGED
|
@@ -77,6 +77,14 @@ export declare const getHeaderElement: (scope: HTMLElement) => Element;
|
|
|
77
77
|
* @hidden
|
|
78
78
|
*/
|
|
79
79
|
export declare const getBodyElement: (scope: HTMLElement) => Element;
|
|
80
|
+
/**
|
|
81
|
+
* @hidden
|
|
82
|
+
*/
|
|
83
|
+
export declare const getTopPinnedElement: (scope: HTMLElement) => Element;
|
|
84
|
+
/**
|
|
85
|
+
* @hidden
|
|
86
|
+
*/
|
|
87
|
+
export declare const getBottomPinnedElement: (scope: HTMLElement) => Element;
|
|
80
88
|
/**
|
|
81
89
|
* @hidden
|
|
82
90
|
*/
|
|
@@ -241,6 +249,8 @@ export declare const tableKeyboardNavigationTools: {
|
|
|
241
249
|
getClosestScope: (target: HTMLElement) => Element;
|
|
242
250
|
getHeaderElement: (scope: HTMLElement) => Element;
|
|
243
251
|
getBodyElement: (scope: HTMLElement) => Element;
|
|
252
|
+
getTopPinnedElement: (scope: HTMLElement) => Element;
|
|
253
|
+
getBottomPinnedElement: (scope: HTMLElement) => Element;
|
|
244
254
|
getFocusableElements: (scope: HTMLElement, options?: {
|
|
245
255
|
focusable: boolean;
|
|
246
256
|
}) => Element[];
|
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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@progress/kendo-vue-common"),a=require("./constants.js"),S=(e,t,n="cell")=>`${t}_${e}_${n}`,x=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,y=(e,t={level:0})=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_LEVEL}='${t.level}']`),N=e=>e.parentElement&&e.parentElement.closest(`[${a.KEYBOARD_NAV_DATA_LEVEL}]`),C=(e,t)=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_ID}='${t}']`),T=e=>e.parentElement&&e.parentElement.closest(`[${a.KEYBOARD_NAV_DATA_SCOPE}]`),k=e=>{var n;const t=((n=e==null?void 0:e.parentElement)==null?void 0:n.closest(".k-grid-edit-row"))||null;return t==null?void 0:t.querySelector("."+a.KEYBOARD_NAV_CANCEL_BUTTON_CLASS)},R=e=>document.querySelector(`[aria-rowindex="${e}"] .k-grid-remove-command`),u=e=>document.querySelector(`[data-keyboardnavid="${e}"]`),w=e=>{var l,r;const t=(l=e==null?void 0:e.parentElement)==null?void 0:l.closest(".k-table-row");let n;return(r=t==null?void 0:t.parentElement)==null||r.childNodes.forEach(o=>{if(t===o){const s=o.previousSibling;n={current:t.getAttribute("aria-rowindex"),prev:s==null?void 0:s.getAttribute("aria-rowindex")}}}),n};async function L(e,t,n=5e3){const l=Date.now();if(t)for(;Date.now()-l<n;){const r=t.querySelector(e);if(r)return r;await new Promise(o=>setTimeout(o,20))}return!1}const O=async e=>{var l;const t=((l=e==null?void 0:e.parentElement)==null?void 0:l.closest(".k-grid-edit-row"))||null;return await L("."+a.KEYBOARD_NAV_EDIT_BUTTON_CLASS,t)},p=e=>(e==null?void 0:e.closest(".k-table-td"))||null,F=e=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_HEADER}]`),V=e=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_BODY}]`),$=e=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_TOP_PINNED}]`),h=e=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_BOTTOM_PINNED}]`),ee=e=>e.querySelector(".k-grid-norecords"),K=(e,t)=>{const{scope:n,navigation:l,kbContext:r}=e;if(!l||!n)return;const o=H(l.navigationMatrix),s=C(n,o);D({elementForFocus:s,kbContext:r,event:t})},_=(e,t={focusable:!1})=>{const n=t.focusable?g.FOCUSABLE_ELEMENTS:g.TABBABLE_ELEMENTS;return Array.from(e.querySelectorAll(n.join(",")))},P=(e,t={level:0})=>{if(!e)return[];const n=g.FOCUSABLE_ELEMENTS.map(l=>l+`[${a.KEYBOARD_NAV_DATA_LEVEL}='${t.level}']`).join(",");return Array.from(e.querySelectorAll(n))},q=(e={level:0})=>{const t=g.FOCUSABLE_ELEMENTS.map(n=>n+`[${a.KEYBOARD_NAV_DATA_LEVEL}='${e.level}']`).join(",");return n=>n.matches(t)},D=e=>{const{elementForFocus:t,event:n,kbContext:l,prevElement:r}=e;if(l&&t&&t.focus){n==null||n.preventDefault();const o=t.querySelector(".k-checkbox-wrap .k-checkbox");o!=null&&o.focus?o.focus():t.focus(),A(t)&&(t.setAttribute("tabIndex","0"),l.activeId=b(t)),r&&A(r)&&r.setAttribute("tabIndex","-1")}},Y=e=>e?e.idPrefix:"",M=(e,t,n,l,r)=>{if(!n)return[];let o=e+(r?-1:1);for(;o>=0&&o<l.length;){const s=l[o][t];if(s!==n)return[s,[o,t]];o=o+(r?-1:1)}return[]},d=(e,t,n,l,r)=>{if(!n)return[];let o=t+(r?-1:1);for(;o>=0&&l[e]&&o<l[e].length;){const s=l[e][o];if(s!==n)return[s,[e,o]];o=o+(r?-1:1)}return[]},f=(e,t)=>{if(t){for(let n=0;n<e.length;n++)for(let l=0;l<e[n].length;l++)if(e[n][l]===t)return[n,l]}},B=(e,t,n)=>{let l;do if(e=e+1,l=t[n-e],l!=null&&l.editable)break;while(n-e>=0);return l},U=(e,t,n,l)=>{var m;let r;const[o,s]=e;let i;const c=0,E=t.length;return i=B(c,t,s),i?r=d(o,i.ariaColumnIndex,n,l,!0):(i=B(c,t,E),r=d(o-1,i.ariaColumnIndex,n,l,!0)),{prevCell:(r==null?void 0:r[0])&&u(r[0]),elementToFocus:(r==null?void 0:r[0])&&((m=u(r[0]))==null?void 0:m.getAttribute("role"))}},v=(e,t,n)=>{let l;do if(e=e+1,l=t[n+e],l!=null&&l.editable)break;while(n+e-1<t.length);return l},j=(e,t,n,l)=>{var o;let r;if(e){const[s,i]=e;let c,E=0;c=v(E,t,i),c?r=d(s,c.ariaColumnIndex,n,l,!0):(E=-1,c=v(E,t,0),r=d(s+1,c.ariaColumnIndex,n,l,!0))}return{nextCell:(r==null?void 0:r[0])&&u(r[0]),elementToFocus:(r==null?void 0:r[0])&&((o=u(r[0]))==null?void 0:o.getAttribute("role"))}},W=e=>{var t;return(t=e==null?void 0:e.navigationMatrix.length)!=null?t:0},H=e=>e.flat().find(t=>t.endsWith("cell")),te=e=>e.flat().reverse().find(t=>t.endsWith("cell")),ne=(e,t)=>e[t][0],le=(e,t)=>Array.from(e[t]).reverse()[0],X=e=>e?`${e}${a.KEYBOARD_NAV_FILTER_COL_SUFFIX}`:"",re=(e,t,n)=>{let l;if(e!=null&&e.prevNavigationIndexes){const[r,o]=e.prevNavigationIndexes,s=t[r];(s==null?void 0:s[o])===n?l=e.prevNavigationIndexes:l=f(t,n)}else l=f(t,n);return l},z=e=>{var t;return((t=N(e))==null?void 0:t.getAttribute("data-keyboardnavid"))||e.getAttribute("data-keyboardnavid")},G=e=>e.closest(".k-grid-stack-cell"),I=e=>_(e,{focusable:!0}),J=(e,t)=>{var o;const n=e.closest(".k-table-td");if(!n)return null;const l=Array.from(n.querySelectorAll(".k-grid-stack-cell")),r=l.indexOf(e);return r===-1?null:t==="next"?r<l.length-1?l[r+1]:l[0]:r>0?l[r-1]:(o=l.at(-1))!=null?o:null},Q=e=>e.closest(".k-table-td, td.k-table-td[tabindex]"),Z=(e,t=0)=>{const n=I(e);n.length>0?(n[t]||n[0]).focus():e.focus()},oe={generateNavigatableId:S,getNavigatableId:b,getNavigatableLevel:x,getNavigatableElement:y,getClosestNavigatableElement:N,getActiveNavDataElement:C,getClosestScope:T,getHeaderElement:F,getBodyElement:V,getTopPinnedElement:$,getBottomPinnedElement:h,getFocusableElements:_,getNavigatableElements:P,filterNavigatableElements:q,focusElement:D,getIdPrefix:Y,isNavigatable:A,findNextIdByRowIndex:M,findNextIdByCellIndex:d,findId:f,getNextNavigationIndex:W,getFilterColumnId:X,focusFirstDataElement:K,getClosestCancelButton:k,getClosestEditButton:O,getRowAriaRowIndex:w,getRemoveButtonByAriaRowIndex:R,getTableCellByKeyboardNavId:u,getParentCell:p,waitForElementToBeVisible:L,getNextEditableCell:j,getPrevEditableCell:U,getClosestCellNavId:z,getStackedCellWrapper:G,getStackedCellFocusableElements:I,getNextStackedCell:J,getStackedCellContainer:Q,focusStackedCellElement:Z};exports.filterNavigatableElements=q;exports.findId=f;exports.findNextIdByCellIndex=d;exports.findNextIdByRowIndex=M;exports.focusElement=D;exports.focusFirstDataElement=K;exports.focusStackedCellElement=Z;exports.generateNavigatableId=S;exports.getActiveNavDataElement=C;exports.getBodyElement=V;exports.getBottomPinnedElement=h;exports.getClosestCancelButton=k;exports.getClosestCellNavId=z;exports.getClosestEditButton=O;exports.getClosestNavigatableElement=N;exports.getClosestScope=T;exports.getCurrentIdIndexes=re;exports.getFilterColumnId=X;exports.getFirstDataCell=H;exports.getFirstRowDataCell=ne;exports.getFocusableElements=_;exports.getHeaderElement=F;exports.getIdPrefix=Y;exports.getLastDataCell=te;exports.getLastRowDataCell=le;exports.getNavigatableElement=y;exports.getNavigatableElements=P;exports.getNavigatableId=b;exports.getNavigatableLevel=x;exports.getNextEditableCell=j;exports.getNextNavigationIndex=W;exports.getNextStackedCell=J;exports.getNoRecordsElement=ee;exports.getParentCell=p;exports.getPrevEditableCell=U;exports.getRemoveButtonByAriaRowIndex=R;exports.getRowAriaRowIndex=w;exports.getStackedCellContainer=Q;exports.getStackedCellFocusableElements=I;exports.getStackedCellWrapper=G;exports.getTableCellByKeyboardNavId=u;exports.getTopPinnedElement=$;exports.isNavigatable=A;exports.tableKeyboardNavigationTools=oe;
|