@progress/kendo-react-grid 9.4.0-develop.14 → 9.4.0-develop.15

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/index.d.mts CHANGED
@@ -252,6 +252,7 @@ declare interface ExtendedColumnProps extends GridColumnProps {
252
252
  isAccessible: boolean;
253
253
  /** @hidden _internal usage only */
254
254
  _type?: 'edit' | 'expand';
255
+ rowSpannable?: Required<GridRowSpannableSettings>;
255
256
  }
256
257
 
257
258
  /**
@@ -305,7 +306,7 @@ export declare const GRID_PREVENT_SELECTION_ELEMENT = "data-prevent-selection";
305
306
  /** The attribute required by the Grid selection on Grid `tr` elements. */
306
307
  export declare const GRID_ROW_INDEX_ATTRIBUTE = "data-grid-row-index";
307
308
 
308
- export declare const GridCell: (props: GridCellProps) => JSX_2.Element;
309
+ export declare const GridCell: (props: GridCellProps) => JSX_2.Element | null;
309
310
 
310
311
  /**
311
312
  * Represents the `GridCellBaseOptions` object that are passed to the handler.
@@ -410,6 +411,11 @@ export declare interface GridCellProps extends Omit<CellProps, 'onChange' | 'ren
410
411
  localization?: LocalizationService;
411
412
  /** @hidden */
412
413
  intl?: IntlService;
414
+ /** @hidden */
415
+ _rowSpan?: {
416
+ count: number | null;
417
+ value: any;
418
+ };
413
419
  }
414
420
 
415
421
  /**
@@ -1096,6 +1102,10 @@ export declare interface GridColumnProps extends Omit<ColumnBaseProps, 'cell'> {
1096
1102
  * @default "data"
1097
1103
  */
1098
1104
  columnType?: GridColumnType;
1105
+ /**
1106
+ * Defines if the cells of the column should be spanned when their values are the same.
1107
+ */
1108
+ rowSpannable?: boolean | GridRowSpannableSettings;
1099
1109
  }
1100
1110
 
1101
1111
  /**
@@ -2433,6 +2443,10 @@ export declare interface GridProps extends KendoReactComponentBaseProps {
2433
2443
  * @hidden
2434
2444
  */
2435
2445
  unstyled?: GridClassStructure;
2446
+ /**
2447
+ * @hidden
2448
+ */
2449
+ rowSpannable?: boolean | GridRowSpannableSettings;
2436
2450
  }
2437
2451
 
2438
2452
  /**
@@ -2580,6 +2594,33 @@ export declare type GridRowReorderSettings = {
2580
2594
  dragClue?: string | ((dataItem: any) => React.ReactNode);
2581
2595
  };
2582
2596
 
2597
+ /**
2598
+ * Represents the settings for the row-spanning functionality of the Grid.
2599
+ *
2600
+ * @example
2601
+ *
2602
+ * ```tsx
2603
+ * <Grid
2604
+ * data={data}
2605
+ * rowSpannable={{
2606
+ * enabled: true,
2607
+ * valueGetter: (dataItem, field) => `${dataItem['id']} - ${dataItem[field]}`,
2608
+ * }}
2609
+ * />
2610
+ * ```
2611
+ */
2612
+ export declare type GridRowSpannableSettings = {
2613
+ /**
2614
+ * Determines if the row-spanning functionality is enabled or disabled
2615
+ */
2616
+ enabled?: boolean;
2617
+ /**
2618
+ * A function that returns the value of the cell that should span the row.
2619
+ * The value could be combined from multiple fields of the dataItem to create a unique identifier and prevent the cell from being row-spanned.
2620
+ */
2621
+ valueGetter?: (dataItem: any, field: string) => any;
2622
+ };
2623
+
2583
2624
  /**
2584
2625
  * The type of the GridRow component.
2585
2626
  *
package/index.d.ts CHANGED
@@ -252,6 +252,7 @@ declare interface ExtendedColumnProps extends GridColumnProps {
252
252
  isAccessible: boolean;
253
253
  /** @hidden _internal usage only */
254
254
  _type?: 'edit' | 'expand';
255
+ rowSpannable?: Required<GridRowSpannableSettings>;
255
256
  }
256
257
 
257
258
  /**
@@ -305,7 +306,7 @@ export declare const GRID_PREVENT_SELECTION_ELEMENT = "data-prevent-selection";
305
306
  /** The attribute required by the Grid selection on Grid `tr` elements. */
306
307
  export declare const GRID_ROW_INDEX_ATTRIBUTE = "data-grid-row-index";
307
308
 
308
- export declare const GridCell: (props: GridCellProps) => JSX_2.Element;
309
+ export declare const GridCell: (props: GridCellProps) => JSX_2.Element | null;
309
310
 
310
311
  /**
311
312
  * Represents the `GridCellBaseOptions` object that are passed to the handler.
@@ -410,6 +411,11 @@ export declare interface GridCellProps extends Omit<CellProps, 'onChange' | 'ren
410
411
  localization?: LocalizationService;
411
412
  /** @hidden */
412
413
  intl?: IntlService;
414
+ /** @hidden */
415
+ _rowSpan?: {
416
+ count: number | null;
417
+ value: any;
418
+ };
413
419
  }
414
420
 
415
421
  /**
@@ -1096,6 +1102,10 @@ export declare interface GridColumnProps extends Omit<ColumnBaseProps, 'cell'> {
1096
1102
  * @default "data"
1097
1103
  */
1098
1104
  columnType?: GridColumnType;
