@progress/kendo-react-grid 11.2.0 → 11.3.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/Grid.js +1 -1
- package/Grid.mjs +1 -0
- package/GridClientWrapper.js +1 -1
- package/GridClientWrapper.mjs +2 -0
- package/GridComponent.js +1 -1
- package/GridComponent.mjs +247 -244
- package/cells/datacell/utils.js +1 -1
- package/cells/datacell/utils.mjs +9 -9
- package/cells/rowreordercell/utils.js +1 -1
- package/cells/rowreordercell/utils.mjs +8 -8
- package/columnMenu/GridColumnMenuGroup.js +1 -1
- package/columnMenu/GridColumnMenuGroup.mjs +14 -13
- package/columnMenu/GridColumnMenuWrapper.js +1 -1
- package/columnMenu/GridColumnMenuWrapper.mjs +97 -82
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.d.mts +19 -0
- package/index.d.ts +19 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +16 -16
- package/rows/GridRow.js +1 -1
- package/rows/GridRow.mjs +19 -18
- package/utils/index.js +1 -1
- package/utils/index.mjs +64 -63
package/index.d.mts
CHANGED
|
@@ -2820,6 +2820,21 @@ export declare interface GridProps extends KendoReactComponentBaseProps {
|
|
|
2820
2820
|
* ```
|
|
2821
2821
|
*/
|
|
2822
2822
|
select?: SelectDescriptor;
|
|
2823
|
+
/**
|
|
2824
|
+
* The descriptor by which the highlight state of an item is defined.
|
|
2825
|
+
* Passing a boolean value will highlight the whole row, while passing an object will highlight individual cells by their field.
|
|
2826
|
+
*
|
|
2827
|
+
* @example
|
|
2828
|
+
* ```jsx
|
|
2829
|
+
* <Grid highlight={{ ['item-data-key-id']: true }} />
|
|
2830
|
+
* <Grid highlight={{ ['item-data-key-id']: { name: true } }} />
|
|
2831
|
+
* ```
|
|
2832
|
+
*/
|
|
2833
|
+
highlight?: {
|
|
2834
|
+
[id: string]: boolean | {
|
|
2835
|
+
[id: string]: boolean;
|
|
2836
|
+
};
|
|
2837
|
+
};
|
|
2823
2838
|
/**
|
|
2824
2839
|
* The default `select` state applied to the Grid when using uncontrolled mode.
|
|
2825
2840
|
*
|
|
@@ -3310,6 +3325,10 @@ export declare interface GridRowProps extends KendoReactComponentBaseProps {
|
|
|
3310
3325
|
* Indicates if the row is selected.
|
|
3311
3326
|
*/
|
|
3312
3327
|
isSelected: boolean;
|
|
3328
|
+
/**
|
|
3329
|
+
* @hidden
|
|
3330
|
+
*/
|
|
3331
|
+
isHighlighted?: boolean;
|
|
3313
3332
|
/**
|
|
3314
3333
|
* @hidden
|
|
3315
3334
|
*/
|
package/index.d.ts
CHANGED
|
@@ -2820,6 +2820,21 @@ export declare interface GridProps extends KendoReactComponentBaseProps {
|
|
|
2820
2820
|
* ```
|
|
2821
2821
|
*/
|
|
2822
2822
|
select?: SelectDescriptor;
|
|
2823
|
+
/**
|
|
2824
|
+
* The descriptor by which the highlight state of an item is defined.
|
|
2825
|
+
* Passing a boolean value will highlight the whole row, while passing an object will highlight individual cells by their field.
|
|
2826
|
+
*
|
|
2827
|
+
* @example
|
|
2828
|
+
* ```jsx
|
|
2829
|
+
* <Grid highlight={{ ['item-data-key-id']: true }} />
|
|
2830
|
+
* <Grid highlight={{ ['item-data-key-id']: { name: true } }} />
|
|
2831
|
+
* ```
|
|
2832
|
+
*/
|
|
2833
|
+
highlight?: {
|
|
2834
|
+
[id: string]: boolean | {
|
|
2835
|
+
[id: string]: boolean;
|
|
2836
|
+
};
|
|
2837
|
+
};
|
|
2823
2838
|
/**
|
|
2824
2839
|
* The default `select` state applied to the Grid when using uncontrolled mode.
|
|
2825
2840
|
*
|
|
@@ -3310,6 +3325,10 @@ export declare interface GridRowProps extends KendoReactComponentBaseProps {
|
|
|
3310
3325
|
* Indicates if the row is selected.
|
|
3311
3326
|
*/
|
|
3312
3327
|
isSelected: boolean;
|
|
3328
|
+
/**
|
|
3329
|
+
* @hidden
|
|
3330
|
+
*/
|
|
3331
|
+
isHighlighted?: boolean;
|
|
3313
3332
|
/**
|
|
3314
3333
|
* @hidden
|
|
3315
3334
|
*/
|
package/package-metadata.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 e={name:"@progress/kendo-react-grid",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-grid",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1752138531,version:"11.3.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -10,8 +10,8 @@ const e = {
|
|
|
10
10
|
productName: "KendoReact",
|
|
11
11
|
productCode: "KENDOUIREACT",
|
|
12
12
|
productCodes: ["KENDOUIREACT"],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: "11.
|
|
13
|
+
publishDate: 1752138531,
|
|
14
|
+
version: "11.3.0-develop.1",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
};
|
|
17
17
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-grid",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0-develop.1",
|
|
4
4
|
"description": "React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
"@progress/kendo-data-query": "^1.0.0",
|
|
29
29
|
"@progress/kendo-drawing": "^1.21.2",
|
|
30
30
|
"@progress/kendo-licensing": "^1.6.0",
|
|
31
|
-
"@progress/kendo-react-animation": "11.
|
|
32
|
-
"@progress/kendo-react-buttons": "11.
|
|
33
|
-
"@progress/kendo-react-common": "11.
|
|
34
|
-
"@progress/kendo-react-data-tools": "11.
|
|
35
|
-
"@progress/kendo-react-dateinputs": "11.
|
|
36
|
-
"@progress/kendo-react-indicators": "11.
|
|
37
|
-
"@progress/kendo-react-form": "11.
|
|
38
|
-
"@progress/kendo-react-labels": "11.
|
|
39
|
-
"@progress/kendo-react-dialogs": "11.
|
|
40
|
-
"@progress/kendo-react-dropdowns": "11.
|
|
41
|
-
"@progress/kendo-react-inputs": "11.
|
|
42
|
-
"@progress/kendo-react-intl": "11.
|
|
43
|
-
"@progress/kendo-react-popup": "11.
|
|
44
|
-
"@progress/kendo-react-layout": "11.
|
|
31
|
+
"@progress/kendo-react-animation": "11.3.0-develop.1",
|
|
32
|
+
"@progress/kendo-react-buttons": "11.3.0-develop.1",
|
|
33
|
+
"@progress/kendo-react-common": "11.3.0-develop.1",
|
|
34
|
+
"@progress/kendo-react-data-tools": "11.3.0-develop.1",
|
|
35
|
+
"@progress/kendo-react-dateinputs": "11.3.0-develop.1",
|
|
36
|
+
"@progress/kendo-react-indicators": "11.3.0-develop.1",
|
|
37
|
+
"@progress/kendo-react-form": "11.3.0-develop.1",
|
|
38
|
+
"@progress/kendo-react-labels": "11.3.0-develop.1",
|
|
39
|
+
"@progress/kendo-react-dialogs": "11.3.0-develop.1",
|
|
40
|
+
"@progress/kendo-react-dropdowns": "11.3.0-develop.1",
|
|
41
|
+
"@progress/kendo-react-inputs": "11.3.0-develop.1",
|
|
42
|
+
"@progress/kendo-react-intl": "11.3.0-develop.1",
|
|
43
|
+
"@progress/kendo-react-popup": "11.3.0-develop.1",
|
|
44
|
+
"@progress/kendo-react-layout": "11.3.0-develop.1",
|
|
45
45
|
"@progress/kendo-svg-icons": "^4.0.0",
|
|
46
46
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
47
47
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"package": {
|
|
146
146
|
"productName": "KendoReact",
|
|
147
147
|
"productCode": "KENDOUIREACT",
|
|
148
|
-
"publishDate":
|
|
148
|
+
"publishDate": 1752138531,
|
|
149
149
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
150
150
|
}
|
|
151
151
|
},
|
package/rows/GridRow.js
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),a=require("@progress/kendo-react-common"),
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),a=require("@progress/kendo-react-common"),v=require("../constants/index.js"),O=require("../utils/GridContext.js");function S(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const c=S(k),G=e=>{var w;const r=c.useContext(O.GridContext),{reorderRowDropTargetRef:n,reorderRowDragTargetRef:t,activeDragRowDataItemRef:R}=r,{rowType:i,isAltRow:b,isInEdit:f,isSelected:m,isHighlighted:y}=e,d=a.useUnstyled(),D=d&&d.uGrid?d.uGrid:a.uGrid,h=a.classNames(D.tr({selected:m,highlighted:y,isHeader:i==="groupHeader",isFooter:i==="groupFooter",isMaster:i!=="groupHeader"&&i!=="groupFooter",isAltRow:b,isInEdit:f})),s=c.useRef(null),x=o=>{if(e.isRowReorderable&&R.current){const T=o.originalEvent.target;n.current=T.closest(".k-table-row")}},I=()=>{t.current&&e.isRowReorderable&&(t.current.style.userSelect="")};a.useDroppable(s,{onDragOver:x,onDrop:I});const C={onClick:o=>r.rowClick(o,e.dataItem),onDoubleClick:o=>r.rowDblClick(o,e.dataItem)},u={ref:s,id:e.id,...C,className:h,style:{height:e.rowHeight?e.rowHeight+"px":"",visibility:e.isHidden?"hidden":"",userSelect:(w=t==null?void 0:t.current)==null?void 0:w.style.userSelect},role:"row","aria-rowindex":e.ariaRowIndex,"absolute-row-index":e.absoluteRowIndex,[v.GRID_ROW_INDEX_ATTRIBUTE]:e.rowType==="data"?e.dataIndex:void 0},g=e.rowType||"data",l=e.rows;if(l&&l[g]){const o=l[g];return c.createElement(o,{key:e.absoluteRowIndex,...e,trProps:u},e.children)}return c.createElement("tr",{key:e.absoluteRowIndex,...u},e.children)};exports.GridRow=G;
|
package/rows/GridRow.mjs
CHANGED
|
@@ -6,27 +6,28 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import { useUnstyled as b, uGrid as
|
|
11
|
-
import { GRID_ROW_INDEX_ATTRIBUTE as
|
|
12
|
-
import { GridContext as
|
|
13
|
-
const
|
|
9
|
+
import * as i from "react";
|
|
10
|
+
import { useUnstyled as b, uGrid as C, classNames as T, useDroppable as k } from "@progress/kendo-react-common";
|
|
11
|
+
import { GRID_ROW_INDEX_ATTRIBUTE as v } from "../constants/index.mjs";
|
|
12
|
+
import { GridContext as H } from "../utils/GridContext.mjs";
|
|
13
|
+
const N = (e) => {
|
|
14
14
|
var u;
|
|
15
|
-
const
|
|
15
|
+
const a = i.useContext(H), {
|
|
16
16
|
reorderRowDropTargetRef: w,
|
|
17
17
|
reorderRowDragTargetRef: r,
|
|
18
18
|
activeDragRowDataItemRef: R
|
|
19
|
-
} =
|
|
19
|
+
} = a, { rowType: o, isAltRow: g, isInEdit: m, isSelected: h, isHighlighted: D } = e, n = b(), f = n && n.uGrid ? n.uGrid : C, I = T(
|
|
20
20
|
f.tr({
|
|
21
|
-
selected:
|
|
21
|
+
selected: h,
|
|
22
|
+
highlighted: D,
|
|
22
23
|
isHeader: o === "groupHeader",
|
|
23
24
|
isFooter: o === "groupFooter",
|
|
24
25
|
isMaster: o !== "groupHeader" && o !== "groupFooter",
|
|
25
26
|
isAltRow: g,
|
|
26
27
|
isInEdit: m
|
|
27
28
|
})
|
|
28
|
-
),
|
|
29
|
-
|
|
29
|
+
), l = i.useRef(null);
|
|
30
|
+
k(l, {
|
|
30
31
|
onDragOver: (t) => {
|
|
31
32
|
if (e.isRowReorderable && R.current) {
|
|
32
33
|
const y = t.originalEvent.target;
|
|
@@ -38,10 +39,10 @@ const F = (e) => {
|
|
|
38
39
|
}
|
|
39
40
|
});
|
|
40
41
|
const x = {
|
|
41
|
-
onClick: (t) =>
|
|
42
|
-
onDoubleClick: (t) =>
|
|
43
|
-
},
|
|
44
|
-
ref:
|
|
42
|
+
onClick: (t) => a.rowClick(t, e.dataItem),
|
|
43
|
+
onDoubleClick: (t) => a.rowDblClick(t, e.dataItem)
|
|
44
|
+
}, c = {
|
|
45
|
+
ref: l,
|
|
45
46
|
id: e.id,
|
|
46
47
|
...x,
|
|
47
48
|
className: I,
|
|
@@ -53,14 +54,14 @@ const F = (e) => {
|
|
|
53
54
|
role: "row",
|
|
54
55
|
"aria-rowindex": e.ariaRowIndex,
|
|
55
56
|
"absolute-row-index": e.absoluteRowIndex,
|
|
56
|
-
[
|
|
57
|
+
[v]: e.rowType === "data" ? e.dataIndex : void 0
|
|
57
58
|
}, s = e.rowType || "data", d = e.rows;
|
|
58
59
|
if (d && d[s]) {
|
|
59
60
|
const t = d[s];
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
+
return /* @__PURE__ */ i.createElement(t, { key: e.absoluteRowIndex, ...e, trProps: c }, e.children);
|
|
61
62
|
}
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ i.createElement("tr", { key: e.absoluteRowIndex, ...c }, e.children);
|
|
63
64
|
};
|
|
64
65
|
export {
|
|
65
|
-
|
|
66
|
+
N as GridRow
|
|
66
67
|
};
|
package/utils/index.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 A=require("react"),w=require("../GridColumn.js"),S=require("@progress/kendo-data-query"),I=require("@progress/kendo-react-data-tools"),G=require("./_serverModule.js"),O=require("./_clientModule.js"),c=require("../contextMenu/enums.js"),T=require("@progress/kendo-react-common");function
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react"),w=require("../GridColumn.js"),S=require("@progress/kendo-data-query"),I=require("@progress/kendo-react-data-tools"),G=require("./_serverModule.js"),O=require("./_clientModule.js"),c=require("../contextMenu/enums.js"),T=require("@progress/kendo-react-common");function H(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const y=H(A);function j(e,t){const n=(e!=null?e:"").split(".");let r=t;return n.forEach(d=>{r=r?r[d]:void 0}),r}function v(e,t,n,r,d,l,a,i,o,s=0,f){var u;let g=s;for(let h=0;h<t.length;h++){let x;if(!d||t[h].value===void 0||t[h].items===void 0){e[e.length]={dataIndex:r.index,dataItem:t[h],rowType:"data",level:s,group:f,expanded:(u=o?!!(l!=null&&l[S.getter(o)(t[h])]):!1)!=null?u:!1},r.index++;continue}else{let m;f!=null&&f.parents?m=[{field:f.field,value:f.value},...f.parents]:f?m=[f]:m=[],x={field:t[h].field,value:t[h].value,parents:m}}g=Math.max(g,s+1);let C=!1;const M=I.findGroupExpand(a||[],x);M?C=M.expanded!==!1:C=i!==!1,e[e.length]={dataIndex:-1,dataItem:t[h],level:s,group:x,rowType:"groupHeader",expanded:C},C&&(x.expanded=C,g=Math.max(v(e,t[h].items,n,r,d,l,a,i,o,s+1,x),g)),(n==="always"||C&&n==="visible")&&(e[e.length]={dataIndex:-1,dataItem:t[h],rowType:"groupFooter",level:s,expanded:C})}return g}const q=(e,t)=>typeof e.colSpan=="function"?e.colSpan({dataItem:t,column:e}):e.colSpan||1;function k(e,t){const n=[[]];let r=0;for(let a=e.length-1;a>=0;a--)r=Math.max(r,e[a].depth),e[a].headerColSpan=e[a].headerColSpan||1,e[a].children.length>0&&(e[a].headerColSpan=e[a].children.reduce((i,o)=>o.hidden?i:i+o.headerColSpan,0));const d=[];let l=1;return e.forEach((a,i)=>{n[a.depth]=n[a.depth]||[];let o=!1;n[a.depth].length===0&&(l<=1?l=1+(a.children.length>0?0:r-a.depth):(l--,o=!0)),a.rowSpan=1+(a.children.length>0?0:r-a.depth),a.kFirst=o,a.index=n[a.depth].length,n[a.depth].push(i),a.ariaColumnIndex=d[a.depth]?d[a.depth]+1:1;for(let s=a.depth;s<a.depth+a.rowSpan;s++)d[s]=(d[s]||0)+a.headerColSpan}),I.updateLeft(n,e,t),I.updateRight(n,e,t),n}function N(e,t,n,r=0,d=!1){const l=[];if(!e)return[];e&&e.length===void 0&&(e=[e]),e.forEach((i,o)=>{i=i.props?i.props:i;const s=i.id?i.id:I.tableKeyboardNavigationTools.generateNavigatableId(`${n.prevId++}`,n.idPrefix,"column"),f=T.canUseDOM&&i.media&&window.matchMedia?!window.matchMedia(i.media).matches:!1,g=d||f||i.hidden,u=t==null?void 0:t.find(x=>x.id===s),h=N(i.children,(u==null?void 0:u.children)||[],n,r+1,g);l.push(Object.assign({depth:r},w.gridDefaultProps,h.length?{cell:()=>null,filterCell:()=>null}:{},i,{id:s,declarationIndex:l.length,children:h,headerColSpan:0,rowSpan:0,columnType:i.columnType||"data",colSpan:i.colSpan||1,isAccessible:!0,hidden:g,left:null,right:null,rowSpannable:i.rowSpannable},u?{width:u.width,orderIndex:u.orderIndex}:{}))});const a=(i,o)=>i.orderIndex===o.orderIndex?i.declarationIndex-o.declarationIndex:(i.orderIndex||0)-(o.orderIndex||0);if(l.sort(a),r===0){const i=[],o=(s,f)=>s.forEach(g=>{g.parentIndex=f,o(g.children,i.push(g)-1)});return o(l,-1),i}return l}const b=e=>Array.isArray(e)?e:e?e.data:[];function B(e,t,n,r){const d=b(e),l=[];if(d.length>0){let a=d[0];if(t)for(let o=0;o<t.length;o++)a=a.items&&a.items[0];Object.getOwnPropertyNames(a).forEach(o=>{o!==n.column&&l.push(Object.assign({id:I.tableKeyboardNavigationTools.generateNavigatableId(`${r.prevId++}`,r.idPrefix,"column"),declarationIndex:-1,parentIndex:-1,depth:0,colSpan:0,headerColSpan:0,rowSpan:0,index:0,columnType:"data",left:0,right:0,rightBorder:!1,children:[],ariaColumnIndex:0,isAccessible:!0},w.gridDefaultProps,{field:o}))})}return l}const _=(e,t)=>{var r;let n=e[t.parentIndex];for(;n;){if((r=n.cells)!=null&&r.footerCell)return!0;n=e[n.parentIndex]}return!1},$=e=>e.filter(t=>{var n;return _(e,t)?!1:!!((n=t.cells)!=null&&n.footerCell)||!(t.children&&t.children.length>0)}),z=e=>e.width!==void 0?Math.floor(parseFloat(e.width.toString()))+"px":void 0,V=(e,t)=>t&&t.filter(n=>n.field===e).length>0,D=e=>(e.sort((t,n)=>t.declarationIndex-n.declarationIndex),e.map(t=>{const{declarationIndex:n,parentIndex:r,depth:d,headerColSpan:l,rowSpan:a,index:i,kFirst:o,children:s,...f}=t;return s.length?{children:D(s),...f}:f})),R=e=>{const{cells:t,rowSpannable:n,defaultCell:r,...d}=e;return e.children.length?{...d,children:e.children.map(R)}:d},p=e=>({id:e.id,field:e.field,title:e.title,width:e.width,hidden:!1,children:e.children?E(e.children):null}),E=e=>e.map(p),L=e=>{const t=[],n=r=>r==null?void 0:r.forEach(d=>{t.push(d),n(d.children)});return n(e),t},P=typeof window!="undefined"&&/Firefox/.test(window.navigator.userAgent),W=17895697,K=e=>{let t=[];return e.sortable&&(t=t.concat([c.GridContextMenuItemNames.sortAsc,c.GridContextMenuItemNames.sortDesc])),e.pdf&&(t.length&&(t=t.concat([c.GridContextMenuItemNames.separator])),t=t.concat([c.GridContextMenuItemNames.exportPDF])),t},Q=e=>{let t=[];return e.clipboard&&(t=t.concat([c.GridContextMenuItemNames.copySelection,c.GridContextMenuItemNames.copySelectionNoHeaders,c.GridContextMenuItemNames.paste])),e.editable&&(t.length&&(t=t.concat([c.GridContextMenuItemNames.separator])),t=t.concat([c.GridContextMenuItemNames.create,c.GridContextMenuItemNames.edit,c.GridContextMenuItemNames.delete])),e.selectable&&(t.length&&(t=t.concat([c.GridContextMenuItemNames.separator])),t=t.concat([c.GridContextMenuItemNames.select])),e.rowReorderable&&(t.length&&(t=t.concat([c.GridContextMenuItemNames.separator])),t=t.concat([c.GridContextMenuItemNames.reorderRow])),e.pdf&&(t.length&&(t=t.concat([c.GridContextMenuItemNames.separator])),t=t.concat([c.GridContextMenuItemNames.exportPDF])),t},U=(e,t)=>{if(!(!e&&!t))return t?e?{...e,...t,select:{...e.select||{},...t.select||{}},hierarchy:{...e.hierarchy||{},...t.hierarchy||{}},group:{...e.group||{},...t.group||{}},edit:{...e.edit||{},...t.edit||{}}}:t:e},J=e=>{var n;return typeof e=="object"?(n=e.enabled)!=null?n:!0:e!=null?e:!1},X=()=>G.ServerFragment===O.ClientFragment,Y=e=>!!(e&&e.$$typeof===Symbol.for("react.client.reference")),Z=e=>({id:e.id,ariaColumnIndex:e.ariaColumnIndex,isSelected:e.isSelected,isHighlighted:e.isHighlighted,isInEdit:e.isInEdit,isSorted:e.isSorted,isAlt:e.isAlt,expanded:e.expanded,className:e.className,style:e.style,field:e.field,dataItem:e.dataItem,format:e.format,colSpan:e.colSpan,dataIndex:e.dataIndex,columnIndex:e.columnIndex,columnsCount:e.columnsCount,rowType:e.rowType,level:e.level,editor:e.editor,locked:e.locked,isRtl:e.isRtl,rowDataIndex:e.rowDataIndex,columnPosition:e.columnPosition,group:e.group}),ee=e=>{var r,d;const t=typeof e=="object"?(r=e.enabled)!=null?r:!0:e!=null?e:!1,n=typeof e=="object"?(d=e.valueGetter)!=null?d:(l,a)=>S.getter(a)(l):(l,a)=>S.getter(a)(l);return{enabled:t,valueGetter:n}},F=e=>{var t;return y.isValidElement(e)?e:(t=y.Children.toArray(e))==null?void 0:t[0]},te=(e,t)=>{const n=F(e);return n?y.cloneElement(n,t):null},ne=e=>{let t=0;if(e){const n=e.insertRow(0),r=n.insertCell(0);r.textContent=" ",t=n.getBoundingClientRect().height,e.deleteRow(0)}return t};exports.autoGenerateColumns=B;exports.calcRowHeight=ne;exports.clientColumn=R;exports.cloneReactElement=te;exports.firefox=P;exports.firefoxMaxHeight=W;exports.flatData=v;exports.footerColumns=$;exports.getClientCellProps=Z;exports.getColSpan=q;exports.getColumnState=p;exports.getColumnWidth=z;exports.getColumnsState=E;exports.getDataAsArray=b;exports.getDefaultBodyContextMenuItems=Q;exports.getDefaultHeadContextMenuItems=K;exports.getFlatColumnsState=L;exports.getNestedValue=j;exports.getReactElement=F;exports.getRowSpanOptions=ee;exports.isClient=X;exports.isClientReference=Y;exports.isRowReorderEnabled=J;exports.isSorted=V;exports.mapColumns=k;exports.readColumns=N;exports.resolveCells=U;exports.sanitizeColumns=D;
|
package/utils/index.mjs
CHANGED
|
@@ -15,41 +15,41 @@ import { GridContextMenuItemNames as f } from "../contextMenu/enums.mjs";
|
|
|
15
15
|
import { canUseDOM as A } from "@progress/kendo-react-common";
|
|
16
16
|
function J(e, t) {
|
|
17
17
|
const n = (e != null ? e : "").split(".");
|
|
18
|
-
let
|
|
18
|
+
let i = t;
|
|
19
19
|
return n.forEach((d) => {
|
|
20
|
-
|
|
21
|
-
}),
|
|
20
|
+
i = i ? i[d] : void 0;
|
|
21
|
+
}), i;
|
|
22
22
|
}
|
|
23
|
-
function R(e, t, n,
|
|
23
|
+
function R(e, t, n, i, d, o, r, a, l, c = 0, h) {
|
|
24
24
|
var x;
|
|
25
25
|
let g = c;
|
|
26
|
-
for (let
|
|
26
|
+
for (let s = 0; s < t.length; s++) {
|
|
27
27
|
let I;
|
|
28
|
-
if (!d || t[
|
|
28
|
+
if (!d || t[s].value === void 0 || t[s].items === void 0) {
|
|
29
29
|
e[e.length] = {
|
|
30
|
-
dataIndex:
|
|
31
|
-
dataItem: t[
|
|
30
|
+
dataIndex: i.index,
|
|
31
|
+
dataItem: t[s],
|
|
32
32
|
rowType: "data",
|
|
33
33
|
level: c,
|
|
34
|
-
group:
|
|
34
|
+
group: h,
|
|
35
35
|
// This is related to detail-row expansion
|
|
36
|
-
expanded: (x = l ? !!(o != null && o[y(l)(t[
|
|
37
|
-
},
|
|
36
|
+
expanded: (x = l ? !!(o != null && o[y(l)(t[s])]) : !1) != null ? x : !1
|
|
37
|
+
}, i.index++;
|
|
38
38
|
continue;
|
|
39
39
|
} else {
|
|
40
40
|
let S;
|
|
41
|
-
|
|
42
|
-
field: t[
|
|
43
|
-
value: t[
|
|
41
|
+
h != null && h.parents ? S = [{ field: h.field, value: h.value }, ...h.parents] : h ? S = [h] : S = [], I = {
|
|
42
|
+
field: t[s].field,
|
|
43
|
+
value: t[s].value,
|
|
44
44
|
parents: S
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
g = Math.max(g, c + 1);
|
|
48
48
|
let C = !1;
|
|
49
49
|
const u = F(r || [], I);
|
|
50
|
-
u ? C = u.expanded !== !1 : C =
|
|
50
|
+
u ? C = u.expanded !== !1 : C = a !== !1, e[e.length] = {
|
|
51
51
|
dataIndex: -1,
|
|
52
|
-
dataItem: t[
|
|
52
|
+
dataItem: t[s],
|
|
53
53
|
level: c,
|
|
54
54
|
group: I,
|
|
55
55
|
rowType: "groupHeader",
|
|
@@ -57,13 +57,13 @@ function R(e, t, n, a, d, o, r, i, l, c = 0, s) {
|
|
|
57
57
|
}, C && (I.expanded = C, g = Math.max(
|
|
58
58
|
R(
|
|
59
59
|
e,
|
|
60
|
-
t[
|
|
60
|
+
t[s].items,
|
|
61
61
|
n,
|
|
62
|
-
|
|
62
|
+
i,
|
|
63
63
|
d,
|
|
64
64
|
o,
|
|
65
65
|
r,
|
|
66
|
-
|
|
66
|
+
a,
|
|
67
67
|
l,
|
|
68
68
|
c + 1,
|
|
69
69
|
I
|
|
@@ -71,7 +71,7 @@ function R(e, t, n, a, d, o, r, i, l, c = 0, s) {
|
|
|
71
71
|
g
|
|
72
72
|
)), (n === "always" || C && n === "visible") && (e[e.length] = {
|
|
73
73
|
dataIndex: -1,
|
|
74
|
-
dataItem: t[
|
|
74
|
+
dataItem: t[s],
|
|
75
75
|
rowType: "groupFooter",
|
|
76
76
|
level: c,
|
|
77
77
|
expanded: C
|
|
@@ -82,65 +82,65 @@ function R(e, t, n, a, d, o, r, i, l, c = 0, s) {
|
|
|
82
82
|
const K = (e, t) => typeof e.colSpan == "function" ? e.colSpan({ dataItem: t, column: e }) : e.colSpan || 1;
|
|
83
83
|
function Q(e, t) {
|
|
84
84
|
const n = [[]];
|
|
85
|
-
let
|
|
85
|
+
let i = 0;
|
|
86
86
|
for (let r = e.length - 1; r >= 0; r--)
|
|
87
|
-
|
|
88
|
-
(
|
|
87
|
+
i = Math.max(i, e[r].depth), e[r].headerColSpan = e[r].headerColSpan || 1, e[r].children.length > 0 && (e[r].headerColSpan = e[r].children.reduce(
|
|
88
|
+
(a, l) => l.hidden ? a : a + l.headerColSpan,
|
|
89
89
|
0
|
|
90
90
|
));
|
|
91
91
|
const d = [];
|
|
92
92
|
let o = 1;
|
|
93
|
-
return e.forEach((r,
|
|
93
|
+
return e.forEach((r, a) => {
|
|
94
94
|
n[r.depth] = n[r.depth] || [];
|
|
95
95
|
let l = !1;
|
|
96
|
-
n[r.depth].length === 0 && (o <= 1 ? o = 1 + (r.children.length > 0 ? 0 :
|
|
96
|
+
n[r.depth].length === 0 && (o <= 1 ? o = 1 + (r.children.length > 0 ? 0 : i - r.depth) : (o--, l = !0)), r.rowSpan = 1 + (r.children.length > 0 ? 0 : i - r.depth), r.kFirst = l, r.index = n[r.depth].length, n[r.depth].push(a), r.ariaColumnIndex = d[r.depth] ? d[r.depth] + 1 : 1;
|
|
97
97
|
for (let c = r.depth; c < r.depth + r.rowSpan; c++)
|
|
98
98
|
d[c] = (d[c] || 0) + r.headerColSpan;
|
|
99
99
|
}), D(n, e, t), E(n, e, t), n;
|
|
100
100
|
}
|
|
101
|
-
function m(e, t, n,
|
|
101
|
+
function m(e, t, n, i = 0, d = !1) {
|
|
102
102
|
const o = [];
|
|
103
103
|
if (!e)
|
|
104
104
|
return [];
|
|
105
|
-
e && e.length === void 0 && (e = [e]), e.forEach((
|
|
106
|
-
|
|
107
|
-
const c =
|
|
105
|
+
e && e.length === void 0 && (e = [e]), e.forEach((a, l) => {
|
|
106
|
+
a = a.props ? a.props : a;
|
|
107
|
+
const c = a.id ? a.id : p.generateNavigatableId(`${n.prevId++}`, n.idPrefix, "column"), h = A && a.media && window.matchMedia ? !window.matchMedia(a.media).matches : !1, g = d || h || a.hidden, x = t == null ? void 0 : t.find((I) => I.id === c), s = m(a.children, (x == null ? void 0 : x.children) || [], n, i + 1, g);
|
|
108
108
|
o.push(
|
|
109
109
|
Object.assign(
|
|
110
|
-
{ depth:
|
|
110
|
+
{ depth: i },
|
|
111
111
|
v,
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
s.length ? { cell: () => null, filterCell: () => null } : {},
|
|
113
|
+
a,
|
|
114
114
|
{
|
|
115
115
|
id: c,
|
|
116
116
|
declarationIndex: o.length,
|
|
117
|
-
children:
|
|
117
|
+
children: s,
|
|
118
118
|
headerColSpan: 0,
|
|
119
119
|
rowSpan: 0,
|
|
120
|
-
columnType:
|
|
121
|
-
colSpan:
|
|
120
|
+
columnType: a.columnType || "data",
|
|
121
|
+
colSpan: a.colSpan || 1,
|
|
122
122
|
isAccessible: !0,
|
|
123
123
|
hidden: g,
|
|
124
124
|
left: null,
|
|
125
125
|
right: null,
|
|
126
|
-
rowSpannable:
|
|
126
|
+
rowSpannable: a.rowSpannable
|
|
127
127
|
},
|
|
128
128
|
x ? { width: x.width, orderIndex: x.orderIndex } : {}
|
|
129
129
|
)
|
|
130
130
|
);
|
|
131
131
|
});
|
|
132
|
-
const r = (
|
|
133
|
-
if (o.sort(r),
|
|
134
|
-
const
|
|
135
|
-
g.parentIndex =
|
|
132
|
+
const r = (a, l) => a.orderIndex === l.orderIndex ? a.declarationIndex - l.declarationIndex : (a.orderIndex || 0) - (l.orderIndex || 0);
|
|
133
|
+
if (o.sort(r), i === 0) {
|
|
134
|
+
const a = [], l = (c, h) => c.forEach((g) => {
|
|
135
|
+
g.parentIndex = h, l(g.children, a.push(g) - 1);
|
|
136
136
|
});
|
|
137
|
-
return l(o, -1),
|
|
137
|
+
return l(o, -1), a;
|
|
138
138
|
}
|
|
139
139
|
return o;
|
|
140
140
|
}
|
|
141
|
-
const
|
|
142
|
-
function X(e, t, n,
|
|
143
|
-
const d =
|
|
141
|
+
const H = (e) => Array.isArray(e) ? e : e ? e.data : [];
|
|
142
|
+
function X(e, t, n, i) {
|
|
143
|
+
const d = H(e), o = [];
|
|
144
144
|
if (d.length > 0) {
|
|
145
145
|
let r = d[0];
|
|
146
146
|
if (t)
|
|
@@ -150,7 +150,7 @@ function X(e, t, n, a) {
|
|
|
150
150
|
l !== n.column && o.push(
|
|
151
151
|
Object.assign(
|
|
152
152
|
{
|
|
153
|
-
id: p.generateNavigatableId(`${
|
|
153
|
+
id: p.generateNavigatableId(`${i.prevId++}`, i.idPrefix, "column"),
|
|
154
154
|
declarationIndex: -1,
|
|
155
155
|
parentIndex: -1,
|
|
156
156
|
depth: 0,
|
|
@@ -174,26 +174,26 @@ function X(e, t, n, a) {
|
|
|
174
174
|
}
|
|
175
175
|
return o;
|
|
176
176
|
}
|
|
177
|
-
const
|
|
178
|
-
var
|
|
177
|
+
const T = (e, t) => {
|
|
178
|
+
var i;
|
|
179
179
|
let n = e[t.parentIndex];
|
|
180
180
|
for (; n; ) {
|
|
181
|
-
if ((
|
|
181
|
+
if ((i = n.cells) != null && i.footerCell)
|
|
182
182
|
return !0;
|
|
183
183
|
n = e[n.parentIndex];
|
|
184
184
|
}
|
|
185
185
|
return !1;
|
|
186
186
|
}, Y = (e) => e.filter((t) => {
|
|
187
187
|
var n;
|
|
188
|
-
return
|
|
188
|
+
return T(e, t) ? !1 : !!((n = t.cells) != null && n.footerCell) || !(t.children && t.children.length > 0);
|
|
189
189
|
}), Z = (e) => e.width !== void 0 ? Math.floor(parseFloat(e.width.toString())) + "px" : void 0, _ = (e, t) => t && t.filter((n) => n.field === e).length > 0, j = (e) => (e.sort((t, n) => t.declarationIndex - n.declarationIndex), e.map((t) => {
|
|
190
|
-
const { declarationIndex: n, parentIndex:
|
|
190
|
+
const { declarationIndex: n, parentIndex: i, depth: d, headerColSpan: o, rowSpan: r, index: a, kFirst: l, children: c, ...h } = t;
|
|
191
191
|
return c.length ? {
|
|
192
192
|
children: j(c),
|
|
193
|
-
...
|
|
194
|
-
} :
|
|
193
|
+
...h
|
|
194
|
+
} : h;
|
|
195
195
|
})), B = (e) => {
|
|
196
|
-
const { cells: t, rowSpannable: n, defaultCell:
|
|
196
|
+
const { cells: t, rowSpannable: n, defaultCell: i, ...d } = e;
|
|
197
197
|
return e.children.length ? {
|
|
198
198
|
...d,
|
|
199
199
|
children: e.children.map(B)
|
|
@@ -206,7 +206,7 @@ const H = (e, t) => {
|
|
|
206
206
|
hidden: !1,
|
|
207
207
|
children: e.children ? N(e.children) : null
|
|
208
208
|
}), N = (e) => e.map(O), P = (e) => {
|
|
209
|
-
const t = [], n = (
|
|
209
|
+
const t = [], n = (i) => i == null ? void 0 : i.forEach((d) => {
|
|
210
210
|
t.push(d), n(d.children);
|
|
211
211
|
});
|
|
212
212
|
return n(e), t;
|
|
@@ -246,13 +246,14 @@ const H = (e, t) => {
|
|
|
246
246
|
...t.edit || {}
|
|
247
247
|
}
|
|
248
248
|
} : t : e;
|
|
249
|
-
},
|
|
249
|
+
}, ie = (e) => {
|
|
250
250
|
var n;
|
|
251
251
|
return typeof e == "object" ? (n = e.enabled) != null ? n : !0 : e != null ? e : !1;
|
|
252
|
-
},
|
|
252
|
+
}, ae = () => M === b, de = (e) => !!(e && e.$$typeof === Symbol.for("react.client.reference")), le = (e) => ({
|
|
253
253
|
id: e.id,
|
|
254
254
|
ariaColumnIndex: e.ariaColumnIndex,
|
|
255
255
|
isSelected: e.isSelected,
|
|
256
|
+
isHighlighted: e.isHighlighted,
|
|
256
257
|
isInEdit: e.isInEdit,
|
|
257
258
|
isSorted: e.isSorted,
|
|
258
259
|
isAlt: e.isAlt,
|
|
@@ -275,8 +276,8 @@ const H = (e, t) => {
|
|
|
275
276
|
columnPosition: e.columnPosition,
|
|
276
277
|
group: e.group
|
|
277
278
|
}), oe = (e) => {
|
|
278
|
-
var
|
|
279
|
-
const t = typeof e == "object" ? (
|
|
279
|
+
var i, d;
|
|
280
|
+
const t = typeof e == "object" ? (i = e.enabled) != null ? i : !0 : e != null ? e : !1, n = typeof e == "object" ? (d = e.valueGetter) != null ? d : (o, r) => y(r)(o) : (o, r) => y(r)(o);
|
|
280
281
|
return { enabled: t, valueGetter: n };
|
|
281
282
|
}, k = (e) => {
|
|
282
283
|
var t;
|
|
@@ -287,8 +288,8 @@ const H = (e, t) => {
|
|
|
287
288
|
}, fe = (e) => {
|
|
288
289
|
let t = 0;
|
|
289
290
|
if (e) {
|
|
290
|
-
const n = e.insertRow(0),
|
|
291
|
-
|
|
291
|
+
const n = e.insertRow(0), i = n.insertCell(0);
|
|
292
|
+
i.textContent = " ", t = n.getBoundingClientRect().height, e.deleteRow(0);
|
|
292
293
|
}
|
|
293
294
|
return t;
|
|
294
295
|
};
|
|
@@ -306,16 +307,16 @@ export {
|
|
|
306
307
|
O as getColumnState,
|
|
307
308
|
Z as getColumnWidth,
|
|
308
309
|
N as getColumnsState,
|
|
309
|
-
|
|
310
|
+
H as getDataAsArray,
|
|
310
311
|
ne as getDefaultBodyContextMenuItems,
|
|
311
312
|
te as getDefaultHeadContextMenuItems,
|
|
312
313
|
P as getFlatColumnsState,
|
|
313
314
|
J as getNestedValue,
|
|
314
315
|
k as getReactElement,
|
|
315
316
|
oe as getRowSpanOptions,
|
|
316
|
-
|
|
317
|
+
ae as isClient,
|
|
317
318
|
de as isClientReference,
|
|
318
|
-
|
|
319
|
+
ie as isRowReorderEnabled,
|
|
319
320
|
_ as isSorted,
|
|
320
321
|
Q as mapColumns,
|
|
321
322
|
m as readColumns,
|