@progress/kendo-react-grid 14.3.0-develop.6 → 14.3.0-develop.7

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.
Files changed (78) hide show
  1. package/GridClientContextReader.js +1 -1
  2. package/GridClientContextReader.mjs +10 -9
  3. package/GridClientWrapper.js +1 -1
  4. package/GridClientWrapper.mjs +672 -589
  5. package/GridComponent.js +1 -1
  6. package/GridComponent.mjs +427 -374
  7. package/GridState.d.ts +2 -0
  8. package/GridState.js +1 -1
  9. package/GridState.mjs +98 -90
  10. package/cells/pincell/GridPinCell.d.ts +15 -0
  11. package/cells/pincell/GridPinCell.js +9 -0
  12. package/cells/pincell/GridPinCell.mjs +19 -0
  13. package/cells/pincell/GridPinCellServer.d.ts +15 -0
  14. package/cells/pincell/GridPinCellServer.js +8 -0
  15. package/cells/pincell/GridPinCellServer.mjs +32 -0
  16. package/cells/pincell/GridPinCellServerContainer.d.ts +11 -0
  17. package/cells/pincell/GridPinCellServerContainer.js +9 -0
  18. package/cells/pincell/GridPinCellServerContainer.mjs +26 -0
  19. package/cells/pincell/GridPinDropdownButton.d.ts +21 -0
  20. package/cells/pincell/GridPinDropdownButton.js +9 -0
  21. package/cells/pincell/GridPinDropdownButton.mjs +58 -0
  22. package/cells/pincell/useGridPinCellClientTdProps.d.ts +24 -0
  23. package/cells/pincell/useGridPinCellClientTdProps.js +9 -0
  24. package/cells/pincell/useGridPinCellClientTdProps.mjs +21 -0
  25. package/cells/pincell/utils.d.ts +20 -0
  26. package/cells/pincell/utils.js +8 -0
  27. package/cells/pincell/utils.mjs +47 -0
  28. package/components/PinnedRowsTable.d.ts +48 -0
  29. package/components/PinnedRowsTable.js +9 -0
  30. package/components/PinnedRowsTable.mjs +133 -0
  31. package/components/StickyGroupTable.js +1 -1
  32. package/components/StickyGroupTable.mjs +1 -1
  33. package/contextMenu/GridContextMenu.d.ts +42 -0
  34. package/contextMenu/GridContextMenu.js +1 -1
  35. package/contextMenu/GridContextMenu.mjs +101 -51
  36. package/contextMenu/enums.d.ts +5 -1
  37. package/contextMenu/enums.js +1 -1
  38. package/contextMenu/enums.mjs +2 -2
  39. package/dist/cdn/js/kendo-react-grid.js +1 -1
  40. package/drag/ColumnResize.d.ts +9 -0
  41. package/drag/ColumnResize.js +1 -1
  42. package/drag/ColumnResize.mjs +105 -115
  43. package/getRowContents.d.ts +2 -2
  44. package/getRowContents.js +1 -1
  45. package/getRowContents.mjs +13 -14
  46. package/header/client/GridHeaderPinCell.d.ts +12 -0
  47. package/header/client/GridHeaderPinCell.js +9 -0
  48. package/header/client/GridHeaderPinCell.mjs +14 -0
  49. package/index.d.mts +5 -2
  50. package/index.d.ts +5 -2
  51. package/index.js +1 -1
  52. package/index.mjs +99 -95
  53. package/interfaces/ColumnType.d.ts +1 -1
  54. package/interfaces/GridCellsSettings.d.ts +23 -0
  55. package/interfaces/GridProps.d.ts +70 -1
  56. package/interfaces/GridRowProps.d.ts +4 -0
  57. package/interfaces/GridRowsSettings.d.ts +11 -0
  58. package/interfaces/events.d.ts +17 -0
  59. package/messages/index.d.ts +20 -0
  60. package/messages/index.js +2 -2
  61. package/messages/index.mjs +110 -102
  62. package/package-metadata.js +1 -1
  63. package/package-metadata.mjs +2 -2
  64. package/package.json +17 -17
  65. package/rows/GridRow.js +1 -1
  66. package/rows/GridRow.mjs +25 -24
  67. package/rows/GridRowRenderer.d.ts +1 -0
  68. package/rows/GridRowRenderer.js +1 -1
  69. package/rows/GridRowRenderer.mjs +39 -36
  70. package/stacked/GridStackedRow.d.ts +5 -0
  71. package/stacked/GridStackedRow.js +1 -1
  72. package/stacked/GridStackedRow.mjs +118 -116
  73. package/stacked/StackedModeRow.d.ts +1 -0
  74. package/stacked/StackedModeRow.js +1 -1
  75. package/stacked/StackedModeRow.mjs +13 -11
  76. package/utils/index.d.ts +1 -0
  77. package/utils/index.js +1 -1
  78. package/utils/index.mjs +44 -44
