@progress/kendo-react-data-tools 11.2.0-develop.2 → 11.2.0-develop.3
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 +1 -1
- package/index.d.ts +1 -1
- package/navigation/TableKeyboardNavigation.js +1 -1
- package/navigation/TableKeyboardNavigation.mjs +37 -37
- package/navigation/utils.js +1 -1
- package/navigation/utils.mjs +74 -71
- 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 +63 -61
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react"),Z=require("react-dom"),F=require("@progress/kendo-react-common"),t=require("./utils.js");function _(l){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const s in l)if(s!=="default"){const y=Object.getOwnPropertyDescriptor(l,s);Object.defineProperty(c,s,y.get?y:{enumerable:!0,get:()=>l[s]})}}return c.default=l,Object.freeze(c)}const n=_(W),$=_(Z),ee=l=>{var M;const{onRelease:c,childRef:s}=l,{enabled:y,drag:Y,mode:u,cell:I}=t.getSelectionOptions(l.selectable),i=n.useRef(null),T=n.useRef(null),v=n.useRef({clientX:0,clientY:0,scrollX:0,scrollY:0,pressedElement:null}),[p,R]=n.useState(null),K=n.useRef(void 0),E=n.useRef(!1),b=n.useRef(!1),H=n.useCallback(m=>{var a;const{event:e}=m;if(b.current=t.isInNonSelectable(e.originalEvent.target),b.current||!i.current)return;K.current=t.relativeContextElement(i.current.element);const r=(a=i.current.element)==null?void 0:a.ownerDocument;if(!r)return;e.originalEvent.stopImmediatePropagation();const o=r.elementFromPoint(e.clientX,e.clientY);v.current={clientY:e.clientY,clientX:e.clientX,scrollX:e.scrollX,scrollY:e.scrollY,pressedElement:o}},[]),z=n.useCallback(m=>{const{event:e}=m,{clientX:r,clientY:o}=v.current;if(!b.current&&!(!Y||u==="single")&&((Math.abs(o-e.clientY)>5||Math.abs(r-e.clientX)>5)&&(E.current=!0),e.originalEvent.stopImmediatePropagation(),E.current)){const a=t.getOffset(K.current);R({top:Math.min(o,e.clientY)-a.top,left:Math.min(r,e.clientX)-a.left,width:Math.abs(e.clientX-r),height:Math.abs(e.clientY-o)})}},[R,Y,u]),A=n.useCallback(m=>{var P;const{event:e}=m,{clientX:r,clientY:o,scrollX:a,scrollY:G,pressedElement:J}=v.current;if(b.current||!i.current)return;const h=(P=i.current.element)==null?void 0:P.ownerDocument;if(h){if(e.originalEvent.stopImmediatePropagation(),E.current){const d=e.scrollY-G,D=e.scrollX-a,x=Math.min(o,e.clientY),f=Math.min(r,e.clientX),g=Math.max(o,e.clientY),L=Math.max(r,e.clientX),X=T.current;if(!X)return;X.style.visibility="hidden";const Q=h.elementFromPoint(f,x),C=d>0||D>0?J:Q,S=h.elementFromPoint(L,g);if(X.style.visibility="",!C||!S)return;const w=t.closestTagName(C,"TD"),U=t.closestTagName(w,"TR"),O=t.closestTagName(S,"TD"),V=t.closestTagName(O,"TR"),N=t.getColumnIndex(w),k=t.getRowIndex(U),q=t.getColumnIndex(O),j=t.getRowIndex(V);N!==void 0&&k!==void 0&&q!==void 0&&j!==void 0&&c({nativeEvent:e.originalEvent,startRowIndex:k,startColIndex:N,endRowIndex:j,endColIndex:q,altKey:e.altKey,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,mode:u,cell:I,isDrag:!0})}else{const d=h.elementFromPoint(r,o);if(!d)return;const D=t.closestTagName(d,"TD"),x=t.closestTagName(d,"TR"),f=t.getColumnIndex(D),g=t.getRowIndex(x);D&&x&&g!==void 0&&f!==void 0&&c({nativeEvent:e.originalEvent,startRowIndex:g,startColIndex:f,endRowIndex:g,endColIndex:f,altKey:e.altKey,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,mode:u,cell:I,isDrag:!1})}R(null),E.current=!1,v.current={clientX:0,clientY:0,scrollX:0,scrollY:0,pressedElement:null}}},[R,u,I,c]),B=F.useDocument(T);return y?n.createElement(n.Fragment,null,n.createElement(F.Draggable,{onPress:H,onDrag:z,onRelease:A,ref:i,childRef:s},l.children),p&&$.createPortal(n.createElement("div",{ref:T,style:{...p,position:"fixed"},className:"k-marquee k-marquee-color"}),(M=B())==null?void 0:M.body)):n.cloneElement(n.Children.only(l.children),{ref:s})};exports.TableSelection=ee;
|
|
@@ -7,113 +7,115 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as t from "react";
|
|
10
|
-
import * as
|
|
11
|
-
import { useDocument as
|
|
12
|
-
import { getSelectionOptions as
|
|
13
|
-
const
|
|
10
|
+
import * as Z from "react-dom";
|
|
11
|
+
import { useDocument as _, Draggable as $ } from "@progress/kendo-react-common";
|
|
12
|
+
import { getSelectionOptions as ee, isInNonSelectable as te, relativeContextElement as ne, getOffset as le, closestTagName as c, getColumnIndex as x, getRowIndex as I } from "./utils.mjs";
|
|
13
|
+
const ce = (d) => {
|
|
14
14
|
var T;
|
|
15
|
-
const { onRelease: D, childRef: K } =
|
|
16
|
-
enabled:
|
|
15
|
+
const { onRelease: D, childRef: K } = d, {
|
|
16
|
+
enabled: j,
|
|
17
17
|
drag: p,
|
|
18
|
-
mode:
|
|
18
|
+
mode: s,
|
|
19
19
|
cell: X
|
|
20
|
-
} =
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
} = ee(d.selectable), o = t.useRef(null), Y = t.useRef(null), f = t.useRef({ clientX: 0, clientY: 0, scrollX: 0, scrollY: 0, pressedElement: null }), [M, g] = t.useState(null), P = t.useRef(void 0), E = t.useRef(!1), v = t.useRef(!1), z = t.useCallback((i) => {
|
|
21
|
+
var r;
|
|
22
|
+
const { event: e } = i;
|
|
23
|
+
if (v.current = te(e.originalEvent.target), v.current || !o.current)
|
|
23
24
|
return;
|
|
24
|
-
P.current =
|
|
25
|
-
const n = r.current.element
|
|
25
|
+
P.current = ne(o.current.element);
|
|
26
|
+
const n = (r = o.current.element) == null ? void 0 : r.ownerDocument;
|
|
26
27
|
if (!n)
|
|
27
28
|
return;
|
|
28
29
|
e.originalEvent.stopImmediatePropagation();
|
|
29
30
|
const l = n.elementFromPoint(e.clientX, e.clientY);
|
|
30
|
-
|
|
31
|
+
f.current = {
|
|
31
32
|
clientY: e.clientY,
|
|
32
33
|
clientX: e.clientX,
|
|
33
34
|
scrollX: e.scrollX,
|
|
34
35
|
scrollY: e.scrollY,
|
|
35
36
|
pressedElement: l
|
|
36
37
|
};
|
|
37
|
-
}, []),
|
|
38
|
-
(
|
|
39
|
-
const { event: e } =
|
|
40
|
-
if (!
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
top: Math.min(l, e.clientY) -
|
|
44
|
-
left: Math.min(n, e.clientX) -
|
|
38
|
+
}, []), A = t.useCallback(
|
|
39
|
+
(i) => {
|
|
40
|
+
const { event: e } = i, { clientX: n, clientY: l } = f.current;
|
|
41
|
+
if (!v.current && !(!p || s === "single") && ((Math.abs(l - e.clientY) > 5 || Math.abs(n - e.clientX) > 5) && (E.current = !0), e.originalEvent.stopImmediatePropagation(), E.current)) {
|
|
42
|
+
const r = le(P.current);
|
|
43
|
+
g({
|
|
44
|
+
top: Math.min(l, e.clientY) - r.top,
|
|
45
|
+
left: Math.min(n, e.clientX) - r.left,
|
|
45
46
|
width: Math.abs(e.clientX - n),
|
|
46
47
|
height: Math.abs(e.clientY - l)
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
|
-
[
|
|
51
|
-
),
|
|
52
|
-
(
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
[g, p, s]
|
|
52
|
+
), B = t.useCallback(
|
|
53
|
+
(i) => {
|
|
54
|
+
var C;
|
|
55
|
+
const { event: e } = i, { clientX: n, clientY: l, scrollX: r, scrollY: J, pressedElement: L } = f.current;
|
|
56
|
+
if (v.current || !o.current)
|
|
55
57
|
return;
|
|
56
|
-
const y =
|
|
58
|
+
const y = (C = o.current.element) == null ? void 0 : C.ownerDocument;
|
|
57
59
|
if (y) {
|
|
58
|
-
if (e.originalEvent.stopImmediatePropagation(),
|
|
59
|
-
const
|
|
60
|
+
if (e.originalEvent.stopImmediatePropagation(), E.current) {
|
|
61
|
+
const a = e.scrollY - J, R = e.scrollX - r, h = Math.min(l, e.clientY), m = Math.min(n, e.clientX), u = Math.max(l, e.clientY), Q = Math.max(n, e.clientX), b = Y.current;
|
|
60
62
|
if (!b)
|
|
61
63
|
return;
|
|
62
64
|
b.style.visibility = "hidden";
|
|
63
|
-
const
|
|
64
|
-
if (b.style.visibility = "", !
|
|
65
|
+
const U = y.elementFromPoint(m, h), w = a > 0 || R > 0 ? L : U, S = y.elementFromPoint(Q, u);
|
|
66
|
+
if (b.style.visibility = "", !w || !S)
|
|
65
67
|
return;
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
+
const k = c(w, "TD"), V = c(k, "TR"), F = c(S, "TD"), W = c(F, "TR"), O = x(k), H = I(V), N = x(F), q = I(W);
|
|
69
|
+
O !== void 0 && H !== void 0 && N !== void 0 && q !== void 0 && D({
|
|
68
70
|
nativeEvent: e.originalEvent,
|
|
69
|
-
startRowIndex:
|
|
70
|
-
startColIndex:
|
|
71
|
-
endRowIndex:
|
|
72
|
-
endColIndex:
|
|
71
|
+
startRowIndex: H,
|
|
72
|
+
startColIndex: O,
|
|
73
|
+
endRowIndex: q,
|
|
74
|
+
endColIndex: N,
|
|
73
75
|
altKey: e.altKey,
|
|
74
76
|
shiftKey: e.shiftKey,
|
|
75
77
|
ctrlKey: e.ctrlKey,
|
|
76
78
|
metaKey: e.metaKey,
|
|
77
|
-
mode:
|
|
79
|
+
mode: s,
|
|
78
80
|
cell: X,
|
|
79
81
|
isDrag: !0
|
|
80
82
|
});
|
|
81
83
|
} else {
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
+
const a = y.elementFromPoint(n, l);
|
|
85
|
+
if (!a)
|
|
84
86
|
return;
|
|
85
|
-
const R =
|
|
86
|
-
R && h &&
|
|
87
|
+
const R = c(a, "TD"), h = c(a, "TR"), m = x(R), u = I(h);
|
|
88
|
+
R && h && u !== void 0 && m !== void 0 && D({
|
|
87
89
|
nativeEvent: e.originalEvent,
|
|
88
|
-
startRowIndex:
|
|
89
|
-
startColIndex:
|
|
90
|
-
endRowIndex:
|
|
91
|
-
endColIndex:
|
|
90
|
+
startRowIndex: u,
|
|
91
|
+
startColIndex: m,
|
|
92
|
+
endRowIndex: u,
|
|
93
|
+
endColIndex: m,
|
|
92
94
|
altKey: e.altKey,
|
|
93
95
|
shiftKey: e.shiftKey,
|
|
94
96
|
ctrlKey: e.ctrlKey,
|
|
95
97
|
metaKey: e.metaKey,
|
|
96
|
-
mode:
|
|
98
|
+
mode: s,
|
|
97
99
|
cell: X,
|
|
98
100
|
isDrag: !1
|
|
99
101
|
});
|
|
100
102
|
}
|
|
101
|
-
|
|
103
|
+
g(null), E.current = !1, f.current = { clientX: 0, clientY: 0, scrollX: 0, scrollY: 0, pressedElement: null };
|
|
102
104
|
}
|
|
103
105
|
},
|
|
104
|
-
[
|
|
105
|
-
),
|
|
106
|
-
return
|
|
107
|
-
|
|
106
|
+
[g, s, X, D]
|
|
107
|
+
), G = _(Y);
|
|
108
|
+
return j ? /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
109
|
+
$,
|
|
108
110
|
{
|
|
109
|
-
onPress:
|
|
110
|
-
onDrag:
|
|
111
|
-
onRelease:
|
|
112
|
-
ref:
|
|
111
|
+
onPress: z,
|
|
112
|
+
onDrag: A,
|
|
113
|
+
onRelease: B,
|
|
114
|
+
ref: o,
|
|
113
115
|
childRef: K
|
|
114
116
|
},
|
|
115
|
-
|
|
116
|
-
), M &&
|
|
117
|
+
d.children
|
|
118
|
+
), M && Z.createPortal(
|
|
117
119
|
/* @__PURE__ */ t.createElement(
|
|
118
120
|
"div",
|
|
119
121
|
{
|
|
@@ -122,9 +124,9 @@ const oe = (u) => {
|
|
|
122
124
|
className: "k-marquee k-marquee-color"
|
|
123
125
|
}
|
|
124
126
|
),
|
|
125
|
-
(T =
|
|
126
|
-
)) : t.cloneElement(t.Children.only(
|
|
127
|
+
(T = G()) == null ? void 0 : T.body
|
|
128
|
+
)) : t.cloneElement(t.Children.only(d.children), { ref: K });
|
|
127
129
|
};
|
|
128
130
|
export {
|
|
129
|
-
|
|
131
|
+
ce as TableSelection
|
|
130
132
|
};
|