@progress/kendo-react-grid 11.0.0-develop.7 → 11.0.0-develop.9
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/GridClientContextReader.js +1 -1
- package/GridClientContextReader.mjs +16 -13
- package/GridClientWrapper.js +1 -1
- package/GridClientWrapper.mjs +419 -421
- package/GridComponent.js +1 -1
- package/GridComponent.mjs +395 -402
- package/VirtualScroll.js +1 -1
- package/VirtualScroll.mjs +65 -107
- package/components/GridDraggableRowsContainer.js +1 -1
- package/components/GridDraggableRowsContainer.mjs +71 -67
- package/components/VirtualScrollHeightContainer.js +1 -1
- package/components/VirtualScrollHeightContainer.mjs +4 -4
- package/components/table/GridTableScrollable.js +1 -1
- package/components/table/GridTableScrollable.mjs +16 -15
- package/components/utils.js +1 -1
- package/components/utils.mjs +9 -10
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +16 -16
- package/utils/index.js +1 -1
- package/utils/index.mjs +93 -85
- package/VirtualScrollFixed.js +0 -8
- package/VirtualScrollFixed.mjs +0 -52
package/VirtualScroll.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 f=require("react"),h=require("./utils/index.js");function g(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const d=g(f);class u{constructor(){this.table=null,this.tableBody=null,this.container=null,this.scrollHeightContainer=null,this.total=0,this.scrollableVirtual=!1,this.pageSize=0,this.PageChange=null,this.fixedScroll=!1,this.tableTransform="",this.reactVersion=Number.parseFloat(d.version),this.scrollSyncing=!1,this.firstToLoad=0,this.lastScrollTop=0,this.firstLoaded=0,this.lastLoaded=0,this.scrollHandler=this.scrollHandler.bind(this)}reset(){this.firstToLoad=0,this.firstLoaded=0,this.lastLoaded=0,this.rowHeightService=void 0,!this.fixedScroll&&this.container&&this.container.scrollTop!==0&&(this.scrollSyncing=!0,this.container.scrollTop=0,this.lastScrollTop=0,this.translate(0,!0))}scrollHandler(t){if(this.scrollSyncing){this.scrollSyncing=!1;return}if(!this.scrollableVirtual||!this.container||!this.table||!this.rowHeightService||!this.container)return;const e=this.container.scrollTop,i=this.lastScrollTop>=e,r=!i;this.lastScrollTop=e;const a=this.container.offsetHeight;let s=this.rowHeightService.index(e);const n=this.rowHeightService.index(e+a),l=Math.max(s+this.pageSize-this.total,0);if(s=Math.max(s-l,0),r&&n>=this.lastLoaded&&this.lastLoaded<this.total-1)this.firstToLoad=s,this.loadPage(t);else if(i&&s<this.firstToLoad){const c=Math.max(Math.floor(this.pageSize*.3)-l,0);this.firstToLoad=Math.max(s-c,0),this.loadPage(t)}}update(){var e;const t=this.getItemHeights();if(this.firstLoaded>this.firstToLoad){const i=Math.min(this.firstLoaded-this.firstToLoad,this.pageSize),r=this.getTotalHeight(i,t),a=this.getExpectedTotalHeight(i),s=r-a;s!==0&&this.adjustScroll(s)}(e=this.rowHeightService)==null||e.update(this.firstToLoad,t),this.setScrollHeightContainerHeight(),this.firstLoaded=this.firstToLoad,this.lastLoaded=this.firstLoaded+t.length-1}loadPage(t){this.rowHeightService&&(this.translate(this.rowHeightService.offset(this.firstToLoad)),this.changePage(this.firstToLoad,t))}translate(t,e){this.scrollableVirtual&&this.table&&(this.reactVersion<=17||e?this.table.style.transform="translateY("+t+"px)":this.tableTransform="translateY("+t+"px)")}changePage(t,e){this.PageChange&&this.PageChange({skip:Math.max(0,t),take:this.pageSize},e)}adjustScroll(t){this.scrollSyncing=!0,this.container&&(this.container.scrollTop+=t)}setScrollHeightContainerHeight(){var t;if(this.scrollableVirtual&&this.scrollHeightContainer){let e=((t=this.rowHeightService)==null?void 0:t.totalHeight())||0;e=h.firefox?Math.min(h.firefoxMaxHeight,e):e,this.scrollHeightContainer.style.height=e+"px"}}getItemHeights(){const t=[];return this.tableBody&&Array.from(this.tableBody.children).forEach(e=>{const i=e.getBoundingClientRect().height;e.classList.contains("k-detail-row")?t[t.length-1]+=i:t.push(i)}),t}getTotalHeight(t,e){return e.slice(0,t).reduce((i,r)=>i+r,0)}getExpectedTotalHeight(t){const e=this.rowHeightService;if(!e)return 0;const i=this.firstToLoad+(t-1);return e.offset(i)+e.height(i)-e.offset(this.firstToLoad)}}exports.VirtualScroll=u;
|
package/VirtualScroll.mjs
CHANGED
|
@@ -5,128 +5,86 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return { topItemsCount: 0, topItemsHeight: 0 };
|
|
14
|
-
const s = this.container.clientHeight, e = Math.ceil(s / t[0].line), o = Math.ceil((t.length - e) / 2);
|
|
15
|
-
let n = 0;
|
|
16
|
-
for (let a = 0; a < o; a++)
|
|
17
|
-
n += t[a].line + t[a].acc;
|
|
18
|
-
return {
|
|
19
|
-
topItemsCount: o,
|
|
20
|
-
topItemsHeight: n,
|
|
21
|
-
itemsNeededOnScreen: e + e / 2
|
|
22
|
-
};
|
|
23
|
-
}, this.horizontalScrollbarHeight = () => this.container ? this.container.offsetHeight - this.container.clientHeight : 0, i && (this.topCacheCount = 4, this.attendedSkip = -this.topCacheCount), this.scrollHandler = this.scrollHandler.bind(this);
|
|
8
|
+
import * as n from "react";
|
|
9
|
+
import { firefox as c, firefoxMaxHeight as f } from "./utils/index.mjs";
|
|
10
|
+
class u {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.table = null, this.tableBody = null, this.container = null, this.scrollHeightContainer = null, this.total = 0, this.scrollableVirtual = !1, this.pageSize = 0, this.PageChange = null, this.fixedScroll = !1, this.tableTransform = "", this.reactVersion = Number.parseFloat(n.version), this.scrollSyncing = !1, this.firstToLoad = 0, this.lastScrollTop = 0, this.firstLoaded = 0, this.lastLoaded = 0, this.scrollHandler = this.scrollHandler.bind(this);
|
|
24
13
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return (i = this.containerRef) == null ? void 0 : i.current;
|
|
14
|
+
reset() {
|
|
15
|
+
this.firstToLoad = 0, this.firstLoaded = 0, this.lastLoaded = 0, this.rowHeightService = void 0, !this.fixedScroll && this.container && this.container.scrollTop !== 0 && (this.scrollSyncing = !0, this.container.scrollTop = 0, this.lastScrollTop = 0, this.translate(0, !0));
|
|
28
16
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
17
|
+
scrollHandler(t) {
|
|
18
|
+
if (this.scrollSyncing) {
|
|
19
|
+
this.scrollSyncing = !1;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!this.scrollableVirtual || !this.container || !this.table || !this.rowHeightService || !this.container)
|
|
23
|
+
return;
|
|
24
|
+
const i = this.container.scrollTop, e = this.lastScrollTop >= i, o = !e;
|
|
25
|
+
this.lastScrollTop = i;
|
|
26
|
+
const r = this.container.offsetHeight;
|
|
27
|
+
let s = this.rowHeightService.index(i);
|
|
28
|
+
const a = this.rowHeightService.index(i + r), h = Math.max(s + this.pageSize - this.total, 0);
|
|
29
|
+
if (s = Math.max(s - h, 0), o && a >= this.lastLoaded && this.lastLoaded < this.total - 1)
|
|
30
|
+
this.firstToLoad = s, this.loadPage(t);
|
|
31
|
+
else if (e && s < this.firstToLoad) {
|
|
32
|
+
const l = Math.max(Math.floor(this.pageSize * 0.3) - h, 0);
|
|
33
|
+
this.firstToLoad = Math.max(s - l, 0), this.loadPage(t);
|
|
45
34
|
}
|
|
46
|
-
return i;
|
|
47
35
|
}
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
update() {
|
|
37
|
+
var i;
|
|
38
|
+
const t = this.getItemHeights();
|
|
39
|
+
if (this.firstLoaded > this.firstToLoad) {
|
|
40
|
+
const e = Math.min(this.firstLoaded - this.firstToLoad, this.pageSize), o = this.getTotalHeight(e, t), r = this.getExpectedTotalHeight(e), s = o - r;
|
|
41
|
+
s !== 0 && this.adjustScroll(s);
|
|
42
|
+
}
|
|
43
|
+
(i = this.rowHeightService) == null || i.update(this.firstToLoad, t), this.setScrollHeightContainerHeight(), this.firstLoaded = this.firstToLoad, this.lastLoaded = this.firstLoaded + t.length - 1;
|
|
44
|
+
}
|
|
45
|
+
loadPage(t) {
|
|
46
|
+
this.rowHeightService && (this.translate(this.rowHeightService.offset(this.firstToLoad)), this.changePage(this.firstToLoad, t));
|
|
47
|
+
}
|
|
48
|
+
translate(t, i) {
|
|
49
|
+
this.scrollableVirtual && this.table && (this.reactVersion <= 17 || i ? this.table.style.transform = "translateY(" + t + "px)" : this.tableTransform = "translateY(" + t + "px)");
|
|
50
|
+
}
|
|
51
|
+
changePage(t, i) {
|
|
52
|
+
this.PageChange && this.PageChange(
|
|
50
53
|
{
|
|
51
|
-
skip: Math.max(0,
|
|
54
|
+
skip: Math.max(0, t),
|
|
52
55
|
take: this.pageSize
|
|
53
56
|
},
|
|
54
|
-
|
|
57
|
+
i
|
|
55
58
|
);
|
|
56
59
|
}
|
|
57
|
-
|
|
58
|
-
this.
|
|
60
|
+
adjustScroll(t) {
|
|
61
|
+
this.scrollSyncing = !0, this.container && (this.container.scrollTop += t);
|
|
59
62
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return;
|
|
66
|
-
const t = this.rowHeights, l = this.container.scrollTop;
|
|
67
|
-
let s = this.tableTranslate, e = 0;
|
|
68
|
-
const { topItemsCount: o, topItemsHeight: n, itemsNeededOnScreen: a } = this.topItems(
|
|
69
|
-
t,
|
|
70
|
-
!!this.topCacheCount
|
|
71
|
-
), h = l - s;
|
|
72
|
-
if (!(h > n || t.length <= a)) {
|
|
73
|
-
for (; e < this.topCacheCount + this.attendedSkip - this.realSkip + o && this.propsSkip - e > 0 && !(s + (t[t.length - 1 - e].line + t[t.length - 1 - e].acc) + h <= l); )
|
|
74
|
-
s -= t[t.length - 1 - e].line + t[t.length - 1 - e].acc, e++;
|
|
75
|
-
if (e === 0 && this.topCacheCount === 0 && this.attendedSkip > 0 && (s = Math.max(s - t[0].line, 0), e = 1), this.propsSkip - e <= 0 && s > l) {
|
|
76
|
-
this.translate(0), this.changePage(0, i), this.container.scrollTop = 0;
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (s > l && (s = l), s !== this.tableTranslate) {
|
|
80
|
-
this.translate(Math.max(0, s - n));
|
|
81
|
-
const r = Math.max(0, this.propsSkip - e - o);
|
|
82
|
-
this.changePage(r, i);
|
|
83
|
-
}
|
|
63
|
+
setScrollHeightContainerHeight() {
|
|
64
|
+
var t;
|
|
65
|
+
if (this.scrollableVirtual && this.scrollHeightContainer) {
|
|
66
|
+
let i = ((t = this.rowHeightService) == null ? void 0 : t.totalHeight()) || 0;
|
|
67
|
+
i = c ? Math.min(f, i) : i, this.scrollHeightContainer.style.height = i + "px";
|
|
84
68
|
}
|
|
85
69
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
t,
|
|
93
|
-
!!this.topCacheCount
|
|
94
|
-
);
|
|
95
|
-
for (; e < t.length - this.topCacheCount && !(s + t[e].line + t[e].acc > l); )
|
|
96
|
-
s += t[e].line + t[e].acc, e++;
|
|
97
|
-
o > this.propsSkip + e || t.length <= a || (e >= t.length - this.topCacheCount && this.propsSkip + e >= this.total ? (this.translate(s - n), this.changePage(this.total - 1 - o, i)) : s !== this.tableTranslate && this.propsSkip + e - o !== this.propsSkip && (this.translate(s - n), this.changePage(this.propsSkip + e - o, i)));
|
|
70
|
+
getItemHeights() {
|
|
71
|
+
const t = [];
|
|
72
|
+
return this.tableBody && Array.from(this.tableBody.children).forEach((i) => {
|
|
73
|
+
const e = i.getBoundingClientRect().height;
|
|
74
|
+
i.classList.contains("k-detail-row") ? t[t.length - 1] += e : t.push(e);
|
|
75
|
+
}), t;
|
|
98
76
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
let l = Math.floor(t);
|
|
102
|
-
l >= this.total && (l = this.total - 1);
|
|
103
|
-
const s = Math.min(t - l, 1);
|
|
104
|
-
let e = 0;
|
|
105
|
-
const o = l - this.propsSkip, n = this.rowHeights;
|
|
106
|
-
o >= 0 && o <= 1 ? e = -((n[0].line + n[0].acc) * s) : o === -1 && (e = -((n[n.length - 1].line + n[n.length - 1].acc) * s));
|
|
107
|
-
const { topItemsCount: a, topItemsHeight: h } = this.topItems(n, !!this.topCacheCount);
|
|
108
|
-
this.translate(
|
|
109
|
-
Math.max(
|
|
110
|
-
0,
|
|
111
|
-
e - h - this.horizontalScrollbarHeight() + this.containerHeight * t / this.total
|
|
112
|
-
)
|
|
113
|
-
), this.changePage(l - a, i);
|
|
77
|
+
getTotalHeight(t, i) {
|
|
78
|
+
return i.slice(0, t).reduce((e, o) => e + o, 0);
|
|
114
79
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
const t = this.container.scrollTop, l = this.prevScrollPos;
|
|
123
|
-
if (this.prevScrollPos = t, this.askedSkip !== void 0) {
|
|
124
|
-
this.translate(this.containerHeight * this.askedSkip / this.total), this.changePage(this.askedSkip, i), this.prevScrollPos = t, this.askedSkip = void 0;
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
t - l < 0 && t > this.tableTranslate - this.table.scrollHeight / 10 ? this.localScrollUp(i) : t - l > 0 && t < this.tableTranslate + this.table.scrollHeight * 2 / 3 ? this.localScrollDown(i) : this.scrollNonStrict(i), this.prevScrollPos = t;
|
|
80
|
+
getExpectedTotalHeight(t) {
|
|
81
|
+
const i = this.rowHeightService;
|
|
82
|
+
if (!i)
|
|
83
|
+
return 0;
|
|
84
|
+
const e = this.firstToLoad + (t - 1);
|
|
85
|
+
return i.offset(e) + i.height(e) - i.offset(this.firstToLoad);
|
|
128
86
|
}
|
|
129
87
|
}
|
|
130
88
|
export {
|
|
131
|
-
|
|
89
|
+
u as VirtualScroll
|
|
132
90
|
};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),X=require("../GridClientWrapper.js"),m=require("@progress/kendo-react-common"),n=require("./utils.js"),J=require("react-dom"),b=require("@progress/kendo-svg-icons"),K=require("../utils/index.js"),w={zIndex:"19000",position:"absolute",display:"none",visibility:"hidden"},T={zIndex:"20000",display:"flex",position:"fixed",visibility:"hidden",pointerEvents:"none"},Q=C=>{const{rowReorderSettings:u,columns:k,unstyled:h}=C,{rowReorder:N,reorderRowDragTargetRef:a,reorderRowDropTargetRef:i,activeDragRowDataItemRef:d,tableBodyElementRef:O}=e.useContext(X.GridContext),[q,I]=e.useState(!1),[P,M]=e.useState(b.cancelIcon),y=e.useRef(null),f=e.useRef(null),c=e.useRef(null),v=e.useRef(null),p=e.useRef(!1),D=e.useRef(null),R=e.useRef(null),E=typeof u=="object"?u.enabled:u;e.useEffect(()=>{O.current=y.current},[]);const Y=r=>{var s;const t=r.originalEvent.target;t.closest(".k-drag-cell")&&(v.current=r.offsetY,p.current=!0,a.current=t.closest(".k-table-row"),R.current=(s=a.current)==null?void 0:s.parentElement)},B=r=>{!p.current||!E||!d.current||(a.current&&(a.current.style.userSelect="none"),I(!0))},F=r=>{if(!p.current&&!f.current)return;const{clientX:t,clientY:o}=r,s=v.current,g={x:t,y:o-s};f.current&&(f.current.style.left=`${g.x}px`,f.current.style.top=`${g.y}px`,f.current.style.visibility="visible"),$(r)},G=r=>{var o;if(!E||!d.current)return;I(!1);const t=Number((o=i.current)==null?void 0:o.getAttribute("absolute-row-index"));N(r,t,D.current),p.current=!1,R.current=null};m.useDraggable(y,{onPress:Y,onDragStart:B,onDrag:F,onDragEnd:G});const $=r=>{D.current=W(r),V()},V=()=>{var s;if(D.current===n.dropDirection.forbidden||!i.current){j();return}z();const r=n.getOffset(i.current);let t=r.top;const o=r.left+(((s=c.current)==null?void 0:s.offsetWidth)||0)/2;D.current===n.dropDirection.after&&(t+=i.current.offsetHeight),c.current&&(c.current.style.top=`${t}px`,c.current.style.left=`${o}px`,c.current.style.visibility="visible")},j=()=>{c.current&&(c.current.style.display="none")},z=()=>{c.current&&(c.current.style.display="")},H=()=>{if(d.current){if(u.dragClue){if(typeof u.dragClue=="string")return u.dragClue}else{const r=k.find(o=>!o.hidden&&o.columnType==="data");return d.current[r.field]}return u.dragClue(d.current)}},W=r=>{var S;if(i.current===a.current||!i.current||((S=i.current)==null?void 0:S.parentElement)!==R.current)return n.dropDirection.forbidden;const t=i.current.getBoundingClientRect(),s=t.height/2,g=r.clientY,x=t.top;let l=null;g<x+s?l=n.dropDirection.before:g>=x+t.height-s&&(l=n.dropDirection.after),(l===n.dropDirection.before&&i.current===a.current.nextElementSibling||l===n.dropDirection.after&&i.current===a.current.previousElementSibling)&&(l=n.dropDirection.forbidden);const L=l===n.dropDirection.forbidden?b.cancelIcon:b.insertMiddleIcon;return M(L),l},A=e.useMemo(H,[d.current]);return e.createElement(e.Fragment,null,q&&J.createPortal(e.createElement(e.Fragment,null,e.createElement("div",{ref:c,style:w,className:m.classNames(h.rowReorder({dropIndicatorMain:!0,dropIndicatorDirection:!0}))},e.createElement("div",{className:"k-drop-hint-start"}),e.createElement("div",{className:"k-drop-hint-line"})),e.createElement("div",{ref:f,style:T,className:m.classNames(h.rowReorder({dragClueMain:!0,dragClueOperation:!0}))},e.createElement(m.SvgIcon,{className:"k-drag-status",icon:P}),A)),document.body),K.cloneReactElement(C.children,{ref:y}))};exports.GridReorderableRowsContainer=Q;exports.dropIndicatorStyles=w;exports.hintClueStyles=T;
|
|
@@ -7,100 +7,104 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import e from "react";
|
|
10
|
-
import { GridContext as
|
|
11
|
-
import { useDraggable as
|
|
12
|
-
import { dropDirection as o, getOffset as
|
|
13
|
-
import
|
|
14
|
-
import { cancelIcon as
|
|
15
|
-
import { cloneReactElement as
|
|
16
|
-
const
|
|
10
|
+
import { GridContext as H } from "../GridClientWrapper.mjs";
|
|
11
|
+
import { useDraggable as _, classNames as x, SvgIcon as j } from "@progress/kendo-react-common";
|
|
12
|
+
import { dropDirection as o, getOffset as A } from "./utils.mjs";
|
|
13
|
+
import L from "react-dom";
|
|
14
|
+
import { cancelIcon as w, insertMiddleIcon as W } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { cloneReactElement as X } from "../utils/index.mjs";
|
|
16
|
+
const q = {
|
|
17
17
|
zIndex: "19000",
|
|
18
18
|
position: "absolute",
|
|
19
19
|
display: "none",
|
|
20
20
|
visibility: "hidden"
|
|
21
|
-
},
|
|
21
|
+
}, J = {
|
|
22
22
|
zIndex: "20000",
|
|
23
23
|
display: "flex",
|
|
24
24
|
position: "fixed",
|
|
25
25
|
visibility: "hidden",
|
|
26
26
|
pointerEvents: "none"
|
|
27
|
-
},
|
|
28
|
-
const { rowReorderSettings:
|
|
29
|
-
rowReorder:
|
|
30
|
-
reorderRowDragTargetRef:
|
|
27
|
+
}, se = (b) => {
|
|
28
|
+
const { rowReorderSettings: a, columns: S, unstyled: y } = b, {
|
|
29
|
+
rowReorder: T,
|
|
30
|
+
reorderRowDragTargetRef: u,
|
|
31
31
|
reorderRowDropTargetRef: i,
|
|
32
32
|
activeDragRowDataItemRef: d,
|
|
33
|
-
tableBodyElementRef:
|
|
34
|
-
} = e.useContext(
|
|
33
|
+
tableBodyElementRef: k
|
|
34
|
+
} = e.useContext(H), [N, C] = e.useState(!1), [O, P] = e.useState(w), D = e.useRef(null), f = e.useRef(null), c = e.useRef(null), h = e.useRef(null), p = e.useRef(!1), m = e.useRef(null), R = e.useRef(null), E = typeof a == "object" ? a.enabled : a;
|
|
35
35
|
e.useEffect(() => {
|
|
36
|
-
|
|
37
|
-
}, []),
|
|
38
|
-
onPress: (
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
k.current = D.current;
|
|
37
|
+
}, []), _(D, {
|
|
38
|
+
onPress: (r) => {
|
|
39
|
+
var s;
|
|
40
|
+
const t = r.originalEvent.target;
|
|
41
|
+
t.closest(".k-drag-cell") && (h.current = r.offsetY, p.current = !0, u.current = t.closest(".k-table-row"), R.current = (s = u.current) == null ? void 0 : s.parentElement);
|
|
41
42
|
},
|
|
42
|
-
onDragStart: (
|
|
43
|
-
!p.current || !
|
|
43
|
+
onDragStart: (r) => {
|
|
44
|
+
!p.current || !E || !d.current || (u.current && (u.current.style.userSelect = "none"), C(!0));
|
|
44
45
|
},
|
|
45
|
-
onDrag: (
|
|
46
|
+
onDrag: (r) => {
|
|
46
47
|
if (!p.current && !f.current)
|
|
47
48
|
return;
|
|
48
|
-
const { clientX:
|
|
49
|
-
f.current && (f.current.style.left = `${g.x}px`, f.current.style.top = `${g.y}px`, f.current.style.visibility = "visible"),
|
|
49
|
+
const { clientX: t, clientY: n } = r, s = h.current, g = { x: t, y: n - s };
|
|
50
|
+
f.current && (f.current.style.left = `${g.x}px`, f.current.style.top = `${g.y}px`, f.current.style.visibility = "visible"), M(r);
|
|
50
51
|
},
|
|
51
|
-
onDragEnd: (
|
|
52
|
+
onDragEnd: (r) => {
|
|
52
53
|
var n;
|
|
53
|
-
if (!
|
|
54
|
+
if (!E || !d.current)
|
|
54
55
|
return;
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
56
|
+
C(!1);
|
|
57
|
+
const t = Number((n = i.current) == null ? void 0 : n.getAttribute("absolute-row-index"));
|
|
58
|
+
T(r, t, m.current), p.current = !1, R.current = null;
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
|
-
const
|
|
61
|
-
m.current =
|
|
62
|
-
},
|
|
63
|
-
var
|
|
61
|
+
const M = (r) => {
|
|
62
|
+
m.current = V(r), Y();
|
|
63
|
+
}, Y = () => {
|
|
64
|
+
var s;
|
|
64
65
|
if (m.current === o.forbidden || !i.current) {
|
|
65
|
-
|
|
66
|
+
B();
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
const n =
|
|
72
|
-
m.current === o.after && (
|
|
73
|
-
},
|
|
69
|
+
F();
|
|
70
|
+
const r = A(i.current);
|
|
71
|
+
let t = r.top;
|
|
72
|
+
const n = r.left + (((s = c.current) == null ? void 0 : s.offsetWidth) || 0) / 2;
|
|
73
|
+
m.current === o.after && (t += i.current.offsetHeight), c.current && (c.current.style.top = `${t}px`, c.current.style.left = `${n}px`, c.current.style.visibility = "visible");
|
|
74
|
+
}, B = () => {
|
|
74
75
|
c.current && (c.current.style.display = "none");
|
|
75
|
-
},
|
|
76
|
+
}, F = () => {
|
|
76
77
|
c.current && (c.current.style.display = "");
|
|
77
|
-
},
|
|
78
|
+
}, $ = () => {
|
|
78
79
|
if (d.current) {
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
if (a.dragClue) {
|
|
81
|
+
if (typeof a.dragClue == "string")
|
|
82
|
+
return a.dragClue;
|
|
83
|
+
} else {
|
|
84
|
+
const r = S.find((n) => !n.hidden && n.columnType === "data");
|
|
85
|
+
return d.current[r.field];
|
|
84
86
|
}
|
|
87
|
+
return a.dragClue(d.current);
|
|
85
88
|
}
|
|
86
|
-
},
|
|
87
|
-
|
|
89
|
+
}, V = (r) => {
|
|
90
|
+
var v;
|
|
91
|
+
if (i.current === u.current || !i.current)
|
|
88
92
|
return o.forbidden;
|
|
89
|
-
if (
|
|
93
|
+
if (((v = i.current) == null ? void 0 : v.parentElement) !== R.current)
|
|
90
94
|
return o.forbidden;
|
|
91
|
-
const
|
|
92
|
-
let
|
|
93
|
-
g < I +
|
|
94
|
-
const
|
|
95
|
-
return
|
|
96
|
-
},
|
|
97
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null,
|
|
95
|
+
const t = i.current.getBoundingClientRect(), s = t.height / 2, g = r.clientY, I = t.top;
|
|
96
|
+
let l = null;
|
|
97
|
+
g < I + s ? l = o.before : g >= I + t.height - s && (l = o.after), l === o.before && i.current === u.current.nextElementSibling ? l = o.forbidden : l === o.after && i.current === u.current.previousElementSibling && (l = o.forbidden);
|
|
98
|
+
const G = l === o.forbidden ? w : W;
|
|
99
|
+
return P(G), l;
|
|
100
|
+
}, z = e.useMemo($, [d.current]);
|
|
101
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, N && L.createPortal(
|
|
98
102
|
/* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
99
103
|
"div",
|
|
100
104
|
{
|
|
101
105
|
ref: c,
|
|
102
|
-
style:
|
|
103
|
-
className:
|
|
106
|
+
style: q,
|
|
107
|
+
className: x(
|
|
104
108
|
y.rowReorder({ dropIndicatorMain: !0, dropIndicatorDirection: !0 })
|
|
105
109
|
)
|
|
106
110
|
},
|
|
@@ -110,19 +114,19 @@ const X = {
|
|
|
110
114
|
"div",
|
|
111
115
|
{
|
|
112
116
|
ref: f,
|
|
113
|
-
style:
|
|
114
|
-
className:
|
|
117
|
+
style: J,
|
|
118
|
+
className: x(y.rowReorder({ dragClueMain: !0, dragClueOperation: !0 }))
|
|
115
119
|
},
|
|
116
|
-
/* @__PURE__ */ e.createElement(
|
|
117
|
-
|
|
120
|
+
/* @__PURE__ */ e.createElement(j, { className: "k-drag-status", icon: O }),
|
|
121
|
+
z
|
|
118
122
|
)),
|
|
119
123
|
document.body
|
|
120
|
-
),
|
|
124
|
+
), X(b.children, {
|
|
121
125
|
ref: D
|
|
122
126
|
}));
|
|
123
127
|
};
|
|
124
128
|
export {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
129
|
+
se as GridReorderableRowsContainer,
|
|
130
|
+
q as dropIndicatorStyles,
|
|
131
|
+
J as hintClueStyles
|
|
128
132
|
};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),c=require("../GridClientWrapper.js");function
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),c=require("../GridClientWrapper.js");function a(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const o=a(i),l=e=>{const t=o.useContext(c.GridContext);return o.createElement("div",{ref:t.virtualScrollHeightContainerRef})};exports.VirtualScrollHeightContainer=l;
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as t from "react";
|
|
10
|
-
import { GridContext as
|
|
11
|
-
const n = (
|
|
12
|
-
const r = t.useContext(
|
|
13
|
-
return /* @__PURE__ */ t.createElement("div", {
|
|
10
|
+
import { GridContext as e } from "../GridClientWrapper.mjs";
|
|
11
|
+
const n = (o) => {
|
|
12
|
+
const r = t.useContext(e);
|
|
13
|
+
return /* @__PURE__ */ t.createElement("div", { ref: r.virtualScrollHeightContainerRef });
|
|
14
14
|
};
|
|
15
15
|
export {
|
|
16
16
|
n as VirtualScrollHeightContainer
|
|
@@ -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 c=require("react"),o=require("../../GridClientWrapper.js"),s=require("@progress/kendo-react-data-tools");function i(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const r=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,r.get?r:{enumerable:!0,get:()=>e[l]})}}return t.default=e,Object.freeze(t)}const a=i(c),b=e=>{var r;const t=a.useContext(o.GridContext),l={...e.tableStyle};return(r=t.vsRef.current)!=null&&r.tableTransform&&(l.transform=t.vsRef.current.tableTransform),a.createElement(s.TableSelection,{selectable:e.selectable,onRelease:t.selectionRelease,childRef:n=>{t.tableElementRef.current=n}},a.createElement("table",{className:e.tableClassName,role:"presentation",style:l,ref:t.tableElementRef},e.children))};exports.GridTableScrollable=b;
|
|
@@ -7,31 +7,32 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as l from "react";
|
|
10
|
-
import { GridContext as
|
|
11
|
-
import { TableSelection as
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
import { GridContext as o } from "../../GridClientWrapper.mjs";
|
|
11
|
+
import { TableSelection as s } from "@progress/kendo-react-data-tools";
|
|
12
|
+
const b = (t) => {
|
|
13
|
+
var a;
|
|
14
|
+
const e = l.useContext(o), r = { ...t.tableStyle };
|
|
15
|
+
return (a = e.vsRef.current) != null && a.tableTransform && (r.transform = e.vsRef.current.tableTransform), /* @__PURE__ */ l.createElement(
|
|
16
|
+
s,
|
|
16
17
|
{
|
|
17
|
-
selectable:
|
|
18
|
-
onRelease:
|
|
19
|
-
childRef: (
|
|
20
|
-
|
|
18
|
+
selectable: t.selectable,
|
|
19
|
+
onRelease: e.selectionRelease,
|
|
20
|
+
childRef: (n) => {
|
|
21
|
+
e.tableElementRef.current = n;
|
|
21
22
|
}
|
|
22
23
|
},
|
|
23
24
|
/* @__PURE__ */ l.createElement(
|
|
24
25
|
"table",
|
|
25
26
|
{
|
|
26
|
-
className:
|
|
27
|
+
className: t.tableClassName,
|
|
27
28
|
role: "presentation",
|
|
28
|
-
style:
|
|
29
|
-
ref:
|
|
29
|
+
style: r,
|
|
30
|
+
ref: e.tableElementRef
|
|
30
31
|
},
|
|
31
|
-
|
|
32
|
+
t.children
|
|
32
33
|
)
|
|
33
34
|
);
|
|
34
35
|
};
|
|
35
36
|
export {
|
|
36
|
-
|
|
37
|
+
b as GridTableScrollable
|
|
37
38
|
};
|
package/components/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 i={before:"before",after:"after",forbidden:"forbidden"};function d(t){const{clientTop:o,clientLeft:f}=s(t),{pageYOffset:c,pageXOffset:n}=u(t),{top:r,left:e}=t.getBoundingClientRect();return{top:r+c-o,left:e+n-f}}const s=t=>t==null?void 0:t.ownerDocument.documentElement,u=t=>t==null?void 0:t.ownerDocument.defaultView;exports.dropDirection=i;exports.getOffset=d;
|
package/components/utils.mjs
CHANGED
|
@@ -5,21 +5,20 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const u = {
|
|
9
9
|
before: "before",
|
|
10
10
|
after: "after",
|
|
11
11
|
forbidden: "forbidden"
|
|
12
|
-
}
|
|
13
|
-
function
|
|
14
|
-
const { clientTop:
|
|
12
|
+
};
|
|
13
|
+
function e(o) {
|
|
14
|
+
const { clientTop: t, clientLeft: f } = d(o), { pageYOffset: c, pageXOffset: n } = s(o), { top: r, left: i } = o.getBoundingClientRect();
|
|
15
15
|
return {
|
|
16
|
-
top:
|
|
17
|
-
left:
|
|
16
|
+
top: r + c - t,
|
|
17
|
+
left: i + n - f
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const d = (o) => o == null ? void 0 : o.ownerDocument.documentElement, s = (o) => o == null ? void 0 : o.ownerDocument.defaultView;
|
|
21
21
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
D as isDifferentParent
|
|
22
|
+
u as dropDirection,
|
|
23
|
+
e as getOffset
|
|
25
24
|
};
|