@@ -6,10 +6,10 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as e from "react";
9
- import { GridGroupCellToggle as _ } from "../cells/groupcell/GridGroupCellToggle.mjs";
10
- import { GridRow as H } from "../rows/GridRow.mjs";
11
- import { GridStackedRow as O } from "./GridStackedRow.mjs";
12
- const J = ({
9
+ import { GridGroupCellToggle as H } from "../cells/groupcell/GridGroupCellToggle.mjs";
10
+ import { GridRow as O } from "../rows/GridRow.mjs";
11
+ import { GridStackedRow as P } from "./GridStackedRow.mjs";
12
+ const K = ({
13
13
  item: t,
14
14
  rowId: d,
15
15
  dataIndex: m,
@@ -32,12 +32,13 @@ const J = ({
32
32
  preparedCells: w,
33
33
  showDetailToggle: B,
34
34
  isDetailExpanded: L,
35
- detailExpandField: M
35
+ detailExpandField: M,
36
+ isPinned: V
36
37
  }) => {
37
38
  var T, $, C;
38
39
  if (t.rowType === "data")
39
40
  return /* @__PURE__ */ e.createElement(
40
- O,
41
+ P,
41
42
  {
42
43
  key: d,
43
44
  dataItem: t.dataItem,
@@ -56,10 +57,11 @@ const J = ({
56
57
  editMode: D,
57
58
  showDetailToggle: B,
58
59
  isDetailExpanded: L,
59
- detailExpandField: M
60
+ detailExpandField: M,
61
+ isPinned: V
60
62
  }
61
63
  );
62
- const V = y + 1, S = t.level || 0, b = Math.max(1, V - S), N = Array.from({ length: S }, (c, r) => /* @__PURE__ */ e.createElement("td", { key: `group-cell-${d}-${r}`, className: "k-table-group-td k-group-cell k-table-td" }));
64
+ const _ = y + 1, S = t.level || 0, b = Math.max(1, _ - S), N = Array.from({ length: S }, (c, r) => /* @__PURE__ */ e.createElement("td", { key: `group-cell-${d}-${r}`, className: "k-table-group-td k-group-cell k-table-td" }));
63
65
  let g;
64
66
  if (t.rowType === "groupHeader") {
65
67
  const c = (T = t.dataItem) == null ? void 0 : T.field, r = ($ = t.dataItem) == null ? void 0 : $.value, i = c !== void 0 ? (() => {
@@ -72,7 +74,7 @@ const J = ({
72
74
  r instanceof Date ? l = r.toString() : l = String(r), a = `${i}: ${l}`;
73
75
  } else r instanceof Date ? a = r.toString() : r !== void 0 && (a = String(r));
74
76
  g = /* @__PURE__ */ e.createElement(e.Fragment, null, N, /* @__PURE__ */ e.createElement("td", { className: "k-table-td", colSpan: b, role: "gridcell", "aria-expanded": t.expanded }, /* @__PURE__ */ e.createElement("p", { className: "k-reset" }, /* @__PURE__ */ e.createElement(
75
- _,
77
+ H,
76
78
  {
77
79
  id: "",
78
80
  dataItem: t.dataItem,
@@ -104,7 +106,7 @@ const J = ({
104
106
  g = /* @__PURE__ */ e.createElement(e.Fragment, null, N, /* @__PURE__ */ e.createElement("td", { className: "k-table-td", colSpan: b }, /* @__PURE__ */ e.createElement("div", { className: "k-grid-column-template" }, i)));
105
107
  }
106
108
  return /* @__PURE__ */ e.createElement(
107
- H,
109
+ O,
108
110
  {
109
111
  key: d,
110
112
  dataItem: t.dataItem,
@@ -127,5 +129,5 @@ const J = ({
127
129
  );
128
130
  };
129
131
  export {
130
- J as StackedModeRow
132
+ K as StackedModeRow
131
133
  };
package/utils/index.d.ts CHANGED
@@ -152,6 +152,7 @@ export declare const getDefaultBodyContextMenuItems: (options: {
152
152
  editable?: boolean;
153
153
  rowReorderable?: boolean;
154
154
  clipboard?: boolean;
155
+ pinnable?: boolean;
155
156
  }) => GridContextMenuItemNames[];
156
157
  /**
157
158
  * @hidden
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 G=require("react"),v=require("../GridColumn.js"),w=require("@progress/kendo-data-query"),y=require("@progress/kendo-react-data-tools"),O=require("./_serverModule.js"),T=require("./_clientModule.js"),l=require("../contextMenu/enums.js"),H=require("@progress/kendo-react-common");function j(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const M=j(G);function q(e,t){const a=(e!=null?e:"").split(".");let r=t;return a.forEach(n=>{r=r?r[n]:void 0}),r}function N(e,t,a,r,n,d,h,i,s,f=0,o){var c;let x=f;for(let g=0;g<t.length;g++){let C;if(!n||t[g].value===void 0||t[g].items===void 0){e[e.length]={dataIndex:r.index,dataItem:t[g],rowType:"data",level:f,group:o,expanded:(c=s?!!(d!=null&&d[w.getter(s)(t[g])]):!1)!=null?c:!1},r.index++;continue}else{let S;o!=null&&o.parents?S=[{field:o.field,value:o.value},...o.parents]:o?S=[o]:S=[],C={field:t[g].field,value:t[g].value,parents:S}}x=Math.max(x,f+1);let I=!1;const b=y.findGroupExpand(h||[],C);b?I=b.expanded!==!1:I=i!==!1,e[e.length]={dataIndex:-1,dataItem:t[g],level:f,group:C,rowType:"groupHeader",expanded:I},I&&(C.expanded=I,x=Math.max(N(e,t[g].items,a,r,n,d,h,i,s,f+1,C),x)),(a==="always"||I&&a==="visible")&&(e[e.length]={dataIndex:-1,dataItem:t[g],rowType:"groupFooter",level:f,expanded:I})}return x}function R(e,t){for(let a=0;a<e.length;a++){const r=e[a];if(r.locked===void 0){const n=t[r.index];n&&(r.locked=n.locked)}}}const u=(e,t)=>typeof e.colSpan=="function"?e.colSpan({dataItem:t,column:e}):e.colSpan||1;function B(e,t,a){const r=[[]];let n=0;for(let i=e.length-1;i>=0;i--)n=Math.max(n,e[i].depth),e[i].headerColSpan=e[i].headerColSpan||1,e[i].children.length>0&&(e[i].headerColSpan=e[i].children.reduce((s,f)=>f.hidden?s:s+f.headerColSpan,0));const d=[];let h=1;return e.forEach((i,s)=>{r[i.depth]=r[i.depth]||[];let f=!1;r[i.depth].length===0&&(h<=1?h=1+(i.children.length>0?0:n-i.depth):(h--,f=!0)),i.rowSpan=1+(i.children.length>0?0:n-i.depth),i.kFirst=f,i.index=r[i.depth].length,r[i.depth].push(s),i.ariaColumnIndex=d[i.depth]?d[i.depth]+1:1;for(let o=i.depth;o<i.depth+i.rowSpan;o++)d[o]=(d[o]||0)+i.headerColSpan}),R(e,t),y.updateLeft(r,e,a),y.updateRight(r,e,a),r}function p(e,t,a,r=0,n=!1){const d=[];if(!e)return[];e&&e.length===void 0&&(e=[e]),e.forEach((i,s)=>{i=i.props?i.props:i;const f=i.id?i.id:y.tableKeyboardNavigationTools.generateNavigatableId(`${a.prevId++}`,a.idPrefix,"column"),o=H.canUseDOM&&i.media&&window.matchMedia?!window.matchMedia(i.media).matches:!1,x=n||o||i.hidden,c=t==null?void 0:t.find(C=>C.id===f),g=p(i.children,(c==null?void 0:c.children)||[],a,r+1,x);d.push(Object.assign({depth:r},v.gridDefaultProps,g.length?{cell:()=>null,filterCell:()=>null}:{},i,{id:f,declarationIndex:d.length,children:g,headerColSpan:0,rowSpan:0,columnType:i.columnType||"data",colSpan:i.colSpan||1,isAccessible:!0,hidden:x,left:null,right:null,rowSpannable:i.rowSpannable},c?{width:c.width,orderIndex:c.orderIndex}:{}))});const h=(i,s)=>i.orderIndex===s.orderIndex?i.declarationIndex-s.declarationIndex:(i.orderIndex||0)-(s.orderIndex||0);if(d.sort(h),r===0){const i=[],s=(f,o)=>f.forEach(x=>{x.parentIndex=o,s(x.children,i.push(x)-1)});return s(d,-1),i}return d}const D=e=>Array.isArray(e)?e:e?e.data:[];function z(e,t,a,r){const n=D(e),d=[];if(n.length>0){let h=n[0];if(t)for(let s=0;s<t.length;s++)h=h.items&&h.items[0];Object.getOwnPropertyNames(h).forEach(s=>{s!==a.column&&d.push(Object.assign({id:y.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},v.gridDefaultProps,{field:s}))})}return d}const _=(e,t)=>{var r;let a=e[t.parentIndex];for(;a;){if((r=a.cells)!=null&&r.footerCell)return!0;a=e[a.parentIndex]}return!1},L=e=>e.filter(t=>{var a;return _(e,t)?!1:!!((a=t.cells)!=null&&a.footerCell)||!(t.children&&t.children.length>0)}),$=e=>{let t=e.width;return typeof(e==null?void 0:e.width)=="number"&&(e!=null&&e.minResizableWidth)&&(e==null?void 0:e.width)<(e==null?void 0:e.minResizableWidth)&&(t=e==null?void 0:e.minResizableWidth),typeof(e==null?void 0:e.width)=="number"&&(e!=null&&e.minWidth)&&(e==null?void 0:e.width)<(e==null?void 0:e.minWidth)?t=e==null?void 0:e.minWidth:typeof(e==null?void 0:e.width)=="number"&&(e!=null&&e.maxWidth)&&(e==null?void 0:e.width)>(e==null?void 0:e.maxWidth)&&(t=e==null?void 0:e.maxWidth),t!==void 0?Math.floor(parseFloat(t.toString()))+"px":void 0},V=(e,t)=>t&&t.filter(a=>a.field===e).length>0,E=e=>(e.sort((t,a)=>t.declarationIndex-a.declarationIndex),e.map(t=>{const{declarationIndex:a,parentIndex:r,depth:n,headerColSpan:d,rowSpan:h,index:i,kFirst:s,children:f,...o}=t;return f.length?{children:E(f),...o}:o})),W=e=>{const{cells:t,rowSpannable:a,defaultCell:r,...n}=e;return e.children.length?{...n,children:e.children.map(W)}:n},F=e=>({id:e.id,field:e.field,title:e.title,width:e.width,orderIndex:e.orderIndex,hidden:!1,minWidth:e.minWidth,maxWidth:e.maxWidth,children:e.children?k(e.children):null}),k=e=>e.map(F),P=e=>{const t=[],a=r=>r==null?void 0:r.forEach(n=>{t.push(n),a(n.children)});return a(e),t},K=typeof window!="undefined"&&/Firefox/.test(window.navigator.userAgent),Q=17895697,U=e=>{let t=[];return e.sortable&&(t=t.concat([l.GridContextMenuItemNames.sortAsc,l.GridContextMenuItemNames.sortDesc])),e.pdf&&(t.length&&(t=t.concat([l.GridContextMenuItemNames.separator])),t=t.concat([l.GridContextMenuItemNames.exportPDF])),t},J=e=>{let t=[];return e.clipboard&&(t=t.concat([l.GridContextMenuItemNames.copySelection,l.GridContextMenuItemNames.copySelectionNoHeaders,l.GridContextMenuItemNames.paste])),e.editable&&(t.length&&(t=t.concat([l.GridContextMenuItemNames.separator])),t=t.concat([l.GridContextMenuItemNames.create,l.GridContextMenuItemNames.edit,l.GridContextMenuItemNames.delete])),e.selectable&&(t.length&&(t=t.concat([l.GridContextMenuItemNames.separator])),t=t.concat([l.GridContextMenuItemNames.select])),e.rowReorderable&&(t.length&&(t=t.concat([l.GridContextMenuItemNames.separator])),t=t.concat([l.GridContextMenuItemNames.reorderRow])),e.pdf&&(t.length&&(t=t.concat([l.GridContextMenuItemNames.separator])),t=t.concat([l.GridContextMenuItemNames.exportPDF])),t},X=(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},Y=e=>{var a;return typeof e=="object"?(a=e.enabled)!=null?a:!0:e!=null?e:!1},Z=()=>O.ServerFragment===T.ClientFragment,m=e=>!!(e&&e.$$typeof===Symbol.for("react.client.reference")),ee=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}),te=e=>{var r,n;const t=typeof e=="object"?(r=e.enabled)!=null?r:!0:e!=null?e:!1,a=typeof e=="object"?(n=e.valueGetter)!=null?n:((d,h)=>w.getter(h)(d)):(d,h)=>w.getter(h)(d);return{enabled:t,valueGetter:a}},A=e=>{var t;return M.isValidElement(e)?e:(t=M.Children.toArray(e))==null?void 0:t[0]},ie=(e,t)=>{const a=A(e);return a?M.cloneElement(a,t):null},ae=e=>{let t=0;if(e){const a=e.insertRow(0),r=a.insertCell(0);r.textContent="&nbsp;",t=a.getBoundingClientRect().height,e.deleteRow(0)}return t};exports.autoGenerateColumns=z;exports.calcRowHeight=ae;exports.clientColumn=W;exports.cloneReactElement=ie;exports.firefox=K;exports.firefoxMaxHeight=Q;exports.flatData=N;exports.footerColumns=L;exports.getClientCellProps=ee;exports.getColSpan=u;exports.getColumnState=F;exports.getColumnWidth=$;exports.getColumnsState=k;exports.getDataAsArray=D;exports.getDefaultBodyContextMenuItems=J;exports.getDefaultHeadContextMenuItems=U;exports.getFlatColumnsState=P;exports.getNestedValue=q;exports.getReactElement=A;exports.getRowSpanOptions=te;exports.isClient=Z;exports.isClientReference=m;exports.isRowReorderEnabled=Y;exports.isSorted=V;exports.mapColumns=B;exports.readColumns=p;exports.resolveCells=X;exports.sanitizeColumns=E;exports.syncLockedColumns=R;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react"),v=require("../GridColumn.js"),S=require("@progress/kendo-data-query"),y=require("@progress/kendo-react-data-tools"),O=require("./_serverModule.js"),T=require("./_clientModule.js"),h=require("../contextMenu/enums.js"),H=require("@progress/kendo-react-common");function j(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const M=j(A);function u(e,t){const a=(e!=null?e:"").split(".");let r=t;return a.forEach(n=>{r=r?r[n]:void 0}),r}function N(e,t,a,r,n,d,l,i,s,f=0,o){var c;let x=f;for(let g=0;g<t.length;g++){let C;if(!n||t[g].value===void 0||t[g].items===void 0){e[e.length]={dataIndex:r.index,dataItem:t[g],rowType:"data",level:f,group:o,expanded:(c=s?!!(d!=null&&d[S.getter(s)(t[g])]):!1)!=null?c:!1},r.index++;continue}else{let w;o!=null&&o.parents?w=[{field:o.field,value:o.value},...o.parents]:o?w=[o]:w=[],C={field:t[g].field,value:t[g].value,parents:w}}x=Math.max(x,f+1);let I=!1;const b=y.findGroupExpand(l||[],C);b?I=b.expanded!==!1:I=i!==!1,e[e.length]={dataIndex:-1,dataItem:t[g],level:f,group:C,rowType:"groupHeader",expanded:I},I&&(C.expanded=I,x=Math.max(N(e,t[g].items,a,r,n,d,l,i,s,f+1,C),x)),(a==="always"||I&&a==="visible")&&(e[e.length]={dataIndex:-1,dataItem:t[g],rowType:"groupFooter",level:f,expanded:I})}return x}function p(e,t){for(let a=0;a<e.length;a++){const r=e[a];if(r.locked===void 0){const n=t[r.index];n&&(r.locked=n.locked)}}}const q=(e,t)=>typeof e.colSpan=="function"?e.colSpan({dataItem:t,column:e}):e.colSpan||1;function B(e,t,a){const r=[[]];let n=0;for(let i=e.length-1;i>=0;i--)n=Math.max(n,e[i].depth),e[i].headerColSpan=e[i].headerColSpan||1,e[i].children.length>0&&(e[i].headerColSpan=e[i].children.reduce((s,f)=>f.hidden?s:s+f.headerColSpan,0));const d=[];let l=1;return e.forEach((i,s)=>{r[i.depth]=r[i.depth]||[];let f=!1;r[i.depth].length===0&&(l<=1?l=1+(i.children.length>0?0:n-i.depth):(l--,f=!0)),i.rowSpan=1+(i.children.length>0?0:n-i.depth),i.kFirst=f,i.index=r[i.depth].length,r[i.depth].push(s),i.ariaColumnIndex=d[i.depth]?d[i.depth]+1:1;for(let o=i.depth;o<i.depth+i.rowSpan;o++)d[o]=(d[o]||0)+i.headerColSpan}),p(e,t),y.updateLeft(r,e,a),y.updateRight(r,e,a),r}function R(e,t,a,r=0,n=!1){const d=[];if(!e)return[];e&&e.length===void 0&&(e=[e]),e.forEach((i,s)=>{i=i.props?i.props:i;const f=i.id?i.id:y.tableKeyboardNavigationTools.generateNavigatableId(`${a.prevId++}`,a.idPrefix,"column"),o=H.canUseDOM&&i.media&&window.matchMedia?!window.matchMedia(i.media).matches:!1,x=n||o||i.hidden,c=t==null?void 0:t.find(C=>C.id===f),g=R(i.children,(c==null?void 0:c.children)||[],a,r+1,x);d.push(Object.assign({depth:r},v.gridDefaultProps,g.length?{cell:()=>null,filterCell:()=>null}:{},i,{id:f,declarationIndex:d.length,children:g,headerColSpan:0,rowSpan:0,columnType:i.columnType||"data",colSpan:i.colSpan||1,isAccessible:!0,hidden:x,left:null,right:null,rowSpannable:i.rowSpannable},c?{width:c.width,orderIndex:c.orderIndex}:{}))});const l=(i,s)=>i.orderIndex===s.orderIndex?i.declarationIndex-s.declarationIndex:(i.orderIndex||0)-(s.orderIndex||0);if(d.sort(l),r===0){const i=[],s=(f,o)=>f.forEach(x=>{x.parentIndex=o,s(x.children,i.push(x)-1)});return s(d,-1),i}return d}const D=e=>Array.isArray(e)?e:e?e.data:[];function z(e,t,a,r){const n=D(e),d=[];if(n.length>0){let l=n[0];if(t)for(let s=0;s<t.length;s++)l=l.items&&l.items[0];Object.getOwnPropertyNames(l).forEach(s=>{s!==a.column&&d.push(Object.assign({id:y.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},v.gridDefaultProps,{field:s}))})}return d}const _=(e,t)=>{var r;let a=e[t.parentIndex];for(;a;){if((r=a.cells)!=null&&r.footerCell)return!0;a=e[a.parentIndex]}return!1},L=e=>e.filter(t=>{var a;return _(e,t)?!1:!!((a=t.cells)!=null&&a.footerCell)||!(t.children&&t.children.length>0)}),$=e=>{let t=e.width;return typeof(e==null?void 0:e.width)=="number"&&(e!=null&&e.minResizableWidth)&&(e==null?void 0:e.width)<(e==null?void 0:e.minResizableWidth)&&(t=e==null?void 0:e.minResizableWidth),typeof(e==null?void 0:e.width)=="number"&&(e!=null&&e.minWidth)&&(e==null?void 0:e.width)<(e==null?void 0:e.minWidth)?t=e==null?void 0:e.minWidth:typeof(e==null?void 0:e.width)=="number"&&(e!=null&&e.maxWidth)&&(e==null?void 0:e.width)>(e==null?void 0:e.maxWidth)&&(t=e==null?void 0:e.maxWidth),t!==void 0?Math.floor(parseFloat(t.toString()))+"px":void 0},V=(e,t)=>t&&t.filter(a=>a.field===e).length>0,E=e=>(e.sort((t,a)=>t.declarationIndex-a.declarationIndex),e.map(t=>{const{declarationIndex:a,parentIndex:r,depth:n,headerColSpan:d,rowSpan:l,index:i,kFirst:s,children:f,...o}=t;return f.length?{children:E(f),...o}:o})),G=e=>{const{cells:t,rowSpannable:a,defaultCell:r,...n}=e;return e.children.length?{...n,children:e.children.map(G)}:n},W=e=>({id:e.id,field:e.field,title:e.title,width:e.width,orderIndex:e.orderIndex,hidden:!1,minWidth:e.minWidth,maxWidth:e.maxWidth,children:e.children?F(e.children):null}),F=e=>e.map(W),P=e=>{const t=[],a=r=>r==null?void 0:r.forEach(n=>{t.push(n),a(n.children)});return a(e),t},K=typeof window!="undefined"&&/Firefox/.test(window.navigator.userAgent),Q=17895697,U=e=>{let t=[];return e.sortable&&(t=t.concat([h.GridContextMenuItemNames.sortAsc,h.GridContextMenuItemNames.sortDesc])),e.pdf&&(t.length&&(t=t.concat([h.GridContextMenuItemNames.separator])),t=t.concat([h.GridContextMenuItemNames.exportPDF])),t},J=e=>{let t=[];return e.clipboard&&(t=t.concat([h.GridContextMenuItemNames.copySelection,h.GridContextMenuItemNames.copySelectionNoHeaders,h.GridContextMenuItemNames.paste])),e.editable&&(t.length&&(t=t.concat([h.GridContextMenuItemNames.separator])),t=t.concat([h.GridContextMenuItemNames.create,h.GridContextMenuItemNames.edit,h.GridContextMenuItemNames.delete])),e.selectable&&(t.length&&(t=t.concat([h.GridContextMenuItemNames.separator])),t=t.concat([h.GridContextMenuItemNames.select])),e.rowReorderable&&(t.length&&(t=t.concat([h.GridContextMenuItemNames.separator])),t=t.concat([h.GridContextMenuItemNames.reorderRow])),e.pdf&&(t.length&&(t=t.concat([h.GridContextMenuItemNames.separator])),t=t.concat([h.GridContextMenuItemNames.exportPDF])),e.pinnable&&(t.length&&(t=t.concat([h.GridContextMenuItemNames.separator])),t=t.concat([h.GridContextMenuItemNames.pinRow])),t},X=(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},Y=e=>{var a;return typeof e=="object"?(a=e.enabled)!=null?a:!0:e!=null?e:!1},Z=()=>O.ServerFragment===T.ClientFragment,m=e=>!!(e&&e.$$typeof===Symbol.for("react.client.reference")),ee=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}),te=e=>{var r,n;const t=typeof e=="object"?(r=e.enabled)!=null?r:!0:e!=null?e:!1,a=typeof e=="object"?(n=e.valueGetter)!=null?n:((d,l)=>S.getter(l)(d)):(d,l)=>S.getter(l)(d);return{enabled:t,valueGetter:a}},k=e=>{var t;return M.isValidElement(e)?e:(t=M.Children.toArray(e))==null?void 0:t[0]},ie=(e,t)=>{const a=k(e);return a?M.cloneElement(a,t):null},ae=e=>{let t=0;if(e){const a=e.insertRow(0),r=a.insertCell(0);r.textContent="&nbsp;",t=a.getBoundingClientRect().height,e.deleteRow(0)}return t};exports.autoGenerateColumns=z;exports.calcRowHeight=ae;exports.clientColumn=G;exports.cloneReactElement=ie;exports.firefox=K;exports.firefoxMaxHeight=Q;exports.flatData=N;exports.footerColumns=L;exports.getClientCellProps=ee;exports.getColSpan=q;exports.getColumnState=W;exports.getColumnWidth=$;exports.getColumnsState=F;exports.getDataAsArray=D;exports.getDefaultBodyContextMenuItems=J;exports.getDefaultHeadContextMenuItems=U;exports.getFlatColumnsState=P;exports.getNestedValue=u;exports.getReactElement=k;exports.getRowSpanOptions=te;exports.isClient=Z;exports.isClientReference=m;exports.isRowReorderEnabled=Y;exports.isSorted=V;exports.mapColumns=B;exports.readColumns=R;exports.resolveCells=X;exports.sanitizeColumns=E;exports.syncLockedColumns=p;
package/utils/index.mjs CHANGED
@@ -8,10 +8,10 @@
8
8
  import * as C from "react";
9
9
  import { gridDefaultProps as p } from "../GridColumn.mjs";
10
10
  import { getter as S } from "@progress/kendo-data-query";
11
- import { findGroupExpand as W, tableKeyboardNavigationTools as b, updateLeft as F, updateRight as R } from "@progress/kendo-react-data-tools";
11
+ import { findGroupExpand as R, tableKeyboardNavigationTools as b, updateLeft as W, updateRight as F } from "@progress/kendo-react-data-tools";
12
12
  import { ServerFragment as D } from "./_serverModule.mjs";
13
13
  import { ClientFragment as E } from "./_clientModule.mjs";
14
- import { GridContextMenuItemNames as o } from "../contextMenu/enums.mjs";
14
+ import { GridContextMenuItemNames as l } from "../contextMenu/enums.mjs";
15
15
  import { canUseDOM as M } from "@progress/kendo-react-common";
16
16
  function X(e, t) {
17
17
  const r = (e != null ? e : "").split(".");
@@ -20,64 +20,64 @@ function X(e, t) {
20
20
  a = a ? a[d] : void 0;
21
21
  }), a;
22
22
  }
23
- function A(e, t, r, a, d, n, l, i, h, s = 0, f) {
23
+ function A(e, t, r, a, d, n, o, i, h, s = 0, f) {
24
24
  var c;
25
- let g = s;
26
- for (let x = 0; x < t.length; x++) {
25
+ let x = s;
26
+ for (let g = 0; g < t.length; g++) {
27
27
  let I;
28
- if (!d || t[x].value === void 0 || t[x].items === void 0) {
28
+ if (!d || t[g].value === void 0 || t[g].items === void 0) {
29
29
  e[e.length] = {
30
30
  dataIndex: a.index,
31
- dataItem: t[x],
31
+ dataItem: t[g],
32
32
  rowType: "data",
33
33
  level: s,
34
34
  group: f,
35
35
  // This is related to detail-row expansion
36
- expanded: (c = h ? !!(n != null && n[S(h)(t[x])]) : !1) != null ? c : !1
36
+ expanded: (c = h ? !!(n != null && n[S(h)(t[g])]) : !1) != null ? c : !1
37
37
  }, a.index++;
38
38
  continue;
39
39
  } else {
40
40
  let y;
41
41
  f != null && f.parents ? y = [{ field: f.field, value: f.value }, ...f.parents] : f ? y = [f] : y = [], I = {
42
- field: t[x].field,
43
- value: t[x].value,
42
+ field: t[g].field,
43
+ value: t[g].value,
44
44
  parents: y
45
45
  };
46
46
  }
47
- g = Math.max(g, s + 1);
47
+ x = Math.max(x, s + 1);
48
48
  let w = !1;
49
- const v = W(l || [], I);
49
+ const v = R(o || [], I);
50
50
  v ? w = v.expanded !== !1 : w = i !== !1, e[e.length] = {
51
51
  dataIndex: -1,
52
- dataItem: t[x],
52
+ dataItem: t[g],
53
53
  level: s,
54
54
  group: I,
55
55
  rowType: "groupHeader",
56
56
  expanded: w
57
- }, w && (I.expanded = w, g = Math.max(
57
+ }, w && (I.expanded = w, x = Math.max(
58
58
  A(
59
59
  e,
60
- t[x].items,
60
+ t[g].items,
61
61
  r,
62
62
  a,
63
63
  d,
64
64
  n,
65
- l,
65
+ o,
66
66
  i,
67
67
  h,
68
68
  s + 1,
69
69
  I
70
70
  ),
71
- g
71
+ x
72
72
  )), (r === "always" || w && r === "visible") && (e[e.length] = {
73
73
  dataIndex: -1,
74
- dataItem: t[x],
74
+ dataItem: t[g],
75
75
  rowType: "groupFooter",
76
76
  level: s,
77
77
  expanded: w
78
78
  });
79
79
  }
80
- return g;
80
+ return x;
81
81
  }
82
82
  function H(e, t) {
83
83
  for (let r = 0; r < e.length; r++) {
@@ -98,14 +98,14 @@ function Z(e, t, r) {
98
98
  0
99
99
  ));
100
100
  const n = [];
101
- let l = 1;
101
+ let o = 1;
102
102
  return e.forEach((i, h) => {
103
103
  a[i.depth] = a[i.depth] || [];
104
104
  let s = !1;
105
- a[i.depth].length === 0 && (l <= 1 ? l = 1 + (i.children.length > 0 ? 0 : d - i.depth) : (l--, s = !0)), i.rowSpan = 1 + (i.children.length > 0 ? 0 : d - i.depth), i.kFirst = s, i.index = a[i.depth].length, a[i.depth].push(h), i.ariaColumnIndex = n[i.depth] ? n[i.depth] + 1 : 1;
105
+ a[i.depth].length === 0 && (o <= 1 ? o = 1 + (i.children.length > 0 ? 0 : d - i.depth) : (o--, s = !0)), i.rowSpan = 1 + (i.children.length > 0 ? 0 : d - i.depth), i.kFirst = s, i.index = a[i.depth].length, a[i.depth].push(h), i.ariaColumnIndex = n[i.depth] ? n[i.depth] + 1 : 1;
106
106
  for (let f = i.depth; f < i.depth + i.rowSpan; f++)
107
107
  n[f] = (n[f] || 0) + i.headerColSpan;
108
- }), H(e, t), F(a, e, r), R(a, e, r), a;
108
+ }), H(e, t), W(a, e, r), F(a, e, r), a;
109
109
  }
110
110
  function T(e, t, r, a = 0, d = !1) {
111
111
  const n = [];
@@ -113,23 +113,23 @@ function T(e, t, r, a = 0, d = !1) {
113
113
  return [];
114
114
  e && e.length === void 0 && (e = [e]), e.forEach((i, h) => {
115
115
  i = i.props ? i.props : i;
116
- const s = i.id ? i.id : b.generateNavigatableId(`${r.prevId++}`, r.idPrefix, "column"), f = M && i.media && window.matchMedia ? !window.matchMedia(i.media).matches : !1, g = d || f || i.hidden, c = t == null ? void 0 : t.find((I) => I.id === s), x = T(i.children, (c == null ? void 0 : c.children) || [], r, a + 1, g);
116
+ const s = i.id ? i.id : b.generateNavigatableId(`${r.prevId++}`, r.idPrefix, "column"), f = M && i.media && window.matchMedia ? !window.matchMedia(i.media).matches : !1, x = d || f || i.hidden, c = t == null ? void 0 : t.find((I) => I.id === s), g = T(i.children, (c == null ? void 0 : c.children) || [], r, a + 1, x);
117
117
  n.push(
118
118
  Object.assign(
119
119
  { depth: a },
120
120
  p,
121
- x.length ? { cell: () => null, filterCell: () => null } : {},
121
+ g.length ? { cell: () => null, filterCell: () => null } : {},
122
122
  i,
123
123
  {
124
124
  id: s,
125
125
  declarationIndex: n.length,
126
- children: x,
126
+ children: g,
127
127
  headerColSpan: 0,
128
128
  rowSpan: 0,
129
129
  columnType: i.columnType || "data",
130
130
  colSpan: i.colSpan || 1,
131
131
  isAccessible: !0,
132
- hidden: g,
132
+ hidden: x,
133
133
  left: null,
134
134
  right: null,
135
135
  rowSpannable: i.rowSpannable
@@ -138,10 +138,10 @@ function T(e, t, r, a = 0, d = !1) {
138
138
  )
139
139
  );
140
140
  });
141
- const l = (i, h) => i.orderIndex === h.orderIndex ? i.declarationIndex - h.declarationIndex : (i.orderIndex || 0) - (h.orderIndex || 0);
142
- if (n.sort(l), a === 0) {
143
- const i = [], h = (s, f) => s.forEach((g) => {
144
- g.parentIndex = f, h(g.children, i.push(g) - 1);
141
+ const o = (i, h) => i.orderIndex === h.orderIndex ? i.declarationIndex - h.declarationIndex : (i.orderIndex || 0) - (h.orderIndex || 0);
142
+ if (n.sort(o), a === 0) {
143
+ const i = [], h = (s, f) => s.forEach((x) => {
144
+ x.parentIndex = f, h(x.children, i.push(x) - 1);
145
145
  });
146
146
  return h(n, -1), i;
147
147
  }
@@ -151,11 +151,11 @@ const k = (e) => Array.isArray(e) ? e : e ? e.data : [];
151
151
  function _(e, t, r, a) {
152
152
  const d = k(e), n = [];
153
153
  if (d.length > 0) {
154
- let l = d[0];
154
+ let o = d[0];
155
155
  if (t)
156
156
  for (let h = 0; h < t.length; h++)
157
- l = l.items && l.items[0];
158
- Object.getOwnPropertyNames(l).forEach((h) => {
157
+ o = o.items && o.items[0];
158
+ Object.getOwnPropertyNames(o).forEach((h) => {
159
159
  h !== r.column && n.push(
160
160
  Object.assign(
161
161
  {
@@ -199,7 +199,7 @@ const j = (e, t) => {
199
199
  let t = e.width;
200
200
  return typeof (e == null ? void 0 : e.width) == "number" && (e != null && e.minResizableWidth) && (e == null ? void 0 : e.width) < (e == null ? void 0 : e.minResizableWidth) && (t = e == null ? void 0 : e.minResizableWidth), typeof (e == null ? void 0 : e.width) == "number" && (e != null && e.minWidth) && (e == null ? void 0 : e.width) < (e == null ? void 0 : e.minWidth) ? t = e == null ? void 0 : e.minWidth : typeof (e == null ? void 0 : e.width) == "number" && (e != null && e.maxWidth) && (e == null ? void 0 : e.width) > (e == null ? void 0 : e.maxWidth) && (t = e == null ? void 0 : e.maxWidth), t !== void 0 ? Math.floor(parseFloat(t.toString())) + "px" : void 0;
201
201
  }, u = (e, t) => t && t.filter((r) => r.field === e).length > 0, B = (e) => (e.sort((t, r) => t.declarationIndex - r.declarationIndex), e.map((t) => {
202
- const { declarationIndex: r, parentIndex: a, depth: d, headerColSpan: n, rowSpan: l, index: i, kFirst: h, children: s, ...f } = t;
202
+ const { declarationIndex: r, parentIndex: a, depth: d, headerColSpan: n, rowSpan: o, index: i, kFirst: h, children: s, ...f } = t;
203
203
  return s.length ? {
204
204
  children: B(s),
205
205
  ...f
@@ -227,18 +227,18 @@ const j = (e, t) => {
227
227
  return r(e), t;
228
228
  }, ee = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), te = 17895697, ie = (e) => {
229
229
  let t = [];
230
- return e.sortable && (t = t.concat([o.sortAsc, o.sortDesc])), e.pdf && (t.length && (t = t.concat([o.separator])), t = t.concat([o.exportPDF])), t;
230
+ return e.sortable && (t = t.concat([l.sortAsc, l.sortDesc])), e.pdf && (t.length && (t = t.concat([l.separator])), t = t.concat([l.exportPDF])), t;
231
231
  }, re = (e) => {
232
232
  let t = [];
233
233
  return e.clipboard && (t = t.concat([
234
- o.copySelection,
235
- o.copySelectionNoHeaders,
236
- o.paste
237
- ])), e.editable && (t.length && (t = t.concat([o.separator])), t = t.concat([
238
- o.create,
239
- o.edit,
240
- o.delete
241
- ])), e.selectable && (t.length && (t = t.concat([o.separator])), t = t.concat([o.select])), e.rowReorderable && (t.length && (t = t.concat([o.separator])), t = t.concat([o.reorderRow])), e.pdf && (t.length && (t = t.concat([o.separator])), t = t.concat([o.exportPDF])), t;
234
+ l.copySelection,
235
+ l.copySelectionNoHeaders,
236
+ l.paste
237
+ ])), e.editable && (t.length && (t = t.concat([l.separator])), t = t.concat([
238
+ l.create,
239
+ l.edit,
240
+ l.delete
241
+ ])), e.selectable && (t.length && (t = t.concat([l.separator])), t = t.concat([l.select])), e.rowReorderable && (t.length && (t = t.concat([l.separator])), t = t.concat([l.reorderRow])), e.pdf && (t.length && (t = t.concat([l.separator])), t = t.concat([l.exportPDF])), e.pinnable && (t.length && (t = t.concat([l.separator])), t = t.concat([l.pinRow])), t;
242
242
  }, ae = (e, t) => {
243
243
  if (!(!e && !t))
244
244
  return t ? e ? {
@@ -292,7 +292,7 @@ const j = (e, t) => {
292
292
  group: e.group
293
293
  }), se = (e) => {
294
294
  var a, d;
295
- const t = typeof e == "object" ? (a = e.enabled) != null ? a : !0 : e != null ? e : !1, r = typeof e == "object" ? (d = e.valueGetter) != null ? d : ((n, l) => S(l)(n)) : (n, l) => S(l)(n);
295
+ const t = typeof e == "object" ? (a = e.enabled) != null ? a : !0 : e != null ? e : !1, r = typeof e == "object" ? (d = e.valueGetter) != null ? d : ((n, o) => S(o)(n)) : (n, o) => S(o)(n);
296
296
  return { enabled: t, valueGetter: r };
297
297
  }, $ = (e) => {
298
298
  var t;