@progress/kendo-react-data-tools 7.5.0-develop.16 → 7.5.0-develop.18
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 +9 -9
- package/selection/utils.js +1 -1
- package/selection/utils.mjs +85 -84
package/selection/utils.mjs
CHANGED
|
@@ -6,129 +6,130 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import { getter as _, mapTree as
|
|
10
|
-
import { TABLE_PREVENT_SELECTION_ELEMENT as
|
|
11
|
-
const
|
|
9
|
+
import { getter as _, mapTree as k, extendDataItem as B, Keys as i, hasRelativeStackingContext as O } from "@progress/kendo-react-common";
|
|
10
|
+
import { TABLE_PREVENT_SELECTION_ELEMENT as M, TABLE_ROW_INDEX_ATTRIBUTE as F, TABLE_COL_INDEX_ATTRIBUTE as G } from "./constants.mjs";
|
|
11
|
+
const U = "items", x = {}, X = (e, t) => !e || Array.isArray(e) && e.length === 0 ? [t] : e.findIndex((d) => d === t) > -1 ? e.filter((d) => d !== t) : [...e, t], J = (e) => {
|
|
12
12
|
let t = e;
|
|
13
13
|
for (; t; ) {
|
|
14
|
-
if (t.hasAttribute(
|
|
14
|
+
if (t.hasAttribute(M))
|
|
15
15
|
return !0;
|
|
16
16
|
t = t.parentElement;
|
|
17
17
|
}
|
|
18
18
|
return !1;
|
|
19
19
|
}, A = (e, t) => {
|
|
20
|
-
let
|
|
21
|
-
for (;
|
|
22
|
-
if (
|
|
23
|
-
return
|
|
24
|
-
if (
|
|
20
|
+
let o = e;
|
|
21
|
+
for (; o; ) {
|
|
22
|
+
if (o.tagName === t)
|
|
23
|
+
return o;
|
|
24
|
+
if (o.tagName === "TABLE")
|
|
25
25
|
return null;
|
|
26
|
-
|
|
26
|
+
o = o.parentElement;
|
|
27
27
|
}
|
|
28
28
|
return null;
|
|
29
|
-
},
|
|
29
|
+
}, b = (e) => {
|
|
30
30
|
if (!e)
|
|
31
31
|
return;
|
|
32
|
-
const t = e.getAttribute(
|
|
32
|
+
const t = e.getAttribute(F);
|
|
33
33
|
return t ? parseInt(t, 10) : void 0;
|
|
34
34
|
}, V = (e) => {
|
|
35
35
|
if (!e)
|
|
36
36
|
return;
|
|
37
|
-
const t = e.getAttribute(
|
|
37
|
+
const t = e.getAttribute(G);
|
|
38
38
|
return t ? parseInt(t, 10) : void 0;
|
|
39
39
|
}, Q = (e) => {
|
|
40
|
-
const t = e.subItemsField ||
|
|
41
|
-
return
|
|
40
|
+
const t = e.subItemsField || U, o = _(e.dataItemKey);
|
|
41
|
+
return k(
|
|
42
42
|
e.data,
|
|
43
43
|
t,
|
|
44
|
-
(
|
|
45
|
-
[e.selectedField]: e.selectedState[
|
|
44
|
+
(d) => B(d, t, {
|
|
45
|
+
[e.selectedField]: e.selectedState[o(d)]
|
|
46
46
|
})
|
|
47
47
|
);
|
|
48
48
|
}, Y = (e) => {
|
|
49
|
-
const { event: t, dataItemKey:
|
|
50
|
-
if (
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
const { event: t, dataItemKey: o, selectedState: d } = e, { syntheticEvent: a, nativeEvent: n, dataItems: E, componentId: c, mode: T, cell: g, selectedField: p } = t, { target: C, ctrlKey: w, metaKey: S, altKey: I, shiftKey: h } = n;
|
|
50
|
+
if (a.isDefaultPrevented() && !h || n.keyCode !== i.space && n.keyCode !== i.enter && n.keyCode !== i.right && n.keyCode !== i.left && n.keyCode !== i.up && n.keyCode !== i.down)
|
|
51
|
+
return d;
|
|
52
|
+
a.preventDefault();
|
|
53
|
+
const D = A(C, "TD"), m = A(C, "TR");
|
|
54
|
+
let r = V(D), u = b(m), s = {};
|
|
55
|
+
return D && m && u !== void 0 && r !== void 0 && (n.keyCode === i.right && r++, n.keyCode === i.left && r--, n.keyCode === i.down && u++, n.keyCode === i.up && u--, s = H({
|
|
56
|
+
selectedState: d,
|
|
57
|
+
dataItemKey: o,
|
|
57
58
|
event: {
|
|
58
|
-
ctrlKey:
|
|
59
|
-
metaKey:
|
|
59
|
+
ctrlKey: w,
|
|
60
|
+
metaKey: S,
|
|
60
61
|
altKey: I,
|
|
61
|
-
shiftKey:
|
|
62
|
+
shiftKey: h,
|
|
62
63
|
dataItems: E,
|
|
63
|
-
cell:
|
|
64
|
+
cell: g,
|
|
64
65
|
mode: T,
|
|
65
|
-
selectedField:
|
|
66
|
-
componentId:
|
|
67
|
-
startColIndex:
|
|
68
|
-
endColIndex:
|
|
69
|
-
startRowIndex:
|
|
70
|
-
endRowIndex:
|
|
66
|
+
selectedField: p,
|
|
67
|
+
componentId: c,
|
|
68
|
+
startColIndex: r,
|
|
69
|
+
endColIndex: r,
|
|
70
|
+
startRowIndex: u,
|
|
71
|
+
endRowIndex: u,
|
|
71
72
|
isDrag: !1,
|
|
72
|
-
syntheticEvent:
|
|
73
|
-
nativeEvent:
|
|
73
|
+
syntheticEvent: a,
|
|
74
|
+
nativeEvent: n,
|
|
74
75
|
target: t.target,
|
|
75
76
|
dataItem: null
|
|
76
77
|
}
|
|
77
|
-
})),
|
|
78
|
+
})), s;
|
|
78
79
|
}, H = (e) => {
|
|
79
|
-
const { event: t, dataItemKey:
|
|
80
|
-
dataItems:
|
|
81
|
-
startRowIndex:
|
|
80
|
+
const { event: t, dataItemKey: o, selectedState: d } = e, {
|
|
81
|
+
dataItems: a,
|
|
82
|
+
startRowIndex: n,
|
|
82
83
|
endRowIndex: E,
|
|
83
|
-
startColIndex:
|
|
84
|
+
startColIndex: c,
|
|
84
85
|
endColIndex: T,
|
|
85
|
-
cell:
|
|
86
|
-
isDrag:
|
|
87
|
-
ctrlKey:
|
|
88
|
-
shiftKey:
|
|
89
|
-
metaKey:
|
|
86
|
+
cell: g,
|
|
87
|
+
isDrag: p,
|
|
88
|
+
ctrlKey: C,
|
|
89
|
+
shiftKey: w,
|
|
90
|
+
metaKey: S,
|
|
90
91
|
componentId: I,
|
|
91
|
-
mode:
|
|
92
|
-
dataItem:
|
|
93
|
-
} = t,
|
|
94
|
-
let
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
const
|
|
92
|
+
mode: h,
|
|
93
|
+
dataItem: D
|
|
94
|
+
} = t, m = _(o);
|
|
95
|
+
let r = {};
|
|
96
|
+
const u = D !== null;
|
|
97
|
+
if (h === "single") {
|
|
98
|
+
const s = a.slice(n, n + 1)[0], f = m(s);
|
|
98
99
|
x[I] = {
|
|
99
|
-
rowIndex:
|
|
100
|
-
colIndex:
|
|
101
|
-
},
|
|
102
|
-
} else if (
|
|
103
|
-
|
|
104
|
-
rowIndex:
|
|
105
|
-
colIndex:
|
|
100
|
+
rowIndex: n,
|
|
101
|
+
colIndex: c
|
|
102
|
+
}, r[f] = g ? [c] : !0;
|
|
103
|
+
} else if (p || !w && !C && !S && !u) {
|
|
104
|
+
p || (x[I] = {
|
|
105
|
+
rowIndex: n,
|
|
106
|
+
colIndex: c
|
|
106
107
|
});
|
|
107
|
-
const
|
|
108
|
-
for (let l =
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
108
|
+
const s = [];
|
|
109
|
+
for (let l = c; l <= T; l++)
|
|
110
|
+
s.push(l);
|
|
111
|
+
a.slice(n, E + 1).forEach((l) => {
|
|
112
|
+
const R = m(l);
|
|
113
|
+
r[R] = g ? [...s] : !0;
|
|
113
114
|
});
|
|
114
|
-
} else if (
|
|
115
|
+
} else if (C || S || u) {
|
|
115
116
|
x[I] = {
|
|
116
|
-
rowIndex:
|
|
117
|
-
colIndex:
|
|
117
|
+
rowIndex: n,
|
|
118
|
+
colIndex: c
|
|
118
119
|
};
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
} else if (
|
|
122
|
-
const
|
|
123
|
-
for (let
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
120
|
+
const f = a.slice(n, E + 1)[0], l = m(f);
|
|
121
|
+
r = { ...d }, r[l] = g && !u ? X(r[l], c) : !r[l];
|
|
122
|
+
} else if (w) {
|
|
123
|
+
const s = x[I] && x[I].rowIndex || 0, f = x[I] && x[I].colIndex || 0, l = Math.min(s, n, E), R = Math.max(s, n, E), K = Math.min(f, c, T), L = Math.max(f, c, T), v = [];
|
|
124
|
+
for (let y = K; y <= L; y++)
|
|
125
|
+
v.push(y);
|
|
126
|
+
a.slice(l, R + 1).forEach((y) => {
|
|
127
|
+
const N = m(y);
|
|
128
|
+
r[N] = g ? [...v] : !0;
|
|
128
129
|
});
|
|
129
130
|
}
|
|
130
|
-
return
|
|
131
|
-
}, W =
|
|
131
|
+
return r;
|
|
132
|
+
}, W = O(), Z = (e) => {
|
|
132
133
|
if (!e || !W)
|
|
133
134
|
return null;
|
|
134
135
|
let t = e.parentElement;
|
|
@@ -147,14 +148,14 @@ const X = "items", x = {}, b = (e, t) => !e || Array.isArray(e) && e.length ===
|
|
|
147
148
|
}
|
|
148
149
|
return { left: 0, top: 0 };
|
|
149
150
|
}, P = (e) => {
|
|
150
|
-
const t = e ? typeof e.enabled == "boolean" ? e.enabled : !0 : !1,
|
|
151
|
-
return { enabled: t, drag:
|
|
151
|
+
const t = e ? typeof e.enabled == "boolean" ? e.enabled : !0 : !1, o = e ? !!e.drag : !1, d = e && e.mode ? e.mode : "multiple", a = !!(e && e.cell);
|
|
152
|
+
return { enabled: t, drag: o, mode: d, cell: a };
|
|
152
153
|
};
|
|
153
154
|
export {
|
|
154
155
|
A as closestTagName,
|
|
155
156
|
V as getColumnIndex,
|
|
156
157
|
$ as getOffset,
|
|
157
|
-
|
|
158
|
+
b as getRowIndex,
|
|
158
159
|
H as getSelectedState,
|
|
159
160
|
Y as getSelectedStateFromKeyDown,
|
|
160
161
|
P as getSelectionOptions,
|