@progress/kendo-react-grid 7.5.0-develop.1 → 7.5.0-develop.11
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/Grid.js +1 -1
- package/Grid.mjs +252 -252
- package/VirtualScrollFixed.js +1 -1
- package/VirtualScrollFixed.mjs +18 -53
- package/columnMenu/GridColumnMenuWrapper.js +1 -1
- package/columnMenu/GridColumnMenuWrapper.mjs +7 -7
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.d.mts +13 -59
- package/index.d.ts +13 -59
- package/package-metadata.mjs +1 -1
- package/package.json +11 -11
package/VirtualScrollFixed.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 d=require("react"),g=require("./utils/index.js");function u(
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),g=require("./utils/index.js");function u(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const o=u(d);class p{constructor(e){this.table=null,this.containerHeight=0,this.topCacheCount=0,this.attendedSkip=0,this.propsSkip=0,this.total=0,this.scrollableVirtual=!1,this.realSkip=0,this.pageSize=0,this.PageChange=null,this.tableBodyRef=o.createRef(),this.fixedScroll=!1,this.askedSkip=void 0,this.containerRef=o.createRef(),this.tableTransform="",this.scrollSyncing=!1,this.lastLoaded=0,this.firstLoaded=0,this.lastScrollTop=0,this.reactVersion=Number.parseFloat(o.version),this.firstLoaded=this.pageSize,this.lastLoaded=this.realSkip+this.pageSize,this.scrollHandler=this.scrollHandler.bind(this)}get container(){return this.containerRef.current}translate(e,t){this.scrollableVirtual&&this.table&&(g.firefox||this.reactVersion<=17||t?this.table.style.transform="translateY("+e+"px)":this.tableTransform="translateY("+e+"px)")}changePage(e,t){this.PageChange&&this.PageChange({skip:Math.max(0,e),take:this.pageSize},t)}reset(){this.scrollSyncing=!0,!this.fixedScroll&&(this.container&&(this.container.scrollTop=0),this.translate(0,!0))}scrollHandler(e){if(!this.scrollableVirtual||!this.container||!this.table||!this.rowHeightService||!this.containerRef.current)return;if(this.scrollSyncing){this.scrollSyncing=!1;return}const t=this.container.scrollTop,a=this.lastScrollTop>=t,h=!a;this.lastScrollTop=t;let i=this.rowHeightService.index(t),l=this.rowHeightService.offset(i);const{offsetHeight:n}=this.containerRef.current,c=this.rowHeightService.index(t+n);if(h&&c>=this.lastLoaded&&this.lastLoaded<this.total){const r=i+this.pageSize-this.total;r>0&&(i=i-r,l=this.rowHeightService.offset(i)),this.firstLoaded=i,this.translate(l);const f=this.firstLoaded+this.pageSize;this.lastLoaded=Math.min(f,this.total),this.changePage(this.firstLoaded,e)}else if(a&&i<this.firstLoaded){const r=Math.floor(this.pageSize*.3);this.firstLoaded=Math.max(i-r,0),this.translate(this.rowHeightService.offset(this.firstLoaded)),this.lastLoaded=Math.min(this.firstLoaded+this.pageSize,this.total),this.changePage(this.firstLoaded,e)}}}exports.VirtualScrollFixed=p;
|
package/VirtualScrollFixed.mjs
CHANGED
|
@@ -6,54 +6,20 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import { firefox as
|
|
11
|
-
class u {
|
|
12
|
-
constructor(t = 0, e, h, i) {
|
|
13
|
-
this.total = t, this.offsets = [], this.heights = [];
|
|
14
|
-
let s = 0;
|
|
15
|
-
for (let r = 0; r < t; r++) {
|
|
16
|
-
this.offsets.push(s);
|
|
17
|
-
const a = i && i[r].expanded && i[r].rowType === "data" ? h : e;
|
|
18
|
-
s += a, this.heights.push(a);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
height(t) {
|
|
22
|
-
return this.heights[t];
|
|
23
|
-
}
|
|
24
|
-
index(t) {
|
|
25
|
-
if (t < 0)
|
|
26
|
-
return;
|
|
27
|
-
const e = this.offsets.reduce((h, i, s) => {
|
|
28
|
-
if (h !== void 0)
|
|
29
|
-
return h;
|
|
30
|
-
if (i === t)
|
|
31
|
-
return s;
|
|
32
|
-
if (i > t)
|
|
33
|
-
return s - 1;
|
|
34
|
-
}, void 0);
|
|
35
|
-
return e === void 0 ? this.total - 1 : e;
|
|
36
|
-
}
|
|
37
|
-
offset(t) {
|
|
38
|
-
return this.offsets[t];
|
|
39
|
-
}
|
|
40
|
-
totalHeight() {
|
|
41
|
-
const t = this.offsets[this.offsets.length - 1], e = this.heights[this.heights.length - 1];
|
|
42
|
-
return t + e;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
9
|
+
import * as a from "react";
|
|
10
|
+
import { firefox as f } from "./utils/index.mjs";
|
|
45
11
|
class p {
|
|
46
12
|
constructor(t) {
|
|
47
|
-
this.table = null, this.containerHeight = 0, this.topCacheCount = 0, this.attendedSkip = 0, this.propsSkip = 0, this.total = 0, this.scrollableVirtual = !1, this.realSkip = 0, this.pageSize = 0, this.PageChange = null, this.tableBodyRef =
|
|
13
|
+
this.table = null, this.containerHeight = 0, this.topCacheCount = 0, this.attendedSkip = 0, this.propsSkip = 0, this.total = 0, this.scrollableVirtual = !1, this.realSkip = 0, this.pageSize = 0, this.PageChange = null, this.tableBodyRef = a.createRef(), this.fixedScroll = !1, this.askedSkip = void 0, this.containerRef = a.createRef(), this.tableTransform = "", this.scrollSyncing = !1, this.lastLoaded = 0, this.firstLoaded = 0, this.lastScrollTop = 0, this.reactVersion = Number.parseFloat(a.version), this.firstLoaded = this.pageSize, this.lastLoaded = this.realSkip + this.pageSize, this.scrollHandler = this.scrollHandler.bind(this);
|
|
48
14
|
}
|
|
49
15
|
get container() {
|
|
50
16
|
return this.containerRef.current;
|
|
51
17
|
}
|
|
52
|
-
translate(t,
|
|
53
|
-
this.scrollableVirtual && this.table && (
|
|
18
|
+
translate(t, i) {
|
|
19
|
+
this.scrollableVirtual && this.table && (f || this.reactVersion <= 17 || i ? this.table.style.transform = "translateY(" + t + "px)" : this.tableTransform = "translateY(" + t + "px)");
|
|
54
20
|
}
|
|
55
|
-
changePage(t,
|
|
56
|
-
this.PageChange && this.PageChange({ skip: Math.max(0, t), take: this.pageSize },
|
|
21
|
+
changePage(t, i) {
|
|
22
|
+
this.PageChange && this.PageChange({ skip: Math.max(0, t), take: this.pageSize }, i);
|
|
57
23
|
}
|
|
58
24
|
reset() {
|
|
59
25
|
this.scrollSyncing = !0, !this.fixedScroll && (this.container && (this.container.scrollTop = 0), this.translate(0, !0));
|
|
@@ -65,22 +31,21 @@ class p {
|
|
|
65
31
|
this.scrollSyncing = !1;
|
|
66
32
|
return;
|
|
67
33
|
}
|
|
68
|
-
const
|
|
69
|
-
this.lastScrollTop =
|
|
70
|
-
let
|
|
71
|
-
const { offsetHeight:
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
34
|
+
const i = this.container.scrollTop, r = this.lastScrollTop >= i, o = !r;
|
|
35
|
+
this.lastScrollTop = i;
|
|
36
|
+
let e = this.rowHeightService.index(i), h = this.rowHeightService.offset(e);
|
|
37
|
+
const { offsetHeight: l } = this.containerRef.current, n = this.rowHeightService.index(i + l);
|
|
38
|
+
if (o && n >= this.lastLoaded && this.lastLoaded < this.total) {
|
|
39
|
+
const s = e + this.pageSize - this.total;
|
|
40
|
+
s > 0 && (e = e - s, h = this.rowHeightService.offset(e)), this.firstLoaded = e, this.translate(h);
|
|
41
|
+
const c = this.firstLoaded + this.pageSize;
|
|
76
42
|
this.lastLoaded = Math.min(c, this.total), this.changePage(this.firstLoaded, t);
|
|
77
|
-
} else if (
|
|
78
|
-
const
|
|
79
|
-
this.firstLoaded = Math.max(
|
|
43
|
+
} else if (r && e < this.firstLoaded) {
|
|
44
|
+
const s = Math.floor(this.pageSize * 0.3);
|
|
45
|
+
this.firstLoaded = Math.max(e - s, 0), this.translate(this.rowHeightService.offset(this.firstLoaded)), this.lastLoaded = Math.min(this.firstLoaded + this.pageSize, this.total), this.changePage(this.firstLoaded, t);
|
|
80
46
|
}
|
|
81
47
|
}
|
|
82
48
|
}
|
|
83
49
|
export {
|
|
84
|
-
u as RowHeightService,
|
|
85
50
|
p as VirtualScrollFixed
|
|
86
51
|
};
|
|
@@ -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 N=require("react"),O=require("@progress/kendo-react-popup"),i=require("@progress/kendo-react-common"),P=require("@progress/kendo-svg-icons"),E=require("../messages/index.js"),_=require("@progress/kendo-react-intl");function j(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const u=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(r,l,u.get?u:{enumerable:!0,get:()=>e[l]})}}return r.default=e,Object.freeze(r)}const o=j(N),z=[".k-columnmenu-item-content",".k-filter-menu-container"].map(e=>i.TABBABLE_ELEMENTS.map(r=>`${e} ${r}`)),W=[[".k-tabstrip-items"],[".k-columnmenu-item"],...z],$=e=>{const[r,l]=o.useState(!1),u=o.useRef(null),a=o.useRef(null),s=o.useRef(null),m=o.useRef(0),{columnMenu:h,...v}=e,{column:b}=e,w=_.useLocalization(),k=b.title||b.field,M=k?`${k} `:"",y="#",p=n=>{const t=i.getActiveElement(document);clearTimeout(m.current),m.current=window.setTimeout(()=>{t&&n.relatedTarget!==u.current&&a.current&&!a.current.contains(t)&&f()})},C=()=>{clearTimeout(m.current)},D=n=>{n.preventDefault(),r&&e.onCloseMenu&&e.onCloseMenu(),l(!r)},f=()=>{e.onCloseMenu&&e.onCloseMenu(),l(!1),!e.navigatable&&u.current&&u.current.focus()},S=n=>{var t;if(n.keyCode===i.Keys.tab){const c=n.target,g=c&&((t=c.closest(".k-grid"))==null?void 0:t.getElementsByClassName("k-grid-content")[0]);g&&g.scrollWidth>g.clientWidth&&c.scrollIntoView({inline:"center"})}},d=o.useMemo(()=>e.show!==void 0?e.show:r,[e.show,r]),T=n=>{var t;(t=s.current)==null||t.triggerKeyboardEvent(n)},R=n=>{var t;(t=s.current)==null||t.triggerMouseEvent(n)},I=(n,t,c)=>{c.preventDefault(),c.shiftKey?t.focusPrevious(n):t.focusNext(n)},K=(n,t,c)=>{n&&n.click()},q=(n,t,c)=>{c.preventDefault(),f()},B=(n,t,c)=>{c.preventDefault(),t.focusElement(n)};return o.useEffect(()=>(d&&a.current&&(s.current=new i.Navigation({tabIndex:0,root:a,selectors:W,keyboardEvents:{keydown:{Tab:I,Enter:K,Escape:q}},mouseEvents:{mousedown:B}}),s.current.focusElement(s.current.first,null)),()=>{s.current&&(s.current=null)}),[d]),o.createElement(o.Fragment,null,o.createElement("a",{className:"k-grid-header-menu k-grid-column-menu",ref:u,onClick:D,onKeyDown:S,href:y,tabIndex:e.navigatable?-1:void 0,"aria-label":`${M}${w.toLanguageString(E.columnMenu,E.messages[E.columnMenu])}`},o.createElement(i.IconWrap,{name:"filter",icon:P.
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),O=require("@progress/kendo-react-popup"),i=require("@progress/kendo-react-common"),P=require("@progress/kendo-svg-icons"),E=require("../messages/index.js"),_=require("@progress/kendo-react-intl");function j(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const u=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(r,l,u.get?u:{enumerable:!0,get:()=>e[l]})}}return r.default=e,Object.freeze(r)}const o=j(N),z=[".k-columnmenu-item-content",".k-filter-menu-container"].map(e=>i.TABBABLE_ELEMENTS.map(r=>`${e} ${r}`)),W=[[".k-tabstrip-items"],[".k-columnmenu-item"],...z],$=e=>{const[r,l]=o.useState(!1),u=o.useRef(null),a=o.useRef(null),s=o.useRef(null),m=o.useRef(0),{columnMenu:h,...v}=e,{column:b}=e,w=_.useLocalization(),k=b.title||b.field,M=k?`${k} `:"",y="#",p=n=>{const t=i.getActiveElement(document);clearTimeout(m.current),m.current=window.setTimeout(()=>{t&&n.relatedTarget!==u.current&&a.current&&!a.current.contains(t)&&f()})},C=()=>{clearTimeout(m.current)},D=n=>{n.preventDefault(),r&&e.onCloseMenu&&e.onCloseMenu(),l(!r)},f=()=>{e.onCloseMenu&&e.onCloseMenu(),l(!1),!e.navigatable&&u.current&&u.current.focus()},S=n=>{var t;if(n.keyCode===i.Keys.tab){const c=n.target,g=c&&((t=c.closest(".k-grid"))==null?void 0:t.getElementsByClassName("k-grid-content")[0]);g&&g.scrollWidth>g.clientWidth&&c.scrollIntoView({inline:"center"})}},d=o.useMemo(()=>e.show!==void 0?e.show:r,[e.show,r]),T=n=>{var t;(t=s.current)==null||t.triggerKeyboardEvent(n)},R=n=>{var t;(t=s.current)==null||t.triggerMouseEvent(n)},I=(n,t,c)=>{c.preventDefault(),c.shiftKey?t.focusPrevious(n):t.focusNext(n)},K=(n,t,c)=>{n&&n.click()},q=(n,t,c)=>{c.preventDefault(),f()},B=(n,t,c)=>{c.preventDefault(),t.focusElement(n)};return o.useEffect(()=>(d&&a.current&&(s.current=new i.Navigation({tabIndex:0,root:a,selectors:W,keyboardEvents:{keydown:{Tab:I,Enter:K,Escape:q}},mouseEvents:{mousedown:B}}),s.current.focusElement(s.current.first,null)),()=>{s.current&&(s.current=null)}),[d]),o.createElement(o.Fragment,null,o.createElement("a",{className:"k-grid-header-menu k-grid-column-menu",ref:u,onClick:D,onKeyDown:S,href:y,tabIndex:e.navigatable?-1:void 0,"aria-label":`${M}${w.toLanguageString(E.columnMenu,E.messages[E.columnMenu])}`},o.createElement(i.IconWrap,{name:"filter",icon:P.moreVerticalIcon})),o.createElement(O.Popup,{anchor:u.current,show:d,popupClass:"k-column-menu k-column-menu-popup k-grid-columnmenu-popup"},o.createElement("div",{ref:a,onBlur:p,onFocus:C,onMouseDown:R,onKeyDown:T,style:{outline:"none"}},h&&o.createElement(h,{...v,onCloseMenu:f}))))};exports.GridColumnMenuWrapper=$;
|
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
import * as t from "react";
|
|
10
10
|
import { Popup as R } from "@progress/kendo-react-popup";
|
|
11
11
|
import { TABBABLE_ELEMENTS as $, Navigation as x, IconWrap as z, getActiveElement as A, Keys as F } from "@progress/kendo-react-common";
|
|
12
|
-
import {
|
|
12
|
+
import { moreVerticalIcon as L } from "@progress/kendo-svg-icons";
|
|
13
13
|
import { columnMenu as w, messages as W } from "../messages/index.mjs";
|
|
14
|
-
import { useLocalization as
|
|
15
|
-
const
|
|
14
|
+
import { useLocalization as V } from "@progress/kendo-react-intl";
|
|
15
|
+
const _ = [
|
|
16
16
|
".k-columnmenu-item-content",
|
|
17
17
|
".k-filter-menu-container"
|
|
18
18
|
].map((o) => $.map(
|
|
19
19
|
(u) => `${o} ${u}`
|
|
20
|
-
)),
|
|
20
|
+
)), H = [
|
|
21
21
|
[".k-tabstrip-items"],
|
|
22
22
|
[".k-columnmenu-item"],
|
|
23
|
-
...
|
|
23
|
+
..._
|
|
24
24
|
], Q = (o) => {
|
|
25
|
-
const [u, d] = t.useState(!1), l = t.useRef(null), s = t.useRef(null), c = t.useRef(null), a = t.useRef(0), { columnMenu: E, ...v } = o, { column: h } = o, k =
|
|
25
|
+
const [u, d] = t.useState(!1), l = t.useRef(null), s = t.useRef(null), c = t.useRef(null), a = t.useRef(0), { columnMenu: E, ...v } = o, { column: h } = o, k = V(), g = h.title || h.field, M = g ? `${g} ` : "", b = "#", p = (e) => {
|
|
26
26
|
const n = A(document);
|
|
27
27
|
clearTimeout(a.current), a.current = window.setTimeout(() => {
|
|
28
28
|
n && e.relatedTarget !== l.current && s.current && !s.current.contains(n) && i();
|
|
@@ -57,7 +57,7 @@ const H = [
|
|
|
57
57
|
return t.useEffect(() => (m && s.current && (c.current = new x({
|
|
58
58
|
tabIndex: 0,
|
|
59
59
|
root: s,
|
|
60
|
-
selectors:
|
|
60
|
+
selectors: H,
|
|
61
61
|
keyboardEvents: {
|
|
62
62
|
keydown: {
|
|
63
63
|
Tab: K,
|