@progress/kendo-react-grid 15.0.1-develop.9 → 15.1.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/VirtualScroll.js +1 -1
- package/VirtualScroll.mjs +1 -1
- package/cells/selectioncell/GridSelectionCell.js +1 -1
- package/cells/selectioncell/GridSelectionCell.mjs +29 -8
- package/cells/selectioncell/GridSelectionCellInput.d.ts +6 -2
- package/cells/selectioncell/GridSelectionCellInput.js +1 -1
- package/cells/selectioncell/GridSelectionCellInput.mjs +16 -25
- package/cells/selectioncell/GridSelectionCellServer.js +1 -1
- package/cells/selectioncell/GridSelectionCellServer.mjs +18 -16
- 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 +17 -17
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 c=require("react"),n=require("./utils/index.js");function f(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const d=f(c),g=.3;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(){if(this.firstToLoad=0,this.firstLoaded=0,this.lastLoaded=0,this.rowHeightService=void 0,this.fixedScroll){this.lastScrollTop=this.container?this.container.scrollTop:0;return}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,o=!i;this.lastScrollTop=e;const a=this.container.offsetHeight;let s=this.rowHeightService.index(e);const l=this.rowHeightService.index(e+a),h=Math.max(s+this.pageSize-this.total,0);s=Math.max(s-h,0),o&&l>=this.lastLoaded&&this.lastLoaded<this.total-1?(this.firstToLoad=s,this.loadPage(t)):(i&&s<this.firstToLoad||s>this.lastLoaded||l<this.firstLoaded)&&this.loadPageWithBuffer(s,h,i,t)}update(){var e;const t=this.getItemHeights();if(this.firstLoaded>this.firstToLoad){const i=Math.min(this.firstLoaded-this.firstToLoad,this.pageSize),o=this.getTotalHeight(i,t),a=this.getExpectedTotalHeight(i),s=o-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))}loadPageWithBuffer(t,e,i,o){const a=i?Math.max(Math.floor(this.pageSize*g)-e,0):0;this.firstToLoad=Math.max(t-a,0),this.loadPage(o)}translate(t,e){this.scrollableVirtual&&this.table&&((this.reactVersion<=17||e)&&(this.table.style.transform="translateY("+t+"px)"),this.reactVersion>17&&(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=n.firefox?Math.min(n.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.
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),n=require("./utils/index.js");function f(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const d=f(c),g=.3;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(){if(this.firstToLoad=0,this.firstLoaded=0,this.lastLoaded=0,this.rowHeightService=void 0,this.fixedScroll){this.lastScrollTop=this.container?this.container.scrollTop:0;return}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,o=!i;this.lastScrollTop=e;const a=this.container.offsetHeight;let s=this.rowHeightService.index(e);const l=this.rowHeightService.index(e+a),h=Math.max(s+this.pageSize-this.total,0);s=Math.max(s-h,0),o&&l>=this.lastLoaded&&this.lastLoaded<this.total-1?(this.firstToLoad=s,this.loadPage(t)):(i&&s<this.firstToLoad||s>this.lastLoaded||l<this.firstLoaded)&&this.loadPageWithBuffer(s,h,i,t)}update(){var e;const t=this.getItemHeights();if(this.firstLoaded>this.firstToLoad){const i=Math.min(this.firstLoaded-this.firstToLoad,this.pageSize),o=this.getTotalHeight(i,t),a=this.getExpectedTotalHeight(i),s=o-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))}loadPageWithBuffer(t,e,i,o){const a=i?Math.max(Math.floor(this.pageSize*g)-e,0):0;this.firstToLoad=Math.max(t-a,0),this.loadPage(o)}translate(t,e){this.scrollableVirtual&&this.table&&((this.reactVersion<=17||e)&&(this.table.style.transform="translateY("+t+"px)"),this.reactVersion>17&&(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=n.firefox?Math.min(n.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.offsetHeight;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,o)=>i+o,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
|
@@ -74,7 +74,7 @@ class u {
|
|
|
74
74
|
getItemHeights() {
|
|
75
75
|
const t = [];
|
|
76
76
|
return this.tableBody && Array.from(this.tableBody.children).forEach((i) => {
|
|
77
|
-
const s = i.
|
|
77
|
+
const s = i.offsetHeight;
|
|
78
78
|
i.classList.contains("k-detail-row") ? t[t.length - 1] += s : t.push(s);
|
|
79
79
|
}), t;
|
|
80
80
|
}
|
|
@@ -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 f=require("react"),P=require("@progress/kendo-react-common"),S=require("../../utils/GridContext.js"),y=require("./GridSelectionCellInput.js"),m=require("./utils.js"),b=require("../hooks.js"),I=require("./useSelectionCellClientTdProps.js");function T(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const l=T(f),k=t=>{var p;const{cellProps:e}=t,{tdProps:n}=m.getSelectionCellTdProps(e),o=I.useSelectionCellClientTdProps(e),g=b.useLegacyCellProps(e),c=l.useContext(S.GridContext),s=(p=e.isSelected)!=null?p:P.getNestedValue(e.field,e.dataItem),i=typeof s=="boolean"&&s,a=r=>{c==null||c.selectionChange({event:r,dataItem:e.dataItem,dataIndex:e.rowDataIndex,columnIndex:e.columnIndex})},u=r=>{i||a(r)},d=l.createElement(y.GridSelectionCellInput,{key:1,selected:i,onToggle:a}),C=m.getCustomCell(e);return C?l.createElement(C,{onClick:u,...e,...g,tdProps:{...n,...o}},d):e.rowType!=="groupHeader"?l.createElement("td",{onClick:u,...n,...o},d):null};exports.GridSelectionCell=k;
|
|
@@ -7,14 +7,35 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as t from "react";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
import { getNestedValue as f } from "@progress/kendo-react-common";
|
|
11
|
+
import { GridContext as g } from "../../utils/GridContext.mjs";
|
|
12
|
+
import { GridSelectionCellInput as I } from "./GridSelectionCellInput.mjs";
|
|
13
|
+
import { getSelectionCellTdProps as P, getCustomCell as x } from "./utils.mjs";
|
|
14
|
+
import { useLegacyCellProps as y } from "../hooks.mjs";
|
|
15
|
+
import { useSelectionCellClientTdProps as S } from "./useSelectionCellClientTdProps.mjs";
|
|
16
|
+
const V = (C) => {
|
|
17
|
+
var p;
|
|
18
|
+
const { cellProps: e } = C, { tdProps: n } = P(e), r = S(e), u = y(e), o = t.useContext(g), c = (p = e.isSelected) != null ? p : f(e.field, e.dataItem), s = typeof c == "boolean" && c, a = (l) => {
|
|
19
|
+
o == null || o.selectionChange({
|
|
20
|
+
event: l,
|
|
21
|
+
dataItem: e.dataItem,
|
|
22
|
+
dataIndex: e.rowDataIndex,
|
|
23
|
+
columnIndex: e.columnIndex
|
|
24
|
+
});
|
|
25
|
+
}, d = (l) => {
|
|
26
|
+
s || a(l);
|
|
27
|
+
}, m = /* @__PURE__ */ t.createElement(I, { key: 1, selected: s, onToggle: a }), i = x(e);
|
|
28
|
+
return i ? /* @__PURE__ */ t.createElement(
|
|
29
|
+
i,
|
|
30
|
+
{
|
|
31
|
+
onClick: d,
|
|
32
|
+
...e,
|
|
33
|
+
...u,
|
|
34
|
+
tdProps: { ...n, ...r }
|
|
35
|
+
},
|
|
36
|
+
m
|
|
37
|
+
) : e.rowType !== "groupHeader" ? /* @__PURE__ */ t.createElement("td", { onClick: d, ...n, ...r }, m) : null;
|
|
17
38
|
};
|
|
18
39
|
export {
|
|
19
|
-
|
|
40
|
+
V as GridSelectionCell
|
|
20
41
|
};
|
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { GridCellProps } from '../../interfaces/GridCellProps';
|
|
9
8
|
import * as React from 'react';
|
|
9
|
+
interface GridSelectionCellInputProps {
|
|
10
|
+
selected: boolean;
|
|
11
|
+
onToggle?: (e: React.SyntheticEvent<HTMLElement>) => void;
|
|
12
|
+
}
|
|
10
13
|
/**
|
|
11
14
|
* @hidden
|
|
12
15
|
*/
|
|
13
|
-
export declare const GridSelectionCellInput: (props:
|
|
16
|
+
export declare const GridSelectionCellInput: (props: GridSelectionCellInputProps) => React.JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -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 s=require("react"),u=require("@progress/kendo-react-common"),d=require("@progress/kendo-react-intl"),o=require("../../messages/index.js");function p(t){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(c,e,n.get?n:{enumerable:!0,get:()=>t[e]})}}return c.default=t,Object.freeze(c)}const r=p(s),k=t=>{const{selected:c,onToggle:e}=t,n=u.useId(),l=d.useLocalization(),i=a=>{a.stopPropagation(),e==null||e(a)};return r.createElement("span",{className:"k-checkbox-wrap"},r.createElement("input",{id:n,tabIndex:-1,type:"checkbox",className:"k-checkbox k-checkbox-md k-rounded-md","aria-label":l.toLanguageString(o.selectRow,o.messages[o.selectRow]),"aria-checked":c,checked:c,readOnly:!0,onClick:i}))};exports.GridSelectionCellInput=k;
|
|
@@ -6,38 +6,29 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
t == null || t.selectionChange({
|
|
19
|
-
event: s,
|
|
20
|
-
dataItem: e.dataItem,
|
|
21
|
-
dataIndex: e.rowDataIndex,
|
|
22
|
-
columnIndex: e.columnIndex
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
[t, e.columnIndex, e.rowDataIndex, e.dataItem]
|
|
26
|
-
);
|
|
27
|
-
return /* @__PURE__ */ a.createElement("span", { className: "k-checkbox-wrap" }, /* @__PURE__ */ a.createElement(
|
|
9
|
+
import * as o from "react";
|
|
10
|
+
import { useId as l } from "@progress/kendo-react-common";
|
|
11
|
+
import { useLocalization as m } from "@progress/kendo-react-intl";
|
|
12
|
+
import { selectRow as a, messages as d } from "../../messages/index.mjs";
|
|
13
|
+
const h = (n) => {
|
|
14
|
+
const { selected: t, onToggle: e } = n, r = l(), i = m(), s = (c) => {
|
|
15
|
+
c.stopPropagation(), e == null || e(c);
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ o.createElement("span", { className: "k-checkbox-wrap" }, /* @__PURE__ */ o.createElement(
|
|
28
18
|
"input",
|
|
29
19
|
{
|
|
30
|
-
id:
|
|
20
|
+
id: r,
|
|
31
21
|
tabIndex: -1,
|
|
32
22
|
type: "checkbox",
|
|
33
23
|
className: "k-checkbox k-checkbox-md k-rounded-md",
|
|
34
|
-
"aria-label":
|
|
35
|
-
"aria-checked":
|
|
36
|
-
checked:
|
|
37
|
-
|
|
24
|
+
"aria-label": i.toLanguageString(a, d[a]),
|
|
25
|
+
"aria-checked": t,
|
|
26
|
+
checked: t,
|
|
27
|
+
readOnly: !0,
|
|
28
|
+
onClick: s
|
|
38
29
|
}
|
|
39
30
|
));
|
|
40
31
|
};
|
|
41
32
|
export {
|
|
42
|
-
|
|
33
|
+
h as GridSelectionCellInput
|
|
43
34
|
};
|
|
@@ -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 m=require("react"),f=require("@progress/kendo-react-common"),g=require("./GridSelectionCellInput.js"),u=require("./GridSelectionCellServerContainer.js"),a=require("../../utils/index.js"),d=require("./utils.js");function P(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const l=P(m),b=r=>{var s;const{cellProps:e}=r,{tdProps:t}=d.getSelectionCellTdProps(e),n=(s=e.isSelected)!=null?s:f.getNestedValue(e.field,e.dataItem),C=typeof n=="boolean"&&n,i=l.createElement(g.GridSelectionCellInput,{key:1,selected:C}),o=a.getClientCellProps(e),c=d.getCustomCell(e);if(c){const S=a.isClientReference(c);return l.createElement(u.GridSelectionCellServerContainer,{cellProps:o,tdProps:t,isCustom:!0,isClient:S},l.createElement(c,{...o,tdProps:t},i))}const p=e.rowType!=="groupHeader"?l.createElement("td",{...t},i):null;return l.createElement(u.GridSelectionCellServerContainer,{cellProps:o,tdProps:t},p)};exports.GridSelectionCellServer=b;
|
|
@@ -6,28 +6,30 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
import { getNestedValue as C } from "@progress/kendo-react-common";
|
|
10
|
+
import { GridSelectionCellInput as u } from "./GridSelectionCellInput.mjs";
|
|
11
|
+
import { GridSelectionCellServerContainer as i } from "./GridSelectionCellServerContainer.mjs";
|
|
12
|
+
import { getClientCellProps as f, isClientReference as P } from "../../utils/index.mjs";
|
|
13
|
+
import { getSelectionCellTdProps as S, getCustomCell as g } from "./utils.mjs";
|
|
14
|
+
const I = (m) => {
|
|
15
|
+
var s;
|
|
16
|
+
const { cellProps: e } = m, { tdProps: l } = S(e), n = (s = e.isSelected) != null ? s : C(e.field, e.dataItem), p = typeof n == "boolean" && n, c = /* @__PURE__ */ t.createElement(u, { key: 1, selected: p }), o = f(e), r = g(e);
|
|
17
|
+
if (r) {
|
|
18
|
+
const d = P(r);
|
|
17
19
|
return /* @__PURE__ */ t.createElement(
|
|
18
|
-
|
|
20
|
+
i,
|
|
19
21
|
{
|
|
20
|
-
cellProps:
|
|
21
|
-
tdProps:
|
|
22
|
+
cellProps: o,
|
|
23
|
+
tdProps: l,
|
|
22
24
|
isCustom: !0,
|
|
23
|
-
isClient:
|
|
25
|
+
isClient: d
|
|
24
26
|
},
|
|
25
|
-
/* @__PURE__ */ t.createElement(
|
|
27
|
+
/* @__PURE__ */ t.createElement(r, { ...o, tdProps: l }, c)
|
|
26
28
|
);
|
|
27
29
|
}
|
|
28
|
-
const
|
|
29
|
-
return /* @__PURE__ */ t.createElement(
|
|
30
|
+
const a = e.rowType !== "groupHeader" ? /* @__PURE__ */ t.createElement("td", { ...l }, c) : null;
|
|
31
|
+
return /* @__PURE__ */ t.createElement(i, { cellProps: o, tdProps: l }, a);
|
|
30
32
|
};
|
|
31
33
|
export {
|
|
32
|
-
|
|
34
|
+
I as GridSelectionCellServer
|
|
33
35
|
};
|