1105
+ /**
1106
+ * Defines if the cells of the column should be spanned when their values are the same.
1107
+ */
1108
+ rowSpannable?: boolean | GridRowSpannableSettings;
1099
1109
  }
1100
1110
 
1101
1111
  /**
@@ -2433,6 +2443,10 @@ export declare interface GridProps extends KendoReactComponentBaseProps {
2433
2443
  * @hidden
2434
2444
  */
2435
2445
  unstyled?: GridClassStructure;
2446
+ /**
2447
+ * @hidden
2448
+ */
2449
+ rowSpannable?: boolean | GridRowSpannableSettings;
2436
2450
  }
2437
2451
 
2438
2452
  /**
@@ -2580,6 +2594,33 @@ export declare type GridRowReorderSettings = {
2580
2594
  dragClue?: string | ((dataItem: any) => React.ReactNode);
2581
2595
  };
2582
2596
 
2597
+ /**
2598
+ * Represents the settings for the row-spanning functionality of the Grid.
2599
+ *
2600
+ * @example
2601
+ *
2602
+ * ```tsx
2603
+ * <Grid
2604
+ * data={data}
2605
+ * rowSpannable={{
2606
+ * enabled: true,
2607
+ * valueGetter: (dataItem, field) => `${dataItem['id']} - ${dataItem[field]}`,
2608
+ * }}
2609
+ * />
2610
+ * ```
2611
+ */
2612
+ export declare type GridRowSpannableSettings = {
2613
+ /**
2614
+ * Determines if the row-spanning functionality is enabled or disabled
2615
+ */
2616
+ enabled?: boolean;
2617
+ /**
2618
+ * A function that returns the value of the cell that should span the row.
2619
+ * The value could be combined from multiple fields of the dataItem to create a unique identifier and prevent the cell from being row-spanned.
2620
+ */
2621
+ valueGetter?: (dataItem: any, field: string) => any;
2622
+ };
2623
+
2583
2624
  /**
2584
2625
  * The type of the GridRow component.
2585
2626
  *
@@ -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: 1738750850,version:"9.4.0-develop.14",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-grid",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1738772450,version:"9.4.0-develop.15",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
@@ -10,8 +10,8 @@ const e = {
10
10
  productName: "KendoReact",
11
11
  productCode: "KENDOUIREACT",
12
12
  productCodes: ["KENDOUIREACT"],
13
- publishDate: 1738750850,
14
- version: "9.4.0-develop.14",
13
+ publishDate: 1738772450,
14
+ version: "9.4.0-develop.15",
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": "9.4.0-develop.14",
3
+ "version": "9.4.0-develop.15",
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,17 +28,17 @@
28
28
  "@progress/kendo-data-query": "^1.0.0",
29
29
  "@progress/kendo-drawing": "^1.21.2",
30
30
  "@progress/kendo-licensing": "^1.3.4",
31
- "@progress/kendo-react-animation": "9.4.0-develop.14",
32
- "@progress/kendo-react-buttons": "9.4.0-develop.14",
33
- "@progress/kendo-react-common": "9.4.0-develop.14",
34
- "@progress/kendo-react-data-tools": "9.4.0-develop.14",
35
- "@progress/kendo-react-dateinputs": "9.4.0-develop.14",
36
- "@progress/kendo-react-indicators": "9.4.0-develop.14",
37
- "@progress/kendo-react-dropdowns": "9.4.0-develop.14",
38
- "@progress/kendo-react-inputs": "9.4.0-develop.14",
39
- "@progress/kendo-react-intl": "9.4.0-develop.14",
40
- "@progress/kendo-react-popup": "9.4.0-develop.14",
41
- "@progress/kendo-react-layout": "9.4.0-develop.14",
31
+ "@progress/kendo-react-animation": "9.4.0-develop.15",
32
+ "@progress/kendo-react-buttons": "9.4.0-develop.15",
33
+ "@progress/kendo-react-common": "9.4.0-develop.15",
34
+ "@progress/kendo-react-data-tools": "9.4.0-develop.15",
35
+ "@progress/kendo-react-dateinputs": "9.4.0-develop.15",
36
+ "@progress/kendo-react-indicators": "9.4.0-develop.15",
37
+ "@progress/kendo-react-dropdowns": "9.4.0-develop.15",
38
+ "@progress/kendo-react-inputs": "9.4.0-develop.15",
39
+ "@progress/kendo-react-intl": "9.4.0-develop.15",
40
+ "@progress/kendo-react-popup": "9.4.0-develop.15",
41
+ "@progress/kendo-react-layout": "9.4.0-develop.15",
42
42
  "@progress/kendo-svg-icons": "^4.0.0",
43
43
  "react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
44
44
  "react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
@@ -84,7 +84,7 @@
84
84
  "package": {
85
85
  "productName": "KendoReact",
86
86
  "productCode": "KENDOUIREACT",
87
- "publishDate": 1738750850,
87
+ "publishDate": 1738772450,
88
88
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
89
89
  }
90
90
  },
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 M=require("../GridColumn.js"),D=require("@progress/kendo-data-query"),S=require("@progress/kendo-react-data-tools"),T=require("./_serverModule.js"),k=require("./_clientModule.js"),x=require("../contextMenu/enums.js");function m(e,t){const a=(e!=null?e:"").split(".");let l=t;return a.forEach(o=>{l=l?l[o]:void 0}),l}function v(e,t,a,l,o,s,n,r,i,d,f=0,h){var y;let u=f;for(let c=0;c<t.length;c++){let I;if(!o||t[c].value===void 0||t[c].items===void 0){e[e.length]={dataIndex:l.index,dataItem:t[c],rowType:"data",level:f,group:h,expanded:(y=s?m(s,t[c]):d&&!!(n!=null&&n[D.getter(d)(t[c])]))!=null?y:!1},l.index++;continue}else{let g;h!=null&&h.parents?g=[{field:h.field,value:h.value},...h.parents]:h?g=[h]:g=[],I={field:t[c].field,value:t[c].value,parents:g}}u=Math.max(u,f+1);let C=!1;if(s)C=m(s,t[c])!==!1;else{const g=S.findGroupExpand(r||[],I);g?C=g.expanded!==!1:C=i!==!1}e[e.length]={dataIndex:-1,dataItem:t[c],level:f,group:I,rowType:"groupHeader",expanded:C},C&&(I.expanded=C,u=Math.max(v(e,t[c].items,a,l,o,s,n,r,i,d,f+1,I),u)),(a==="always"||C&&a==="visible")&&(e[e.length]={dataIndex:-1,dataItem:t[c],rowType:"groupFooter",level:f,expanded:C})}return u}const A=(e,t)=>typeof e.colSpan=="function"?e.colSpan({dataItem:t,column:e}):e.colSpan||1;function B(e,t){const a=[[]];let l=0;for(let n=e.length-1;n>=0;n--)l=Math.max(l,e[n].depth),e[n].headerColSpan=e[n].headerColSpan||1,e[n].children.length>0&&(e[n].headerColSpan=e[n].children.reduce((r,i)=>i.hidden?r:r+i.headerColSpan,0));const o=[];let s=1;return e.forEach((n,r)=>{a[n.depth]=a[n.depth]||[];let i=!1;a[n.depth].length===0&&(s<=1?s=1+(n.children.length>0?0:l-n.depth):(s--,i=!0)),n.rowSpan=1+(n.children.length>0?0:l-n.depth),n.kFirst=i,n.index=a[n.depth].length,a[n.depth].push(r),n.ariaColumnIndex=o[n.depth]?o[n.depth]+1:1;for(let d=n.depth;d<n.depth+n.rowSpan;d++)o[d]=(o[d]||0)+n.headerColSpan}),S.updateLeft(a,e,t),S.updateRight(a,e,t),a}function w(e,t,a,l=0){const o=[];if(!e)return[];e&&e.length===void 0&&(e=[e]),e.filter(r=>r&&r.props?!r.props.hidden:!r.hidden).forEach((r,i)=>{r=r.props?r.props:r;const d=t[i]||null,f=w(r.children,d&&d.children||[],a,l+1);o.push(Object.assign({depth:l},M.gridDefaultProps,f.length?{cell:()=>null,filterCell:()=>null}:{},d?{width:d.width,orderIndex:d.orderIndex}:{},r,{id:r.id?r.id:S.tableKeyboardNavigationTools.generateNavigatableId(`${a.prevId++}`,a.idPrefix,"column"),declarationIndex:o.length,children:f,headerColSpan:r.headerColSpan,rowSpan:0,columnType:r.columnType||"data",colSpan:r.colSpan||1,isAccessible:!0,left:r.lockedColumn?d&&Math.floor(d.left):null,right:r.lockedColumn?d&&Math.floor(d.right):null}))});const n=(r,i)=>r.orderIndex===i.orderIndex?r.declarationIndex-i.declarationIndex:(r.orderIndex||0)-(i.orderIndex||0);if(o.sort(n),l===0){const r=[],i=(d,f)=>d.forEach(h=>{h.parentIndex=f,i(h.children,r.push(h)-1)});return i(o,-1),r}return o}function q(e,t,a,l){let o=[];Array.isArray(e)?o=e:e&&(o=e.data);const s=[];if(o.length>0){let n=o[0];if(t)for(let i=0;i<t.length;i++)n=n.items&&n.items[0];Object.getOwnPropertyNames(n).forEach(i=>{i!==a.column&&s.push(Object.assign({id:S.tableKeyboardNavigationTools.generateNavigatableId(`${l.prevId++}`,l.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},M.gridDefaultProps,{field:i}))})}return s}const G=(e,t)=>{let a=e[t.parentIndex];for(;a;){if(a.footerCell)return!0;a=e[a.parentIndex]}return!1},R=e=>e.filter(t=>G(e,t)?!1:!!t.footerCell||!(t.children&&t.children.length>0)),E=e=>e.width!==void 0?Math.floor(parseFloat(e.width.toString()))+"px":void 0,F=(e,t)=>t&&t.filter(a=>a.field===e).length>0,b=e=>(e.sort((t,a)=>t.declarationIndex-a.declarationIndex),e.map(t=>{const{declarationIndex:a,parentIndex:l,depth:o,headerColSpan:s,rowSpan:n,index:r,kFirst:i,children:d,...f}=t;return d.length?{children:b(d),...f}:f})),N=e=>{const{filterCell:t,headerCell:a,footerCell:l,cells:o,cell:s,...n}=e;return e.children.length?{...n,children:e.children.map(N)}:n},H=typeof window!="undefined"&&/Firefox/.test(window.navigator.userAgent),O=17895697,j=e=>{let t=[];return e.sortable&&(t=t.concat([x.GridContextMenuItemNames.sortAsc,x.GridContextMenuItemNames.sortDesc])),t},p=e=>{let t=[];return e.clipboard&&(t=t.concat([x.GridContextMenuItemNames.copySelection,x.GridContextMenuItemNames.copySelectionNoHeaders,x.GridContextMenuItemNames.paste])),e.editable&&(t.length&&(t=t.concat([x.GridContextMenuItemNames.separator])),t=t.concat([x.GridContextMenuItemNames.create,x.GridContextMenuItemNames.edit,x.GridContextMenuItemNames.delete])),e.selectable&&(t.length&&(t=t.concat([x.GridContextMenuItemNames.separator])),t=t.concat([x.GridContextMenuItemNames.select])),e.reorderable&&(t.length&&(t=t.concat([x.GridContextMenuItemNames.separator])),t=t.concat([x.GridContextMenuItemNames.reorderRow])),t},$=(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},z=()=>T.ServerFragment===k.ClientFragment,L=e=>!!(e&&e.$$typeof===Symbol.for("react.client.reference")),V=e=>({id:e.id,ariaColumnIndex:e.ariaColumnIndex,isSelected:e.isSelected,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,render:e.render,locked:e.locked,isRtl:e.isRtl,rowDataIndex:e.rowDataIndex,columnPosition:e.columnPosition,group:e.group});exports.autoGenerateColumns=q;exports.clientColumn=N;exports.firefox=H;exports.firefoxMaxHeight=O;exports.flatData=v;exports.footerColumns=R;exports.getClientCellProps=V;exports.getColSpan=A;exports.getColumnWidth=E;exports.getDefaultBodyContextMenuItems=p;exports.getDefaultHeadContextMenuItems=j;exports.getNestedValue=m;exports.isClient=z;exports.isClientReference=L;exports.isSorted=F;exports.mapColumns=B;exports.readColumns=w;exports.resolveCells=$;exports.sanitizeColumns=b;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../GridColumn.js"),y=require("@progress/kendo-data-query"),S=require("@progress/kendo-react-data-tools"),T=require("./_serverModule.js"),G=require("./_clientModule.js"),x=require("../contextMenu/enums.js");function m(e,t){const a=(e!=null?e:"").split(".");let i=t;return a.forEach(d=>{i=i?i[d]:void 0}),i}function w(e,t,a,i,d,s,n,r,o,l,f=0,h){var M;let u=f;for(let c=0;c<t.length;c++){let I;if(!d||t[c].value===void 0||t[c].items===void 0){e[e.length]={dataIndex:i.index,dataItem:t[c],rowType:"data",level:f,group:h,expanded:(M=s?m(s,t[c]):l&&!!(n!=null&&n[y.getter(l)(t[c])]))!=null?M:!1},i.index++;continue}else{let C;h!=null&&h.parents?C=[{field:h.field,value:h.value},...h.parents]:h?C=[h]:C=[],I={field:t[c].field,value:t[c].value,parents:C}}u=Math.max(u,f+1);let g=!1;if(s)g=m(s,t[c])!==!1;else{const C=S.findGroupExpand(r||[],I);C?g=C.expanded!==!1:g=o!==!1}e[e.length]={dataIndex:-1,dataItem:t[c],level:f,group:I,rowType:"groupHeader",expanded:g},g&&(I.expanded=g,u=Math.max(w(e,t[c].items,a,i,d,s,n,r,o,l,f+1,I),u)),(a==="always"||g&&a==="visible")&&(e[e.length]={dataIndex:-1,dataItem:t[c],rowType:"groupFooter",level:f,expanded:g})}return u}const R=(e,t)=>typeof e.colSpan=="function"?e.colSpan({dataItem:t,column:e}):e.colSpan||1;function k(e,t){const a=[[]];let i=0;for(let n=e.length-1;n>=0;n--)i=Math.max(i,e[n].depth),e[n].headerColSpan=e[n].headerColSpan||1,e[n].children.length>0&&(e[n].headerColSpan=e[n].children.reduce((r,o)=>o.hidden?r:r+o.headerColSpan,0));const d=[];let s=1;return e.forEach((n,r)=>{a[n.depth]=a[n.depth]||[];let o=!1;a[n.depth].length===0&&(s<=1?s=1+(n.children.length>0?0:i-n.depth):(s--,o=!0)),n.rowSpan=1+(n.children.length>0?0:i-n.depth),n.kFirst=o,n.index=a[n.depth].length,a[n.depth].push(r),n.ariaColumnIndex=d[n.depth]?d[n.depth]+1:1;for(let l=n.depth;l<n.depth+n.rowSpan;l++)d[l]=(d[l]||0)+n.headerColSpan}),S.updateLeft(a,e,t),S.updateRight(a,e,t),a}function b(e,t,a,i=0){const d=[];if(!e)return[];e&&e.length===void 0&&(e=[e]),e.filter(r=>r&&r.props?!r.props.hidden:!r.hidden).forEach((r,o)=>{r=r.props?r.props:r;const l=t[o]||null,f=b(r.children,l&&l.children||[],a,i+1);d.push(Object.assign({depth:i},v.gridDefaultProps,f.length?{cell:()=>null,filterCell:()=>null}:{},l?{width:l.width,orderIndex:l.orderIndex}:{},r,{id:r.id?r.id:S.tableKeyboardNavigationTools.generateNavigatableId(`${a.prevId++}`,a.idPrefix,"column"),declarationIndex:d.length,children:f,headerColSpan:r.headerColSpan,rowSpan:0,columnType:r.columnType||"data",colSpan:r.colSpan||1,isAccessible:!0,left:r.lockedColumn?l&&Math.floor(l.left):null,right:r.lockedColumn?l&&Math.floor(l.right):null,rowSpannable:r.rowSpannable}))});const n=(r,o)=>r.orderIndex===o.orderIndex?r.declarationIndex-o.declarationIndex:(r.orderIndex||0)-(o.orderIndex||0);if(d.sort(n),i===0){const r=[],o=(l,f)=>l.forEach(h=>{h.parentIndex=f,o(h.children,r.push(h)-1)});return o(d,-1),r}return d}function A(e,t,a,i){let d=[];Array.isArray(e)?d=e:e&&(d=e.data);const s=[];if(d.length>0){let n=d[0];if(t)for(let o=0;o<t.length;o++)n=n.items&&n.items[0];Object.getOwnPropertyNames(n).forEach(o=>{o!==a.column&&s.push(Object.assign({id:S.tableKeyboardNavigationTools.generateNavigatableId(`${i.prevId++}`,i.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},v.gridDefaultProps,{field:o}))})}return s}const B=(e,t)=>{let a=e[t.parentIndex];for(;a;){if(a.footerCell)return!0;a=e[a.parentIndex]}return!1},q=e=>e.filter(t=>B(e,t)?!1:!!t.footerCell||!(t.children&&t.children.length>0)),O=e=>e.width!==void 0?Math.floor(parseFloat(e.width.toString()))+"px":void 0,j=(e,t)=>t&&t.filter(a=>a.field===e).length>0,N=e=>(e.sort((t,a)=>t.declarationIndex-a.declarationIndex),e.map(t=>{const{declarationIndex:a,parentIndex:i,depth:d,headerColSpan:s,rowSpan:n,index:r,kFirst:o,children:l,...f}=t;return l.length?{children:N(l),...f}:f})),D=e=>{const{filterCell:t,headerCell:a,footerCell:i,cells:d,cell:s,rowSpannable:n,...r}=e;return e.children.length?{...r,children:e.children.map(D)}:r},E=typeof window!="undefined"&&/Firefox/.test(window.navigator.userAgent),F=17895697,H=e=>{let t=[];return e.sortable&&(t=t.concat([x.GridContextMenuItemNames.sortAsc,x.GridContextMenuItemNames.sortDesc])),t},p=e=>{let t=[];return e.clipboard&&(t=t.concat([x.GridContextMenuItemNames.copySelection,x.GridContextMenuItemNames.copySelectionNoHeaders,x.GridContextMenuItemNames.paste])),e.editable&&(t.length&&(t=t.concat([x.GridContextMenuItemNames.separator])),t=t.concat([x.GridContextMenuItemNames.create,x.GridContextMenuItemNames.edit,x.GridContextMenuItemNames.delete])),e.selectable&&(t.length&&(t=t.concat([x.GridContextMenuItemNames.separator])),t=t.concat([x.GridContextMenuItemNames.select])),e.reorderable&&(t.length&&(t=t.concat([x.GridContextMenuItemNames.separator])),t=t.concat([x.GridContextMenuItemNames.reorderRow])),t},$=(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},z=()=>T.ServerFragment===G.ClientFragment,L=e=>!!(e&&e.$$typeof===Symbol.for("react.client.reference")),V=e=>({id:e.id,ariaColumnIndex:e.ariaColumnIndex,isSelected:e.isSelected,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,render:e.render,locked:e.locked,isRtl:e.isRtl,rowDataIndex:e.rowDataIndex,columnPosition:e.columnPosition,group:e.group}),W=e=>{var i,d;const t=typeof e=="object"?(i=e.enabled)!=null?i:!0:e!=null?e:!1,a=typeof e=="object"?(d=e.valueGetter)!=null?d:(s,n)=>y.getter(n)(s):(s,n)=>y.getter(n)(s);return{enabled:t,valueGetter:a}};exports.autoGenerateColumns=A;exports.clientColumn=D;exports.firefox=E;exports.firefoxMaxHeight=F;exports.flatData=w;exports.footerColumns=q;exports.getClientCellProps=V;exports.getColSpan=R;exports.getColumnWidth=O;exports.getDefaultBodyContextMenuItems=p;exports.getDefaultHeadContextMenuItems=H;exports.getNestedValue=m;exports.getRowSpanOptions=W;exports.isClient=z;exports.isClientReference=L;exports.isSorted=j;exports.mapColumns=k;exports.readColumns=b;exports.resolveCells=$;exports.sanitizeColumns=N;
package/utils/index.mjs CHANGED
@@ -5,160 +5,161 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { gridDefaultProps as v } from "../GridColumn.mjs";
9
- import { getter as u } from "@progress/kendo-data-query";
8
+ import { gridDefaultProps as u } from "../GridColumn.mjs";
9
+ import { getter as y } from "@progress/kendo-data-query";
10
10
  import { findGroupExpand as M, updateLeft as T, updateRight as A, tableKeyboardNavigationTools as b } from "@progress/kendo-react-data-tools";
11
11
  import { ServerFragment as D } from "./_serverModule.mjs";
12
12
  import { ClientFragment as B } from "./_clientModule.mjs";
13
- import { GridContextMenuItemNames as x } from "../contextMenu/enums.mjs";
14
- function y(e, t) {
15
- const n = (e != null ? e : "").split(".");
16
- let l = t;
17
- return n.forEach((o) => {
18
- l = l ? l[o] : void 0;
19
- }), l;
13
+ import { GridContextMenuItemNames as g } from "../contextMenu/enums.mjs";
14
+ function w(e, t) {
15
+ const a = (e != null ? e : "").split(".");
16
+ let i = t;
17
+ return a.forEach((d) => {
18
+ i = i ? i[d] : void 0;
19
+ }), i;
20
20
  }
21
- function k(e, t, n, l, o, f, r, a, i, d, h = 0, c) {
22
- var w;
23
- let S = h;
21
+ function k(e, t, a, i, d, f, r, n, l, o, h = 0, c) {
22
+ var v;
23
+ let C = h;
24
24
  for (let s = 0; s < t.length; s++) {
25
- let C;
26
- if (!o || t[s].value === void 0 || t[s].items === void 0) {
25
+ let S;
26
+ if (!d || t[s].value === void 0 || t[s].items === void 0) {
27
27
  e[e.length] = {
28
- dataIndex: l.index,
28
+ dataIndex: i.index,
29
29
  dataItem: t[s],
30
30
  rowType: "data",
31
31
  level: h,
32
32
  group: c,
33
33
  // This is related to detail-row expansion
34
- expanded: (w = f ? y(f, t[s]) : d && !!(r != null && r[u(d)(t[s])])) != null ? w : !1
35
- }, l.index++;
34
+ expanded: (v = f ? w(f, t[s]) : o && !!(r != null && r[y(o)(t[s])])) != null ? v : !1
35
+ }, i.index++;
36
36
  continue;
37
37
  } else {
38
38
  let I;
39
- c != null && c.parents ? I = [{ field: c.field, value: c.value }, ...c.parents] : c ? I = [c] : I = [], C = {
39
+ c != null && c.parents ? I = [{ field: c.field, value: c.value }, ...c.parents] : c ? I = [c] : I = [], S = {
40
40
  field: t[s].field,
41
41
  value: t[s].value,
42
42
  parents: I
43
43
  };
44
44
  }
45
- S = Math.max(S, h + 1);
46
- let g = !1;
45
+ C = Math.max(C, h + 1);
46
+ let x = !1;
47
47
  if (f)
48
- g = y(f, t[s]) !== !1;
48
+ x = w(f, t[s]) !== !1;
49
49
  else {
50
- const I = M(a || [], C);
51
- I ? g = I.expanded !== !1 : g = i !== !1;
50
+ const I = M(n || [], S);
51
+ I ? x = I.expanded !== !1 : x = l !== !1;
52
52
  }
53
53
  e[e.length] = {
54
54
  dataIndex: -1,
55
55
  dataItem: t[s],
56
56
  level: h,
57
- group: C,
57
+ group: S,
58
58
  rowType: "groupHeader",
59
- expanded: g
60
- }, g && (C.expanded = g, S = Math.max(
59
+ expanded: x
60
+ }, x && (S.expanded = x, C = Math.max(
61
61
  k(
62
62
  e,
63
63
  t[s].items,
64
- n,
65
- l,
66
- o,
67
- f,
68
- r,
69
64
  a,
70
65
  i,
71
66
  d,
67
+ f,
68
+ r,
69
+ n,
70
+ l,
71
+ o,
72
72
  h + 1,
73
- C
73
+ S
74
74
  ),
75
- S
76
- )), (n === "always" || g && n === "visible") && (e[e.length] = {
75
+ C
76
+ )), (a === "always" || x && a === "visible") && (e[e.length] = {
77
77
  dataIndex: -1,
78
78
  dataItem: t[s],
79
79
  rowType: "groupFooter",
80
80
  level: h,
81
- expanded: g
81
+ expanded: x
82
82
  });
83
83
  }
84
- return S;
84
+ return C;
85
85
  }
86
86
  const L = (e, t) => typeof e.colSpan == "function" ? e.colSpan({ dataItem: t, column: e }) : e.colSpan || 1;
87
87
  function q(e, t) {
88
- const n = [[]];
89
- let l = 0;
88
+ const a = [[]];
89
+ let i = 0;
90
90
  for (let r = e.length - 1; r >= 0; r--)
91
- l = Math.max(l, e[r].depth), e[r].headerColSpan = e[r].headerColSpan || 1, e[r].children.length > 0 && (e[r].headerColSpan = e[r].children.reduce(
92
- (a, i) => i.hidden ? a : a + i.headerColSpan,
91
+ 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(
92
+ (n, l) => l.hidden ? n : n + l.headerColSpan,
93
93
  0
94
94
  ));
95
- const o = [];
95
+ const d = [];
96
96
  let f = 1;
97
- return e.forEach((r, a) => {
98
- n[r.depth] = n[r.depth] || [];
99
- let i = !1;
100
- n[r.depth].length === 0 && (f <= 1 ? f = 1 + (r.children.length > 0 ? 0 : l - r.depth) : (f--, i = !0)), r.rowSpan = 1 + (r.children.length > 0 ? 0 : l - r.depth), r.kFirst = i, r.index = n[r.depth].length, n[r.depth].push(a), r.ariaColumnIndex = o[r.depth] ? o[r.depth] + 1 : 1;
101
- for (let d = r.depth; d < r.depth + r.rowSpan; d++)
102
- o[d] = (o[d] || 0) + r.headerColSpan;
103
- }), T(n, e, t), A(n, e, t), n;
97
+ return e.forEach((r, n) => {
98
+ a[r.depth] = a[r.depth] || [];
99
+ let l = !1;
100
+ a[r.depth].length === 0 && (f <= 1 ? f = 1 + (r.children.length > 0 ? 0 : i - r.depth) : (f--, l = !0)), r.rowSpan = 1 + (r.children.length > 0 ? 0 : i - r.depth), r.kFirst = l, r.index = a[r.depth].length, a[r.depth].push(n), r.ariaColumnIndex = d[r.depth] ? d[r.depth] + 1 : 1;
101
+ for (let o = r.depth; o < r.depth + r.rowSpan; o++)
102
+ d[o] = (d[o] || 0) + r.headerColSpan;
103
+ }), T(a, e, t), A(a, e, t), a;
104
104
  }
105
- function p(e, t, n, l = 0) {
106
- const o = [];
105
+ function E(e, t, a, i = 0) {
106
+ const d = [];
107
107
  if (!e)
108
108
  return [];
109
- e && e.length === void 0 && (e = [e]), e.filter((a) => a && a.props ? !a.props.hidden : !a.hidden).forEach((a, i) => {
110
- a = a.props ? a.props : a;
111
- const d = t[i] || null, h = p(
112
- a.children,
113
- d && d.children || [],
114
- n,
115
- l + 1
109
+ e && e.length === void 0 && (e = [e]), e.filter((n) => n && n.props ? !n.props.hidden : !n.hidden).forEach((n, l) => {
110
+ n = n.props ? n.props : n;
111
+ const o = t[l] || null, h = E(
112
+ n.children,
113
+ o && o.children || [],
114
+ a,
115
+ i + 1
116
116
  );
117
- o.push(
117
+ d.push(
118
118
  Object.assign(
119
- { depth: l },
120
- v,
119
+ { depth: i },
120
+ u,
121
121
  h.length ? { cell: () => null, filterCell: () => null } : {},
122
- d ? { width: d.width, orderIndex: d.orderIndex } : {},
123
- a,
122
+ o ? { width: o.width, orderIndex: o.orderIndex } : {},
123
+ n,
124
124
  {
125
- id: a.id ? a.id : b.generateNavigatableId(`${n.prevId++}`, n.idPrefix, "column"),
126
- declarationIndex: o.length,
125
+ id: n.id ? n.id : b.generateNavigatableId(`${a.prevId++}`, a.idPrefix, "column"),
126
+ declarationIndex: d.length,
127
127
  children: h,
128
- headerColSpan: a.headerColSpan,
128
+ headerColSpan: n.headerColSpan,
129
129
  rowSpan: 0,
130
- columnType: a.columnType || "data",
131
- colSpan: a.colSpan || 1,
130
+ columnType: n.columnType || "data",
131
+ colSpan: n.colSpan || 1,
132
132
  isAccessible: !0,
133
- left: a.lockedColumn ? d && Math.floor(d.left) : null,
134
- right: a.lockedColumn ? d && Math.floor(d.right) : null
133
+ left: n.lockedColumn ? o && Math.floor(o.left) : null,
134
+ right: n.lockedColumn ? o && Math.floor(o.right) : null,
135
+ rowSpannable: n.rowSpannable
135
136
  }
136
137
  )
137
138
  );
138
139
  });
139
- const r = (a, i) => a.orderIndex === i.orderIndex ? a.declarationIndex - i.declarationIndex : (a.orderIndex || 0) - (i.orderIndex || 0);
140
- if (o.sort(r), l === 0) {
141
- const a = [], i = (d, h) => d.forEach((c) => {
142
- c.parentIndex = h, i(c.children, a.push(c) - 1);
140
+ const r = (n, l) => n.orderIndex === l.orderIndex ? n.declarationIndex - l.declarationIndex : (n.orderIndex || 0) - (l.orderIndex || 0);
141
+ if (d.sort(r), i === 0) {
142
+ const n = [], l = (o, h) => o.forEach((c) => {
143
+ c.parentIndex = h, l(c.children, n.push(c) - 1);
143
144
  });
144
- return i(o, -1), a;
145
+ return l(d, -1), n;
145
146
  }
146
- return o;
147
+ return d;
147
148
  }
148
- function z(e, t, n, l) {
149
- let o = [];
150
- Array.isArray(e) ? o = e : e && (o = e.data);
149
+ function z(e, t, a, i) {
150
+ let d = [];
151
+ Array.isArray(e) ? d = e : e && (d = e.data);
151
152
  const f = [];
152
- if (o.length > 0) {
153
- let r = o[0];
153
+ if (d.length > 0) {
154
+ let r = d[0];
154
155
  if (t)
155
- for (let i = 0; i < t.length; i++)
156
+ for (let l = 0; l < t.length; l++)
156
157
  r = r.items && r.items[0];
157
- Object.getOwnPropertyNames(r).forEach((i) => {
158
- i !== n.column && f.push(
158
+ Object.getOwnPropertyNames(r).forEach((l) => {
159
+ l !== a.column && f.push(
159
160
  Object.assign(
160
161
  {
161
- id: b.generateNavigatableId(`${l.prevId++}`, l.idPrefix, "column"),
162
+ id: b.generateNavigatableId(`${i.prevId++}`, i.idPrefix, "column"),
162
163
  declarationIndex: -1,
163
164
  parentIndex: -1,
164
165
  depth: 0,
@@ -174,48 +175,48 @@ function z(e, t, n, l) {
174
175
  ariaColumnIndex: 0,
175
176
  isAccessible: !0
176
177
  },
177
- v,
178
- { field: i }
178
+ u,
179
+ { field: l }
179
180
  )
180
181
  );
181
182
  });
182
183
  }
183
184
  return f;
184
185
  }
185
- const E = (e, t) => {
186
- let n = e[t.parentIndex];
187
- for (; n; ) {
188
- if (n.footerCell)
186
+ const F = (e, t) => {
187
+ let a = e[t.parentIndex];
188
+ for (; a; ) {
189
+ if (a.footerCell)
189
190
  return !0;
190
- n = e[n.parentIndex];
191
+ a = e[a.parentIndex];
191
192
  }
192
193
  return !1;
193
- }, V = (e) => e.filter((t) => E(e, t) ? !1 : !!t.footerCell || !(t.children && t.children.length > 0)), W = (e) => e.width !== void 0 ? Math.floor(parseFloat(e.width.toString())) + "px" : void 0, J = (e, t) => t && t.filter((n) => n.field === e).length > 0, F = (e) => (e.sort((t, n) => t.declarationIndex - n.declarationIndex), e.map((t) => {
194
- const { declarationIndex: n, parentIndex: l, depth: o, headerColSpan: f, rowSpan: r, index: a, kFirst: i, children: d, ...h } = t;
195
- return d.length ? {
196
- children: F(d),
194
+ }, V = (e) => e.filter((t) => F(e, t) ? !1 : !!t.footerCell || !(t.children && t.children.length > 0)), W = (e) => e.width !== void 0 ? Math.floor(parseFloat(e.width.toString())) + "px" : void 0, J = (e, t) => t && t.filter((a) => a.field === e).length > 0, R = (e) => (e.sort((t, a) => t.declarationIndex - a.declarationIndex), e.map((t) => {
195
+ const { declarationIndex: a, parentIndex: i, depth: d, headerColSpan: f, rowSpan: r, index: n, kFirst: l, children: o, ...h } = t;
196
+ return o.length ? {
197
+ children: R(o),
197
198
  ...h
198
199
  } : h;
199
- })), m = (e) => {
200
- const { filterCell: t, headerCell: n, footerCell: l, cells: o, cell: f, ...r } = e;
200
+ })), j = (e) => {
201
+ const { filterCell: t, headerCell: a, footerCell: i, cells: d, cell: f, rowSpannable: r, ...n } = e;
201
202
  return e.children.length ? {
202
- ...r,
203
- children: e.children.map(m)
204
- } : r;
203
+ ...n,
204
+ children: e.children.map(j)
205
+ } : n;
205
206
  }, K = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), Q = 17895697, U = (e) => {
206
207
  let t = [];
207
- return e.sortable && (t = t.concat([x.sortAsc, x.sortDesc])), t;
208
+ return e.sortable && (t = t.concat([g.sortAsc, g.sortDesc])), t;
208
209
  }, X = (e) => {
209
210
  let t = [];
210
211
  return e.clipboard && (t = t.concat([
211
- x.copySelection,
212
- x.copySelectionNoHeaders,
213
- x.paste
214
- ])), e.editable && (t.length && (t = t.concat([x.separator])), t = t.concat([
215
- x.create,
216
- x.edit,
217
- x.delete
218
- ])), e.selectable && (t.length && (t = t.concat([x.separator])), t = t.concat([x.select])), e.reorderable && (t.length && (t = t.concat([x.separator])), t = t.concat([x.reorderRow])), t;
212
+ g.copySelection,
213
+ g.copySelectionNoHeaders,
214
+ g.paste
215
+ ])), e.editable && (t.length && (t = t.concat([g.separator])), t = t.concat([
216
+ g.create,
217
+ g.edit,
218
+ g.delete
219
+ ])), e.selectable && (t.length && (t = t.concat([g.separator])), t = t.concat([g.select])), e.reorderable && (t.length && (t = t.concat([g.separator])), t = t.concat([g.reorderRow])), t;
219
220
  }, Y = (e, t) => {
220
221
  if (!(!e && !t))
221
222
  return t ? e ? {
@@ -238,7 +239,7 @@ const E = (e, t) => {
238
239
  ...t.edit || {}
239
240
  }
240
241
  } : t : e;
241
- }, Z = () => D === B, _ = (e) => !!(e && e.$$typeof === Symbol.for("react.client.reference")), P = (e) => ({
242
+ }, Z = () => D === B, _ = (e) => !!(e && e.$$typeof === Symbol.for("react.client.reference")), G = (e) => ({
242
243
  id: e.id,
243
244
  ariaColumnIndex: e.ariaColumnIndex,
244
245
  isSelected: e.isSelected,
@@ -264,25 +265,30 @@ const E = (e, t) => {
264
265
  rowDataIndex: e.rowDataIndex,
265
266
  columnPosition: e.columnPosition,
266
267
  group: e.group
267
- });
268
+ }), P = (e) => {
269
+ var i, d;
270
+ const t = typeof e == "object" ? (i = e.enabled) != null ? i : !0 : e != null ? e : !1, a = typeof e == "object" ? (d = e.valueGetter) != null ? d : (f, r) => y(r)(f) : (f, r) => y(r)(f);
271
+ return { enabled: t, valueGetter: a };
272
+ };
268
273
  export {
269
274
  z as autoGenerateColumns,
270
- m as clientColumn,
275
+ j as clientColumn,
271
276
  K as firefox,
272
277
  Q as firefoxMaxHeight,
273
278
  k as flatData,
274
279
  V as footerColumns,
275
- P as getClientCellProps,
280
+ G as getClientCellProps,
276
281
  L as getColSpan,
277
282
  W as getColumnWidth,
278
283
  X as getDefaultBodyContextMenuItems,
279
284
  U as getDefaultHeadContextMenuItems,
280
- y as getNestedValue,
285
+ w as getNestedValue,
286
+ P as getRowSpanOptions,
281
287
  Z as isClient,
282
288
  _ as isClientReference,
283
289
  J as isSorted,
284
290
  q as mapColumns,
285
- p as readColumns,
291
+ E as readColumns,
286
292
  Y as resolveCells,
287
- F as sanitizeColumns
293
+ R as sanitizeColumns
288
294
  };