@progress/kendo-react-data-tools 7.5.0-develop.9 → 8.0.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 +23 -3
- package/index.d.ts +23 -3
- package/navigation/TableKeyboardNavigation.js +1 -1
- package/navigation/TableKeyboardNavigation.mjs +121 -91
- package/navigation/utils.js +1 -1
- package/navigation/utils.mjs +101 -75
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
- package/selection/TableSelection.js +1 -1
- package/selection/TableSelection.mjs +79 -69
- package/selection/utils.js +1 -1
- package/selection/utils.mjs +85 -84
|
@@ -6,140 +6,170 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import { guid as
|
|
10
|
-
import {
|
|
11
|
-
const
|
|
12
|
-
const { navigatable:
|
|
13
|
-
|
|
9
|
+
import { guid as k, getActiveElement as A, Keys as l } from "@progress/kendo-react-common";
|
|
10
|
+
import { focusFirstDataElement as D, getFirstDataCell as N, tableKeyboardNavigationTools as o, getCurrentIdIndexes as F, getFirstRowDataCell as w, getLastRowDataCell as M, getLastDataCell as P, getHeaderElement as K, getBodyElement as L, getNoRecordsElement as T, getNavigatableId as B, findNextIdByRowIndex as H, findNextIdByCellIndex as U } from "./utils.mjs";
|
|
11
|
+
const R = (e) => {
|
|
12
|
+
const { navigatable: c, contextStateRef: n, navigationStateRef: t, idPrefix: r } = e;
|
|
13
|
+
c && (n.current = {
|
|
14
14
|
activeId: "",
|
|
15
15
|
level: 0
|
|
16
16
|
}, t.current = {
|
|
17
17
|
activeElementIsFocused: !1,
|
|
18
18
|
prevNavigationIndexes: void 0,
|
|
19
|
-
idPrefix:
|
|
19
|
+
idPrefix: r || k(),
|
|
20
20
|
navigationMatrix: [],
|
|
21
21
|
lastHeaderIndex: -1
|
|
22
22
|
});
|
|
23
|
-
},
|
|
24
|
-
const { scope:
|
|
25
|
-
if (n.current && t.current &&
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
const
|
|
30
|
-
|
|
23
|
+
}, h = (e) => {
|
|
24
|
+
const { scope: c, contextStateRef: n, navigationStateRef: t } = e;
|
|
25
|
+
if (n.current && t.current && c) {
|
|
26
|
+
b(e);
|
|
27
|
+
const r = N(t.current.navigationMatrix);
|
|
28
|
+
if (r) {
|
|
29
|
+
const a = o.getActiveNavDataElement(c, r);
|
|
30
|
+
a && (n.current.activeId = r, a.setAttribute("tabIndex", "0"));
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
},
|
|
34
|
-
const { contextStateRef:
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
|
|
33
|
+
}, O = (e) => {
|
|
34
|
+
const { contextStateRef: c, navigationStateRef: n, document: t } = e;
|
|
35
|
+
if (c.current && n.current && t) {
|
|
36
|
+
const r = A(t), a = o.getNavigatableId(r);
|
|
37
|
+
a && a === c.current.activeId && (n.current.activeElementIsFocused = !0);
|
|
38
38
|
}
|
|
39
|
-
},
|
|
40
|
-
const { scope:
|
|
41
|
-
if (
|
|
42
|
-
if (!
|
|
43
|
-
const
|
|
44
|
-
|
|
39
|
+
}, G = (e) => {
|
|
40
|
+
const { scope: c, contextStateRef: n, navigationStateRef: t, focusFirst: r } = e;
|
|
41
|
+
if (r && (R(e), h(e), D(e)), b(e), n.current && t.current && c) {
|
|
42
|
+
if (!o.getActiveNavDataElement(c, n.current.activeId)) {
|
|
43
|
+
const f = N(t.current.navigationMatrix), i = o.getActiveNavDataElement(c, f);
|
|
44
|
+
f && i && (n.current.activeId = f, i.setAttribute("tabIndex", "0"), t.current.activeElementIsFocused && i.focus());
|
|
45
45
|
}
|
|
46
46
|
t.current.activeElementIsFocused = !1;
|
|
47
47
|
}
|
|
48
|
-
},
|
|
49
|
-
const { contextStateRef: n } =
|
|
48
|
+
}, V = (e, c) => {
|
|
49
|
+
const { contextStateRef: n } = c;
|
|
50
50
|
if (e.isDefaultPrevented() || !n.current)
|
|
51
51
|
return;
|
|
52
|
-
const t = e.target,
|
|
53
|
-
if (
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
52
|
+
const t = e.target, r = o.getNavigatableId(t);
|
|
53
|
+
if (r && r !== n.current.activeId) {
|
|
54
|
+
const a = o.getClosestScope(t);
|
|
55
|
+
if (!a)
|
|
56
56
|
return;
|
|
57
|
-
const
|
|
58
|
-
|
|
57
|
+
const f = o.getActiveNavDataElement(a, n.current.activeId);
|
|
58
|
+
f && f.setAttribute("tabIndex", "-1"), t.setAttribute("tabIndex", "0"), n.current.activeId = r;
|
|
59
59
|
}
|
|
60
|
-
},
|
|
60
|
+
}, W = (e, c) => {
|
|
61
61
|
const {
|
|
62
62
|
contextStateRef: n,
|
|
63
63
|
navigationStateRef: t,
|
|
64
|
-
onNavigationAction:
|
|
65
|
-
} =
|
|
64
|
+
onNavigationAction: r
|
|
65
|
+
} = c;
|
|
66
66
|
if (e.isDefaultPrevented() || !n.current || !t.current)
|
|
67
67
|
return;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
a.focusElement({ elementForFocus:
|
|
68
|
+
let a;
|
|
69
|
+
if (e.keyCode === l.esc) {
|
|
70
|
+
a = o.getClosestNavigatableElement(e.target), o.focusElement({ elementForFocus: a, event: e, contextStateRef: n });
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
if (e.keyCode ===
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
elementForFocus:
|
|
73
|
+
const f = e.target, i = f.className.indexOf("k-checkbox") === -1 ? f : o.getClosestNavigatableElement(f), g = o.getNavigatableId(i), E = g == null ? void 0 : g.endsWith("column"), x = o.getNavigatableLevel(i), u = o.getClosestScope(i), v = t.current.navigationMatrix, I = e.metaKey || e.ctrlKey, m = F(t, v, g);
|
|
74
|
+
if (x !== void 0 && u) {
|
|
75
|
+
if (e.keyCode === l.enter) {
|
|
76
|
+
const s = o.getNavigatableElement(i, { level: x + 1 });
|
|
77
|
+
if (s) {
|
|
78
|
+
o.focusElement({
|
|
79
|
+
elementForFocus: s,
|
|
80
80
|
event: e,
|
|
81
81
|
contextStateRef: n,
|
|
82
82
|
prevElement: i
|
|
83
83
|
});
|
|
84
84
|
return;
|
|
85
85
|
} else {
|
|
86
|
-
|
|
87
|
-
a.focusElement({ elementForFocus: E, event: e, contextStateRef: n, prevElement: i });
|
|
86
|
+
a = o.getFocusableElements(i)[0], o.focusElement({ elementForFocus: a, event: e, contextStateRef: n, prevElement: i });
|
|
88
87
|
return;
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
|
-
if (e.keyCode ===
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
90
|
+
if (e.keyCode === l.home && m)
|
|
91
|
+
if (I)
|
|
92
|
+
D(
|
|
93
|
+
{
|
|
94
|
+
scope: u,
|
|
95
|
+
navigationStateRef: t,
|
|
96
|
+
contextStateRef: n
|
|
97
|
+
},
|
|
98
|
+
e
|
|
99
|
+
);
|
|
100
|
+
else {
|
|
101
|
+
const s = w(t.current.navigationMatrix, m[0]);
|
|
102
|
+
a = o.getActiveNavDataElement(u, s), o.focusElement({ elementForFocus: a, event: e, contextStateRef: n });
|
|
103
|
+
}
|
|
104
|
+
if (e.keyCode === l.end && m)
|
|
105
|
+
if (I) {
|
|
106
|
+
const s = P(t.current.navigationMatrix);
|
|
107
|
+
a = o.getActiveNavDataElement(u, s), o.focusElement({ elementForFocus: a, event: e, contextStateRef: n });
|
|
108
|
+
} else {
|
|
109
|
+
const s = M(t.current.navigationMatrix, m[0]);
|
|
110
|
+
a = o.getActiveNavDataElement(u, s), o.focusElement({ elementForFocus: a, event: e, contextStateRef: n });
|
|
105
111
|
}
|
|
112
|
+
if (e.keyCode === l.up || e.keyCode === l.down || e.keyCode === l.left || e.keyCode === l.right) {
|
|
113
|
+
const s = e.keyCode === l.up || e.keyCode === l.left, d = e.keyCode === l.up || e.keyCode === l.down;
|
|
114
|
+
if (m) {
|
|
115
|
+
const [p, C] = m, [y, S] = d ? H(p, C, g, v, s) : U(p, C, g, v, s);
|
|
116
|
+
y && (a = o.getActiveNavDataElement(u, y), o.focusElement({ elementForFocus: a, event: e, contextStateRef: n, prevElement: i }), t.current.prevNavigationIndexes = S);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (I && e.keyCode === l.left && E) {
|
|
120
|
+
r && r({ focusElement: i, event: e, action: "reorderToLeft" }), e.preventDefault();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (I && e.keyCode === l.right && E) {
|
|
124
|
+
r && r({ focusElement: i, event: e, action: "reorderToRight" }), e.preventDefault();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (e.keyCode === l.pageUp) {
|
|
128
|
+
r && r({ focusElement: a, event: e, action: "moveToNextPage" }), e.preventDefault();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (e.keyCode === l.pageDown) {
|
|
132
|
+
r && r({ focusElement: a, event: e, action: "moveToPrevPage" }), e.preventDefault();
|
|
133
|
+
return;
|
|
106
134
|
}
|
|
135
|
+
r && r({ focusElement: a, event: e });
|
|
107
136
|
}
|
|
108
|
-
},
|
|
109
|
-
const { navigationStateRef:
|
|
110
|
-
if (!
|
|
137
|
+
}, b = (e) => {
|
|
138
|
+
const { navigationStateRef: c, scope: n } = e;
|
|
139
|
+
if (!c.current || !n)
|
|
111
140
|
return;
|
|
112
|
-
const t = [],
|
|
113
|
-
if (!
|
|
141
|
+
const t = [], r = K(n), a = L(n), f = T(n) || { children: [] };
|
|
142
|
+
if (!r || !a)
|
|
114
143
|
return;
|
|
115
|
-
const i = Array.from(
|
|
116
|
-
[...i, ...
|
|
117
|
-
Array.from(
|
|
118
|
-
const
|
|
119
|
-
if (!
|
|
144
|
+
const i = Array.from(r.children), g = Array.from(a.children);
|
|
145
|
+
[...i, ...g, f].forEach((E, x) => {
|
|
146
|
+
Array.from(E.children).forEach((u) => {
|
|
147
|
+
const v = B(u);
|
|
148
|
+
if (!v)
|
|
120
149
|
return;
|
|
121
|
-
const
|
|
122
|
-
let
|
|
123
|
-
for (let
|
|
124
|
-
if (t[
|
|
125
|
-
const
|
|
126
|
-
|
|
150
|
+
const I = u.rowSpan || 1, m = u.colSpan || 1;
|
|
151
|
+
let s;
|
|
152
|
+
for (let d = x, p = x + I; d < p; d++) {
|
|
153
|
+
if (t[d] || (t[d] = []), s === void 0) {
|
|
154
|
+
const C = t[d].findIndex((y) => !y);
|
|
155
|
+
s = C > -1 ? C : t[d].length;
|
|
127
156
|
}
|
|
128
|
-
t[
|
|
157
|
+
t[d][s] = v || "";
|
|
129
158
|
}
|
|
130
|
-
for (let
|
|
131
|
-
t[
|
|
159
|
+
for (let d = s + 1, p = s + m; d < p; d++)
|
|
160
|
+
t[x][d] = v || "";
|
|
132
161
|
});
|
|
133
|
-
}),
|
|
134
|
-
},
|
|
135
|
-
onConstructor:
|
|
136
|
-
onComponentDidMount:
|
|
137
|
-
onGetSnapshotBeforeUpdate:
|
|
138
|
-
onComponentDidUpdate:
|
|
139
|
-
onFocus:
|
|
140
|
-
onKeyDown:
|
|
141
|
-
generateMatrix:
|
|
162
|
+
}), c.current.navigationMatrix = t.filter((E) => !!E), c.current.lastHeaderIndex = i.length - 1;
|
|
163
|
+
}, z = {
|
|
164
|
+
onConstructor: R,
|
|
165
|
+
onComponentDidMount: h,
|
|
166
|
+
onGetSnapshotBeforeUpdate: O,
|
|
167
|
+
onComponentDidUpdate: G,
|
|
168
|
+
onFocus: V,
|
|
169
|
+
onKeyDown: W,
|
|
170
|
+
generateMatrix: b,
|
|
171
|
+
focusFirstDataElement: D
|
|
142
172
|
};
|
|
143
173
|
export {
|
|
144
|
-
|
|
174
|
+
z as tableKeyboardNavigation
|
|
145
175
|
};
|
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 c=require("@progress/kendo-react-common"),a=require("./constants.js"),d=(e,t,r="cell")=>`${t}_${e}_${r}`,f=e=>{if(e)return parseInt(e.getAttribute(a.KEYBOARD_NAV_DATA_LEVEL)||"",10)},E=e=>{if(!e)return;const t=e.getAttribute(a.KEYBOARD_NAV_DATA_ID);return t||void 0},u=e=>e?!!e.getAttribute(a.KEYBOARD_NAV_DATA_ID):!1,N=(e,t={level:0})=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_LEVEL}='${t.level}']`),_=e=>e&&e.parentElement&&e.parentElement.closest(`[${a.KEYBOARD_NAV_DATA_LEVEL}]`),g=(e,t)=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_ID}='${t}']`),D=e=>e&&e.parentElement&&e.parentElement.closest(`[${a.KEYBOARD_NAV_DATA_SCOPE}]`),I=e=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_HEADER}]`),v=e=>e.querySelector(`[${a.KEYBOARD_NAV_DATA_BODY}]`),O=e=>e.querySelector(".k-grid-norecords"),b=(e,t)=>{const{scope:r,navigationStateRef:n,contextStateRef:o}=e;if(!n.current||!r)return;const l=R(n.current.navigationMatrix),s=g(r,l);A({elementForFocus:s,contextStateRef:o,event:t})},m=(e,t={focusable:!1})=>{const r=t.focusable?c.FOCUSABLE_ELEMENTS:c.TABBABLE_ELEMENTS;return Array.from(e.querySelectorAll(r.join(",")))},x=(e,t={level:0})=>{if(!e)return[];const r=c.FOCUSABLE_ELEMENTS.map(n=>n+`[${a.KEYBOARD_NAV_DATA_LEVEL}='${t.level}']`).join(",");return Array.from(e.querySelectorAll(r))},C=(e={level:0})=>{const t=c.FOCUSABLE_ELEMENTS.map(r=>r+`[${a.KEYBOARD_NAV_DATA_LEVEL}='${e.level}']`).join(",");return r=>r.matches(t)},A=e=>{const{elementForFocus:t,event:r,contextStateRef:n,prevElement:o}=e;if(n.current&&t&&t.focus){r==null||r.preventDefault();const l=t.querySelector(".k-checkbox-wrap .k-checkbox");l&&l.focus?l.focus():t.focus(),u(t)&&(t.setAttribute("tabIndex","0"),n.current.activeId=E(t)),o&&u(o)&&o.setAttribute("tabIndex","-1")}},B=e=>e.current?e.current.idPrefix:"",L=(e,t,r,n,o)=>{if(!r)return[];let l=e+(o?-1:1);for(;l>=0&&l<n.length;){const s=n[l][t];if(s!==r)return[s,[l,t]];l=l+(o?-1:1)}return[]},y=(e,t,r,n,o)=>{if(!r)return[];let l=t+(o?-1:1);for(;l>=0&&l<n[e].length;){const s=n[e][l];if(s!==r)return[s,[e,l]];l=l+(o?-1:1)}return[]},i=(e,t)=>{if(t){for(let r=0;r<e.length;r++)for(let n=0;n<e[r].length;n++)if(e[r][n]===t)return[r,n]}},F=e=>e.current?e.current.navigationMatrix.length:0,R=e=>e.flat().find(t=>t.endsWith("cell")),S=e=>e.flat().reverse().find(t=>t.endsWith("cell")),V=(e,t)=>e[t][0],$=(e,t)=>Array.from(e[t]).reverse()[0],T=e=>e?`${e}${a.KEYBOARD_NAV_FILTER_COL_SUFFIX}`:"",p=(e,t,r)=>{let n;if(e.current&&e.current.prevNavigationIndexes){const[o,l]=e.current.prevNavigationIndexes;t[o][l]===r?n=e.current.prevNavigationIndexes:n=i(t,r)}else n=i(t,r);return n},K={generateNavigatableId:d,getNavigatableId:E,getNavigatableLevel:f,getNavigatableElement:N,getClosestNavigatableElement:_,getActiveNavDataElement:g,getClosestScope:D,getHeaderElement:I,getBodyElement:v,getFocusableElements:m,getNavigatableElements:x,filterNavigatableElements:C,focusElement:A,getIdPrefix:B,isNavigatable:u,findNextIdByRowIndex:L,findNextIdByCellIndex:y,findId:i,getNextNavigationIndex:F,getFilterColumnId:T,focusFirstDataElement:b};exports.filterNavigatableElements=C;exports.findId=i;exports.findNextIdByCellIndex=y;exports.findNextIdByRowIndex=L;exports.focusElement=A;exports.focusFirstDataElement=b;exports.generateNavigatableId=d;exports.getActiveNavDataElement=g;exports.getBodyElement=v;exports.getClosestNavigatableElement=_;exports.getClosestScope=D;exports.getCurrentIdIndexes=p;exports.getFilterColumnId=T;exports.getFirstDataCell=R;exports.getFirstRowDataCell=V;exports.getFocusableElements=m;exports.getHeaderElement=I;exports.getIdPrefix=B;exports.getLastDataCell=S;exports.getLastRowDataCell=$;exports.getNavigatableElement=N;exports.getNavigatableElements=x;exports.getNavigatableId=E;exports.getNavigatableLevel=f;exports.getNextNavigationIndex=F;exports.getNoRecordsElement=O;exports.isNavigatable=u;exports.tableKeyboardNavigationTools=K;
|
package/navigation/utils.mjs
CHANGED
|
@@ -6,107 +6,133 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import { FOCUSABLE_ELEMENTS as
|
|
10
|
-
import { KEYBOARD_NAV_DATA_LEVEL as
|
|
11
|
-
const _ = (e, t, r = "cell") => `${t}_${e}_${r}`,
|
|
9
|
+
import { FOCUSABLE_ELEMENTS as i, TABBABLE_ELEMENTS as g } from "@progress/kendo-react-common";
|
|
10
|
+
import { KEYBOARD_NAV_DATA_LEVEL as s, KEYBOARD_NAV_DATA_ID as f, KEYBOARD_NAV_DATA_SCOPE as I, KEYBOARD_NAV_DATA_HEADER as N, KEYBOARD_NAV_DATA_BODY as v, KEYBOARD_NAV_FILTER_COL_SUFFIX as b } from "./constants.mjs";
|
|
11
|
+
const _ = (e, t, r = "cell") => `${t}_${e}_${r}`, D = (e) => {
|
|
12
12
|
if (e)
|
|
13
|
-
return parseInt(e.getAttribute(
|
|
14
|
-
},
|
|
13
|
+
return parseInt(e.getAttribute(s) || "", 10);
|
|
14
|
+
}, d = (e) => {
|
|
15
15
|
if (!e)
|
|
16
16
|
return;
|
|
17
|
-
const t = e.getAttribute(
|
|
17
|
+
const t = e.getAttribute(f);
|
|
18
18
|
return t || void 0;
|
|
19
|
-
},
|
|
20
|
-
const
|
|
19
|
+
}, u = (e) => e ? !!e.getAttribute(f) : !1, x = (e, t = { level: 0 }) => e.querySelector(`[${s}='${t.level}']`), m = (e) => e && e.parentElement && e.parentElement.closest(`[${s}]`), A = (e, t) => e.querySelector(`[${f}='${t}']`), p = (e) => e && e.parentElement && e.parentElement.closest(`[${I}]`), $ = (e) => e.querySelector(`[${N}]`), y = (e) => e.querySelector(`[${v}]`), V = (e) => e.querySelector(".k-grid-norecords"), B = (e, t) => {
|
|
20
|
+
const {
|
|
21
|
+
scope: r,
|
|
22
|
+
navigationStateRef: n,
|
|
23
|
+
contextStateRef: l
|
|
24
|
+
} = e;
|
|
25
|
+
if (!n.current || !r)
|
|
26
|
+
return;
|
|
27
|
+
const o = R(n.current.navigationMatrix), c = A(r, o);
|
|
28
|
+
E({ elementForFocus: c, contextStateRef: l, event: t });
|
|
29
|
+
}, C = (e, t = { focusable: !1 }) => {
|
|
30
|
+
const r = t.focusable ? i : g;
|
|
21
31
|
return Array.from(e.querySelectorAll(r.join(",")));
|
|
22
|
-
},
|
|
32
|
+
}, h = (e, t = { level: 0 }) => {
|
|
23
33
|
if (!e)
|
|
24
34
|
return [];
|
|
25
|
-
const r =
|
|
35
|
+
const r = i.map((n) => n + `[${s}='${t.level}']`).join(",");
|
|
26
36
|
return Array.from(e.querySelectorAll(r));
|
|
27
|
-
},
|
|
28
|
-
const t =
|
|
29
|
-
(r) => r + `[${
|
|
37
|
+
}, F = (e = { level: 0 }) => {
|
|
38
|
+
const t = i.map(
|
|
39
|
+
(r) => r + `[${s}='${e.level}']`
|
|
30
40
|
).join(",");
|
|
31
41
|
return (r) => r.matches(t);
|
|
32
|
-
},
|
|
33
|
-
const { elementForFocus: t, event: r, contextStateRef:
|
|
34
|
-
if (
|
|
35
|
-
r.preventDefault();
|
|
36
|
-
const
|
|
37
|
-
|
|
42
|
+
}, E = (e) => {
|
|
43
|
+
const { elementForFocus: t, event: r, contextStateRef: n, prevElement: l } = e;
|
|
44
|
+
if (n.current && t && t.focus) {
|
|
45
|
+
r == null || r.preventDefault();
|
|
46
|
+
const o = t.querySelector(".k-checkbox-wrap .k-checkbox");
|
|
47
|
+
o && o.focus ? o.focus() : t.focus(), u(t) && (t.setAttribute("tabIndex", "0"), n.current.activeId = d(t)), l && u(l) && l.setAttribute("tabIndex", "-1");
|
|
38
48
|
}
|
|
39
|
-
},
|
|
49
|
+
}, S = (e) => e.current ? e.current.idPrefix : "", L = (e, t, r, n, l) => {
|
|
40
50
|
if (!r)
|
|
41
51
|
return [];
|
|
42
|
-
let
|
|
43
|
-
for (;
|
|
44
|
-
const c =
|
|
52
|
+
let o = e + (l ? -1 : 1);
|
|
53
|
+
for (; o >= 0 && o < n.length; ) {
|
|
54
|
+
const c = n[o][t];
|
|
45
55
|
if (c !== r)
|
|
46
|
-
return [c, [
|
|
47
|
-
|
|
56
|
+
return [c, [o, t]];
|
|
57
|
+
o = o + (l ? -1 : 1);
|
|
48
58
|
}
|
|
49
59
|
return [];
|
|
50
|
-
},
|
|
60
|
+
}, O = (e, t, r, n, l) => {
|
|
51
61
|
if (!r)
|
|
52
62
|
return [];
|
|
53
|
-
let
|
|
54
|
-
for (;
|
|
55
|
-
const c =
|
|
63
|
+
let o = t + (l ? -1 : 1);
|
|
64
|
+
for (; o >= 0 && o < n[e].length; ) {
|
|
65
|
+
const c = n[e][o];
|
|
56
66
|
if (c !== r)
|
|
57
|
-
return [c, [e,
|
|
58
|
-
|
|
67
|
+
return [c, [e, o]];
|
|
68
|
+
o = o + (l ? -1 : 1);
|
|
59
69
|
}
|
|
60
70
|
return [];
|
|
61
|
-
},
|
|
71
|
+
}, a = (e, t) => {
|
|
62
72
|
if (t) {
|
|
63
73
|
for (let r = 0; r < e.length; r++)
|
|
64
|
-
for (let
|
|
65
|
-
if (e[r][
|
|
66
|
-
return [r,
|
|
74
|
+
for (let n = 0; n < e[r].length; n++)
|
|
75
|
+
if (e[r][n] === t)
|
|
76
|
+
return [r, n];
|
|
67
77
|
}
|
|
68
|
-
},
|
|
78
|
+
}, T = (e) => e.current ? e.current.navigationMatrix.length : 0, R = (e) => e.flat().find((t) => t.endsWith("cell")), Y = (e) => e.flat().reverse().find((t) => t.endsWith("cell")), k = (e, t) => e[t][0], j = (e, t) => Array.from(e[t]).reverse()[0], q = (e) => e ? `${e}${b}` : "", P = (e, t, r) => {
|
|
79
|
+
let n;
|
|
80
|
+
if (e.current && e.current.prevNavigationIndexes) {
|
|
81
|
+
const [l, o] = e.current.prevNavigationIndexes;
|
|
82
|
+
t[l][o] === r ? n = e.current.prevNavigationIndexes : n = a(t, r);
|
|
83
|
+
} else
|
|
84
|
+
n = a(t, r);
|
|
85
|
+
return n;
|
|
86
|
+
}, H = {
|
|
69
87
|
generateNavigatableId: _,
|
|
70
|
-
getNavigatableId:
|
|
71
|
-
getNavigatableLevel:
|
|
72
|
-
getNavigatableElement:
|
|
73
|
-
getClosestNavigatableElement:
|
|
74
|
-
getActiveNavDataElement:
|
|
75
|
-
getClosestScope:
|
|
76
|
-
getHeaderElement:
|
|
77
|
-
getBodyElement:
|
|
78
|
-
getFocusableElements:
|
|
79
|
-
getNavigatableElements:
|
|
80
|
-
filterNavigatableElements:
|
|
81
|
-
focusElement:
|
|
82
|
-
getIdPrefix:
|
|
83
|
-
isNavigatable:
|
|
84
|
-
findNextIdByRowIndex:
|
|
85
|
-
findNextIdByCellIndex:
|
|
86
|
-
findId:
|
|
87
|
-
getNextNavigationIndex:
|
|
88
|
-
getFilterColumnId:
|
|
88
|
+
getNavigatableId: d,
|
|
89
|
+
getNavigatableLevel: D,
|
|
90
|
+
getNavigatableElement: x,
|
|
91
|
+
getClosestNavigatableElement: m,
|
|
92
|
+
getActiveNavDataElement: A,
|
|
93
|
+
getClosestScope: p,
|
|
94
|
+
getHeaderElement: $,
|
|
95
|
+
getBodyElement: y,
|
|
96
|
+
getFocusableElements: C,
|
|
97
|
+
getNavigatableElements: h,
|
|
98
|
+
filterNavigatableElements: F,
|
|
99
|
+
focusElement: E,
|
|
100
|
+
getIdPrefix: S,
|
|
101
|
+
isNavigatable: u,
|
|
102
|
+
findNextIdByRowIndex: L,
|
|
103
|
+
findNextIdByCellIndex: O,
|
|
104
|
+
findId: a,
|
|
105
|
+
getNextNavigationIndex: T,
|
|
106
|
+
getFilterColumnId: q,
|
|
107
|
+
focusFirstDataElement: B
|
|
89
108
|
};
|
|
90
109
|
export {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
F as filterNavigatableElements,
|
|
111
|
+
a as findId,
|
|
112
|
+
O as findNextIdByCellIndex,
|
|
113
|
+
L as findNextIdByRowIndex,
|
|
114
|
+
E as focusElement,
|
|
115
|
+
B as focusFirstDataElement,
|
|
96
116
|
_ as generateNavigatableId,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
117
|
+
A as getActiveNavDataElement,
|
|
118
|
+
y as getBodyElement,
|
|
119
|
+
m as getClosestNavigatableElement,
|
|
120
|
+
p as getClosestScope,
|
|
121
|
+
P as getCurrentIdIndexes,
|
|
122
|
+
q as getFilterColumnId,
|
|
123
|
+
R as getFirstDataCell,
|
|
124
|
+
k as getFirstRowDataCell,
|
|
125
|
+
C as getFocusableElements,
|
|
126
|
+
$ as getHeaderElement,
|
|
127
|
+
S as getIdPrefix,
|
|
128
|
+
Y as getLastDataCell,
|
|
129
|
+
j as getLastRowDataCell,
|
|
130
|
+
x as getNavigatableElement,
|
|
131
|
+
h as getNavigatableElements,
|
|
132
|
+
d as getNavigatableId,
|
|
133
|
+
D as getNavigatableLevel,
|
|
134
|
+
T as getNextNavigationIndex,
|
|
135
|
+
V as getNoRecordsElement,
|
|
136
|
+
u as isNavigatable,
|
|
137
|
+
H as tableKeyboardNavigationTools
|
|
112
138
|
};
|
package/package-metadata.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const e = {
|
|
|
10
10
|
name: "@progress/kendo-react-data-tools",
|
|
11
11
|
productName: "KendoReact",
|
|
12
12
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
-
publishDate:
|
|
13
|
+
publishDate: 1715583246,
|
|
14
14
|
version: "",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-data-tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-develop.1",
|
|
4
4
|
"description": "Includes React Pager & React Filter component, an intuitive interface to create complex filter descriptions. KendoReact Data Tools package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"@progress/kendo-data-query": "^1.0.0",
|
|
26
26
|
"@progress/kendo-drawing": "^1.20.1",
|
|
27
27
|
"@progress/kendo-licensing": "^1.3.4",
|
|
28
|
-
"@progress/kendo-react-animation": "
|
|
29
|
-
"@progress/kendo-react-buttons": "
|
|
30
|
-
"@progress/kendo-react-common": "
|
|
31
|
-
"@progress/kendo-react-dateinputs": "
|
|
32
|
-
"@progress/kendo-react-dropdowns": "
|
|
33
|
-
"@progress/kendo-react-inputs": "
|
|
34
|
-
"@progress/kendo-react-intl": "
|
|
35
|
-
"@progress/kendo-react-popup": "
|
|
36
|
-
"@progress/kendo-svg-icons": "^
|
|
28
|
+
"@progress/kendo-react-animation": "8.0.0-develop.1",
|
|
29
|
+
"@progress/kendo-react-buttons": "8.0.0-develop.1",
|
|
30
|
+
"@progress/kendo-react-common": "8.0.0-develop.1",
|
|
31
|
+
"@progress/kendo-react-dateinputs": "8.0.0-develop.1",
|
|
32
|
+
"@progress/kendo-react-dropdowns": "8.0.0-develop.1",
|
|
33
|
+
"@progress/kendo-react-inputs": "8.0.0-develop.1",
|
|
34
|
+
"@progress/kendo-react-intl": "8.0.0-develop.1",
|
|
35
|
+
"@progress/kendo-react-popup": "8.0.0-develop.1",
|
|
36
|
+
"@progress/kendo-svg-icons": "^3.0.0",
|
|
37
37
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
38
38
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
39
39
|
},
|
|
@@ -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 V=require("react"),W=require("react-dom"),j=require("@progress/kendo-react-common"),t=require("./utils.js");function F(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const a in l)if(a!=="default"){const g=Object.getOwnPropertyDescriptor(l,a);Object.defineProperty(s,a,g.get?g:{enumerable:!0,get:()=>l[a]})}}return s.default=l,Object.freeze(s)}const n=F(V),Z=F(W),$=l=>{var C;const{onRelease:s,childRef:a}=l,{enabled:g,drag:I,mode:i,cell:T}=t.getSelectionOptions(l.selectable),o=n.useRef(null),X=n.useRef(null),y=n.useRef({clientX:0,clientY:0,scrollX:0,scrollY:0,pressedElement:null}),[K,R]=n.useState(null),M=n.useRef(),b=n.useRef(!1),v=n.useRef(!1),_=n.useCallback(u=>{const{event:e}=u;if(v.current=t.isInNonSelectable(e.originalEvent.target),v.current||!o.current)return;M.current=t.relativeContextElement(o.current.element);const r=o.current.element&&o.current.element.ownerDocument;if(!r)return;const c=r.elementFromPoint(e.clientX,e.clientY);y.current={clientY:e.clientY,clientX:e.clientX,scrollX:e.scrollX,scrollY:e.scrollY,pressedElement:c}},[]),H=n.useCallback(u=>{const{event:e}=u,{clientX:r,clientY:c}=y.current;if(!v.current&&!(!I||i==="single")&&((Math.abs(c-e.clientY)>5||Math.abs(r-e.clientX)>5)&&(b.current=!0),b.current)){const E=t.getOffset(M.current);R({top:Math.min(c,e.clientY)-E.top,left:Math.min(r,e.clientX)-E.left,width:Math.abs(e.clientX-r),height:Math.abs(e.clientY-c)})}},[R,I,i]),z=n.useCallback(u=>{const{event:e}=u,{clientX:r,clientY:c,scrollX:E,scrollY:B,pressedElement:G}=y.current;if(v.current||!o.current)return;const h=o.current.element&&o.current.element.ownerDocument;if(h){if(b.current){const m=e.scrollY-B,D=e.scrollX-E,x=Math.min(c,e.clientY),d=Math.min(r,e.clientX),f=Math.max(c,e.clientY),J=Math.max(r,e.clientX),Y=X.current;if(!Y)return;Y.style.visibility="hidden";const L=h.elementFromPoint(d,x),S=m>0||D>0?G:L,w=h.elementFromPoint(J,f);if(Y.style.visibility="",!S||!w)return;const P=t.closestTagName(S,"TD"),Q=t.closestTagName(P,"TR"),p=t.closestTagName(w,"TD"),U=t.closestTagName(p,"TR"),O=t.getColumnIndex(P),N=t.getRowIndex(Q),k=t.getColumnIndex(p),q=t.getRowIndex(U);O!==void 0&&N!==void 0&&k!==void 0&&q!==void 0&&s({nativeEvent:e.originalEvent,startRowIndex:N,startColIndex:O,endRowIndex:q,endColIndex:k,altKey:e.altKey,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,mode:i,cell:T,isDrag:!0})}else{const m=h.elementFromPoint(r,c);if(!m)return;const D=t.closestTagName(m,"TD"),x=t.closestTagName(m,"TR"),d=t.getColumnIndex(D),f=t.getRowIndex(x);D&&x&&f!==void 0&&d!==void 0&&s({nativeEvent:e.originalEvent,startRowIndex:f,startColIndex:d,endRowIndex:f,endColIndex:d,altKey:e.altKey,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,mode:i,cell:T,isDrag:!1})}R(null),b.current=!1,y.current={clientX:0,clientY:0,scrollX:0,scrollY:0,pressedElement:null}}},[R,i,T,s]),A=j.useDocument(X);return g?n.createElement(n.Fragment,null,n.createElement(j.Draggable,{onPress:_,onDrag:H,onRelease:z,ref:o,childRef:a},l.children),K&&Z.createPortal(n.createElement("div",{ref:X,style:{...K,position:"fixed"},className:"k-marquee k-marquee-color"}),(C=A())==null?void 0:C.body)):n.cloneElement(n.Children.only(l.children),{ref:a})};exports.TableSelection=$;
|