@progress/kendo-react-grid 5.12.0-dev.202303130940 → 5.12.0-dev.202303141413

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/dist/es/Grid.d.ts CHANGED
@@ -206,6 +206,7 @@ export declare class Grid extends React.Component<GridProps, {}> {
206
206
  * @hidden
207
207
  */
208
208
  render(): JSX.Element;
209
+ private onContextMenu;
209
210
  private getVirtualScroll;
210
211
  private isAllData;
211
212
  private initializeVirtualization;
package/dist/es/Grid.js CHANGED
@@ -147,6 +147,18 @@ var Grid = /** @class */ (function (_super) {
147
147
  _this.fitColumns = function (columnIds) {
148
148
  _this.columnResize.dblClickHandler(null, columnIds);
149
149
  };
150
+ _this.onContextMenu = function (event, dataItem, field) {
151
+ if (_this.props.onContextMenu) {
152
+ var ev = {
153
+ target: _this,
154
+ syntheticEvent: event,
155
+ nativeEvent: event.nativeEvent,
156
+ dataItem: dataItem,
157
+ field: field
158
+ };
159
+ _this.props.onContextMenu.call(undefined, ev);
160
+ }
161
+ };
150
162
  _this.getVirtualScroll = function (props) {
151
163
  var rowHeight = props.rowHeight, detailRowHeight = props.detailRowHeight, detail = props.detail, expandField = props.expandField, groupable = props.groupable;
152
164
  var hasAllData = _this.isAllData();
@@ -611,7 +623,7 @@ var Grid = /** @class */ (function (_super) {
611
623
  }
612
624
  }
613
625
  var Cell = column.cell || (currentColumnIsInEdit && GridEditCell) || GridCell;
614
- return (React.createElement(Cell, { key: columnKey, locked: _this.props.lockGroups, id: navigationTools.generateNavigatableId("".concat(rowId, "-").concat(String(columnIndex)), idPrefix), colSpan: colSpans[columnIndex], dataItem: item.dataItem, field: column.field, editor: column.editor, format: column.format, className: className, render: _this.props.cellRender, onChange: _this.itemChange, selectionChange: (_this.props.onSelectionChange) ?
626
+ return (React.createElement(Cell, { onContextMenu: _this.onContextMenu, key: columnKey, locked: _this.props.lockGroups, id: navigationTools.generateNavigatableId("".concat(rowId, "-").concat(String(columnIndex)), idPrefix), colSpan: colSpans[columnIndex], dataItem: item.dataItem, field: column.field, editor: column.editor, format: column.format, className: className, render: _this.props.cellRender, onChange: _this.itemChange, selectionChange: (_this.props.onSelectionChange) ?
615
627
  (function (e) { _this.selectionChange({ event: e, dataItem: item.dataItem, dataIndex: rowDataIndex, columnIndex: columnIndex }); }) :
616
628
  undefined, columnIndex: columnIndex, columnsCount: leafColumns.length, rowType: item.rowType, level: item.level, expanded: item.expanded, dataIndex: item.dataIndex, style: style, ariaColumnIndex: column.ariaColumnIndex, isSelected: Array.isArray(selectedValue) && selectedValue.indexOf(columnIndex) > -1 }));
617
629
  }),
@@ -677,7 +689,7 @@ var Grid = /** @class */ (function (_super) {
677
689
  }),
678
690
  _this.props.expandField &&
679
691
  React.createElement(GridDetailHierarchyCell, { id: navigationTools.generateNavigatableId("".concat(detailRowId, "-dhcell"), idPrefix) }),
680
- React.createElement(GridDetailCell, { dataItem: item.dataItem, dataIndex: item.dataIndex, colSpan: detailColspan, ariaColIndex: 2 + (_this.props.group ? _this.props.group.length : 0), detail: _this.props.detail, id: navigationTools.generateNavigatableId("".concat(detailRowId, "-dcell"), idPrefix) }))));
692
+ React.createElement(GridDetailCell, { onContextMenu: _this.onContextMenu, dataItem: item.dataItem, dataIndex: item.dataIndex, colSpan: detailColspan, ariaColIndex: 2 + (_this.props.group ? _this.props.group.length : 0), detail: _this.props.detail, id: navigationTools.generateNavigatableId("".concat(detailRowId, "-dcell"), idPrefix) }))));
681
693
  }
682
694
  });
683
695
  }
@@ -746,7 +758,7 @@ var Grid = /** @class */ (function (_super) {
746
758
  _this.tableElement = table;
747
759
  } },
748
760
  React.createElement("table", { className: classNames('k-table k-grid-table', (_c = {
749
- 'k-grid-md': !this.props.size
761
+ 'k-table-md': !this.props.size
750
762
  },
751
763
  _c["k-table-".concat(kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
752
764
  _c)), role: "presentation", style: { userSelect: tableUserSelect, display: tableDisplay } },
@@ -20,8 +20,13 @@ export var GridCell = function (props) {
20
20
  var defaultRendering = null;
21
21
  var intl = useInternationalization();
22
22
  var navigationAttributes = useTableKeyboardNavigation(props.id);
23
+ var onContextMenu = React.useCallback(function (event) {
24
+ if (props.onContextMenu) {
25
+ props.onContextMenu.call(undefined, event, props.dataItem, props.field);
26
+ }
27
+ }, [props.onContextMenu, props.dataItem, props.field]);
23
28
  if (props.rowType === 'groupFooter') {
24
- defaultRendering = React.createElement("td", { className: props.className });
29
+ defaultRendering = React.createElement("td", { onContextMenu: onContextMenu, className: props.className });
25
30
  }
26
31
  else if (props.field !== undefined && props.rowType !== 'groupHeader') {
27
32
  var data = getNestedValue(props.field, props.dataItem);
@@ -32,7 +37,7 @@ export var GridCell = function (props) {
32
37
  data.toString();
33
38
  }
34
39
  var className = classNames('k-table-td', props.className, { 'k-selected': props.isSelected });
35
- defaultRendering = (React.createElement("td", __assign({ colSpan: props.colSpan, style: props.style, className: className, role: 'gridcell', "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_a = {}, _a[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _a), navigationAttributes), dataAsString));
40
+ defaultRendering = (React.createElement("td", __assign({ onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: className, role: 'gridcell', "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_a = {}, _a[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _a), navigationAttributes), dataAsString));
36
41
  }
37
42
  return props.render ?
38
43
  props.render.call(undefined, defaultRendering, props) :
@@ -8,6 +8,7 @@ export interface GridDetailCellProps {
8
8
  dataIndex: number;
9
9
  detail: React.ComponentType<GridDetailRowProps>;
10
10
  id: string;
11
+ onContextMenu?: (event: React.MouseEvent<HTMLElement>, dataItem: any) => void;
11
12
  }
12
13
  /** @hidden */
13
14
  export declare const GridDetailCell: (props: GridDetailCellProps) => JSX.Element;
@@ -15,6 +15,11 @@ import * as React from 'react';
15
15
  export var GridDetailCell = function (props) {
16
16
  var colSpan = props.colSpan, ariaColIndex = props.ariaColIndex, dataItem = props.dataItem, dataIndex = props.dataIndex, id = props.id;
17
17
  var navigationAttributes = useTableKeyboardNavigation(id);
18
- return (React.createElement("td", __assign({ className: "k-table-td k-detail-cell", colSpan: colSpan, "aria-colindex": ariaColIndex, role: 'gridcell' }, navigationAttributes),
18
+ var onContextMenu = React.useCallback(function (event) {
19
+ if (props.onContextMenu) {
20
+ props.onContextMenu.call(undefined, event, props.dataItem);
21
+ }
22
+ }, [props.onContextMenu, props.dataItem]);
23
+ return (React.createElement("td", __assign({ onContextMenu: onContextMenu, className: "k-table-td k-detail-cell", colSpan: colSpan, "aria-colindex": ariaColIndex, role: 'gridcell' }, navigationAttributes),
19
24
  React.createElement(props.detail, { dataItem: dataItem, dataIndex: dataIndex })));
20
25
  };
@@ -42,6 +42,11 @@ export var GridEditCell = function (props) {
42
42
  });
43
43
  }
44
44
  }, [props.onChange, props.dataItem, props.dataIndex, props.field]);
45
+ var onContextMenu = React.useCallback(function (event) {
46
+ if (props.onContextMenu) {
47
+ props.onContextMenu.call(undefined, event, props.dataItem, props.field);
48
+ }
49
+ }, [props.onContextMenu, props.dataItem, props.field]);
45
50
  var inputChange = React.useCallback(function (e) {
46
51
  if (props.onChange) {
47
52
  props.onChange({
@@ -55,20 +60,20 @@ export var GridEditCell = function (props) {
55
60
  }, [props.onChange, props.dataItem, props.dataIndex, props.field]);
56
61
  switch (props.editor) {
57
62
  case 'numeric':
58
- defaultRendering = (React.createElement("td", __assign({ colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_b = {}, _b[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _b), { role: 'gridcell' }, navigationAttributes),
63
+ defaultRendering = (React.createElement("td", __assign({ onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_b = {}, _b[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _b), { role: 'gridcell' }, navigationAttributes),
59
64
  React.createElement(NumericTextBox, { width: "100%", value: (data === undefined) ? null : data, onChange: inputChange })));
60
65
  break;
61
66
  case 'date':
62
- defaultRendering = (React.createElement("td", __assign({ colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_c = {}, _c[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _c), { role: 'gridcell' }, navigationAttributes),
67
+ defaultRendering = (React.createElement("td", __assign({ onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_c = {}, _c[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _c), { role: 'gridcell' }, navigationAttributes),
63
68
  React.createElement(DatePicker, { width: "100%", value: data, onChange: inputChange })));
64
69
  break;
65
70
  case 'boolean':
66
- defaultRendering = (React.createElement("td", __assign({ colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_d = {}, _d[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _d), { role: 'gridcell' }, navigationAttributes),
71
+ defaultRendering = (React.createElement("td", __assign({ onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_d = {}, _d[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _d), { role: 'gridcell' }, navigationAttributes),
67
72
  React.createElement("input", { checked: data || false, id: inputId, type: "checkbox", className: "k-checkbox k-checkbox-md k-rounded-md", onChange: handleOnChange }),
68
73
  React.createElement("label", { className: "k-checkbox-label", htmlFor: inputId })));
69
74
  break;
70
75
  default:
71
- defaultRendering = (React.createElement("td", __assign({ colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_e = {}, _e[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _e), { role: 'gridcell' }, navigationAttributes),
76
+ defaultRendering = (React.createElement("td", __assign({ onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_e = {}, _e[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _e), { role: 'gridcell' }, navigationAttributes),
72
77
  React.createElement("input", { style: { width: '100%' }, className: "k-input", value: data || '', onChange: handleOnChange })));
73
78
  }
74
79
  return props.render ?
@@ -39,10 +39,15 @@ export var GridGroupCell = function (props) {
39
39
  });
40
40
  }
41
41
  }, [expanded, onChange, dataItem, dataIndex]);
42
+ var onContextMenu = React.useCallback(function (event) {
43
+ if (props.onContextMenu) {
44
+ props.onContextMenu.call(undefined, event, props.dataItem, props.field);
45
+ }
46
+ }, [props.onContextMenu, props.dataItem, props.field]);
42
47
  var renderCellCollapse = function (colspan, styles) {
43
48
  var baseMessage = expanded ? groupCollapse : groupExpand;
44
49
  var message = localization.toLanguageString(baseMessage, messages[baseMessage]);
45
- return (React.createElement("td", __assign({ className: 'k-table-td', style: __assign(__assign({}, props.style), styles), colSpan: colspan, key: 'g-colspan', role: 'gridcell', "aria-selected": false, "aria-expanded": expanded, "aria-colindex": ariaColumnIndex, onKeyDown: onKeyDownHandler }, navigationAttributes),
50
+ return (React.createElement("td", __assign({ className: 'k-table-td', style: __assign(__assign({}, props.style), styles), colSpan: colspan, key: 'g-colspan', role: 'gridcell', "aria-selected": false, "aria-expanded": expanded, "aria-colindex": ariaColumnIndex, onKeyDown: onKeyDownHandler, onContextMenu: onContextMenu }, navigationAttributes),
46
51
  React.createElement("p", { className: "k-reset" },
47
52
  React.createElement("a", { onClick: function (e) {
48
53
  e.preventDefault();
@@ -63,7 +68,7 @@ export var GridGroupCell = function (props) {
63
68
  };
64
69
  if (columnIndex === undefined || level === undefined || columnIndex < level ||
65
70
  columnsCount === undefined || rowType !== 'groupHeader' || dataItem[definedField] === undefined) {
66
- defaultRendering = (React.createElement("td", { style: props.style, key: 'g' + columnIndex, className: classNames('k-table-td', 'k-group-cell', { 'k-grid-content-sticky': props.locked }), role: "gridcell" }));
71
+ defaultRendering = (React.createElement("td", { style: props.style, key: 'g' + columnIndex, className: classNames('k-table-td', 'k-group-cell', { 'k-grid-content-sticky': props.locked }), role: "gridcell", onContextMenu: onContextMenu }));
67
72
  }
68
73
  else if (columnIndex <= level && !props.locked) {
69
74
  defaultRendering = renderCellCollapse(columnsCount - columnIndex, {});
@@ -71,7 +76,7 @@ export var GridGroupCell = function (props) {
71
76
  else if (columnIndex <= level && props.locked) {
72
77
  defaultRendering = (React.createElement(React.Fragment, null,
73
78
  renderCellCollapse(0, { position: 'sticky', zIndex: 2 }),
74
- React.createElement("td", { className: 'k-table-td', role: 'gridcell', colSpan: (columnsCount - columnIndex), style: { borderLeftWidth: 0, borderRightWidth: 0 } })));
79
+ React.createElement("td", { className: 'k-table-td', role: 'gridcell', colSpan: (columnsCount - columnIndex), style: { borderLeftWidth: 0, borderRightWidth: 0 }, onContextMenu: onContextMenu })));
75
80
  }
76
81
  return render ?
77
82
  render.call(undefined, defaultRendering, props) :
@@ -58,7 +58,7 @@ var Footer = /** @class */ (function (_super) {
58
58
  return (React.createElement("div", { className: "k-grid-footer", role: "presentation" },
59
59
  React.createElement("div", { ref: function (div) { _this.footerWrap = div; }, className: "k-grid-footer-wrap", style: this.scrollbarWidth ? {} : { borderWidth: 0 }, role: "presentation" },
60
60
  React.createElement("table", { ref: function (table) { _this.table = table; }, className: classNames('k-table k-grid-footer-table', (_a = {
61
- 'k-grid-md': !this.props.size
61
+ 'k-table-md': !this.props.size
62
62
  },
63
63
  _a["k-table-".concat(kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
64
64
  _a), this.props.className), role: "presentation" },
@@ -46,7 +46,7 @@ var GroupPanel = /** @class */ (function (_super) {
46
46
  _this.onGroupSortChange(event, index, groupDesc, dir);
47
47
  }, onPress: _this.props.pressHandler, onDrag: _this.props.dragHandler, onRelease: _this.props.releaseHandler })); });
48
48
  return (React.createElement("div", { ref: this.props.refCallback, className: "k-grouping-header", role: "toolbar", "aria-label": intl(this).toLanguageString(groupPanelAriaLabel, messages[groupPanelAriaLabel]) },
49
- React.createElement("div", { className: "k-chip-list k-chip-list-md" }, groups),
49
+ React.createElement("div", { className: "k-chip-list k-chip-list-md", role: "none" }, groups),
50
50
  React.createElement("div", { className: "k-grouping-drop-container" },
51
51
  !groups.length && intl(this).toLanguageString(messageKey, messages[messageKey]),
52
52
  "\u00A0")));
@@ -54,4 +54,8 @@ export interface GridCellProps extends Omit<CellProps, 'onChange' | 'render'> {
54
54
  * @hidden
55
55
  */
56
56
  locked?: boolean | undefined;
57
+ /**
58
+ * The event that is fired when the ContextMenu is activated.
59
+ */
60
+ onContextMenu?: (event: React.MouseEvent<HTMLElement>, dataItem: any, field?: string) => void;
57
61
  }
@@ -1,7 +1,7 @@
1
1
  import { ComponentType } from 'react';
2
2
  import { DataResult, SortDescriptor, CompositeFilterDescriptor, GroupDescriptor } from '@progress/kendo-data-query';
3
3
  import { GridGroupableSettings } from './GridGroupableSettings';
4
- import { GridSortChangeEvent, GridFilterChangeEvent, GridPageChangeEvent, GridExpandChangeEvent, GridSelectionChangeEvent, GridHeaderSelectionChangeEvent, GridRowClickEvent, GridItemChangeEvent, GridDataStateChangeEvent, GridColumnResizeEvent, GridColumnReorderEvent, GridGroupChangeEvent, GridEvent, GridRowDoubleClickEvent, GridNavigationActionEvent, GridKeyDownEvent } from './events';
4
+ import { GridSortChangeEvent, GridFilterChangeEvent, GridPageChangeEvent, GridExpandChangeEvent, GridSelectionChangeEvent, GridHeaderSelectionChangeEvent, GridRowClickEvent, GridItemChangeEvent, GridDataStateChangeEvent, GridColumnResizeEvent, GridColumnReorderEvent, GridGroupChangeEvent, GridEvent, GridRowDoubleClickEvent, GridNavigationActionEvent, GridKeyDownEvent, GridContextMenuEvent } from './events';
5
5
  import { ScrollMode } from '../ScrollMode';
6
6
  import { GridCellProps } from './GridCellProps';
7
7
  import { GridFilterCellProps } from './GridFilterCellProps';
@@ -305,4 +305,8 @@ export interface GridProps extends KendoReactComponentBaseProps {
305
305
  * @default `medium`
306
306
  */
307
307
  size?: 'small' | 'medium';
308
+ /**
309
+ * The event that is fired when the ContextMenu is activated.
310
+ */
311
+ onContextMenu?: (event: GridContextMenuEvent) => void;
308
312
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SortDescriptor, CompositeFilterDescriptor, GroupDescriptor, State } from '@progress/kendo-data-query';
2
3
  import { Grid } from '../Grid';
3
4
  import { Page } from '../paging/Page';
@@ -119,6 +120,23 @@ export interface GridHeaderSelectionChangeEvent extends GridEvent {
119
120
  */
120
121
  selectedField: string;
121
122
  }
123
+ /**
124
+ * Represents the object of the `onContextMenu` Grid event.
125
+ */
126
+ export interface GridContextMenuEvent extends GridEvent {
127
+ /**
128
+ * The data object that represents the current row.
129
+ */
130
+ dataItem: any;
131
+ /**
132
+ * The field to which the cell is bound.
133
+ */
134
+ field?: string;
135
+ /**
136
+ * A React Synthetic Event.
137
+ */
138
+ syntheticEvent: React.MouseEvent<any>;
139
+ }
122
140
  /**
123
141
  * Represents the object of the `GridNavigationActionEvent` Grid event.
124
142
  */
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-grid',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1678699632,
8
+ publishDate: 1678802439,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
11
  };
@@ -206,6 +206,7 @@ export declare class Grid extends React.Component<GridProps, {}> {
206
206
  * @hidden
207
207
  */
208
208
  render(): JSX.Element;
209
+ private onContextMenu;
209
210
  private getVirtualScroll;
210
211
  private isAllData;
211
212
  private initializeVirtualization;
package/dist/npm/Grid.js CHANGED
@@ -150,6 +150,18 @@ var Grid = /** @class */ (function (_super) {
150
150
  _this.fitColumns = function (columnIds) {
151
151
  _this.columnResize.dblClickHandler(null, columnIds);
152
152
  };
153
+ _this.onContextMenu = function (event, dataItem, field) {
154
+ if (_this.props.onContextMenu) {
155
+ var ev = {
156
+ target: _this,
157
+ syntheticEvent: event,
158
+ nativeEvent: event.nativeEvent,
159
+ dataItem: dataItem,
160
+ field: field
161
+ };
162
+ _this.props.onContextMenu.call(undefined, ev);
163
+ }
164
+ };
153
165
  _this.getVirtualScroll = function (props) {
154
166
  var rowHeight = props.rowHeight, detailRowHeight = props.detailRowHeight, detail = props.detail, expandField = props.expandField, groupable = props.groupable;
155
167
  var hasAllData = _this.isAllData();
@@ -614,7 +626,7 @@ var Grid = /** @class */ (function (_super) {
614
626
  }
615
627
  }
616
628
  var Cell = column.cell || (currentColumnIsInEdit && GridEditCell_1.GridEditCell) || GridCell_1.GridCell;
617
- return (React.createElement(Cell, { key: columnKey, locked: _this.props.lockGroups, id: kendo_react_data_tools_1.tableKeyboardNavigationTools.generateNavigatableId("".concat(rowId, "-").concat(String(columnIndex)), idPrefix), colSpan: colSpans[columnIndex], dataItem: item.dataItem, field: column.field, editor: column.editor, format: column.format, className: className, render: _this.props.cellRender, onChange: _this.itemChange, selectionChange: (_this.props.onSelectionChange) ?
629
+ return (React.createElement(Cell, { onContextMenu: _this.onContextMenu, key: columnKey, locked: _this.props.lockGroups, id: kendo_react_data_tools_1.tableKeyboardNavigationTools.generateNavigatableId("".concat(rowId, "-").concat(String(columnIndex)), idPrefix), colSpan: colSpans[columnIndex], dataItem: item.dataItem, field: column.field, editor: column.editor, format: column.format, className: className, render: _this.props.cellRender, onChange: _this.itemChange, selectionChange: (_this.props.onSelectionChange) ?
618
630
  (function (e) { _this.selectionChange({ event: e, dataItem: item.dataItem, dataIndex: rowDataIndex, columnIndex: columnIndex }); }) :
619
631
  undefined, columnIndex: columnIndex, columnsCount: leafColumns.length, rowType: item.rowType, level: item.level, expanded: item.expanded, dataIndex: item.dataIndex, style: style, ariaColumnIndex: column.ariaColumnIndex, isSelected: Array.isArray(selectedValue) && selectedValue.indexOf(columnIndex) > -1 }));
620
632
  }),
@@ -680,7 +692,7 @@ var Grid = /** @class */ (function (_super) {
680
692
  }),
681
693
  _this.props.expandField &&
682
694
  React.createElement(GridDetailHierarchyCell_1.GridDetailHierarchyCell, { id: kendo_react_data_tools_1.tableKeyboardNavigationTools.generateNavigatableId("".concat(detailRowId, "-dhcell"), idPrefix) }),
683
- React.createElement(GridDetailCell_1.GridDetailCell, { dataItem: item.dataItem, dataIndex: item.dataIndex, colSpan: detailColspan, ariaColIndex: 2 + (_this.props.group ? _this.props.group.length : 0), detail: _this.props.detail, id: kendo_react_data_tools_1.tableKeyboardNavigationTools.generateNavigatableId("".concat(detailRowId, "-dcell"), idPrefix) }))));
695
+ React.createElement(GridDetailCell_1.GridDetailCell, { onContextMenu: _this.onContextMenu, dataItem: item.dataItem, dataIndex: item.dataIndex, colSpan: detailColspan, ariaColIndex: 2 + (_this.props.group ? _this.props.group.length : 0), detail: _this.props.detail, id: kendo_react_data_tools_1.tableKeyboardNavigationTools.generateNavigatableId("".concat(detailRowId, "-dcell"), idPrefix) }))));
684
696
  }
685
697
  });
686
698
  }
@@ -749,7 +761,7 @@ var Grid = /** @class */ (function (_super) {
749
761
  _this.tableElement = table;
750
762
  } },
751
763
  React.createElement("table", { className: (0, kendo_react_common_1.classNames)('k-table k-grid-table', (_c = {
752
- 'k-grid-md': !this.props.size
764
+ 'k-table-md': !this.props.size
753
765
  },
754
766
  _c["k-table-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
755
767
  _c)), role: "presentation", style: { userSelect: tableUserSelect, display: tableDisplay } },
@@ -23,8 +23,13 @@ var GridCell = function (props) {
23
23
  var defaultRendering = null;
24
24
  var intl = (0, kendo_react_intl_1.useInternationalization)();
25
25
  var navigationAttributes = (0, kendo_react_data_tools_1.useTableKeyboardNavigation)(props.id);
26
+ var onContextMenu = React.useCallback(function (event) {
27
+ if (props.onContextMenu) {
28
+ props.onContextMenu.call(undefined, event, props.dataItem, props.field);
29
+ }
30
+ }, [props.onContextMenu, props.dataItem, props.field]);
26
31
  if (props.rowType === 'groupFooter') {
27
- defaultRendering = React.createElement("td", { className: props.className });
32
+ defaultRendering = React.createElement("td", { onContextMenu: onContextMenu, className: props.className });
28
33
  }
29
34
  else if (props.field !== undefined && props.rowType !== 'groupHeader') {
30
35
  var data = (0, utils_1.getNestedValue)(props.field, props.dataItem);
@@ -35,7 +40,7 @@ var GridCell = function (props) {
35
40
  data.toString();
36
41
  }
37
42
  var className = (0, kendo_react_common_1.classNames)('k-table-td', props.className, { 'k-selected': props.isSelected });
38
- defaultRendering = (React.createElement("td", __assign({ colSpan: props.colSpan, style: props.style, className: className, role: 'gridcell', "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_a = {}, _a[constants_1.GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _a), navigationAttributes), dataAsString));
43
+ defaultRendering = (React.createElement("td", __assign({ onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: className, role: 'gridcell', "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_a = {}, _a[constants_1.GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _a), navigationAttributes), dataAsString));
39
44
  }
40
45
  return props.render ?
41
46
  props.render.call(undefined, defaultRendering, props) :
@@ -8,6 +8,7 @@ export interface GridDetailCellProps {
8
8
  dataIndex: number;
9
9
  detail: React.ComponentType<GridDetailRowProps>;
10
10
  id: string;
11
+ onContextMenu?: (event: React.MouseEvent<HTMLElement>, dataItem: any) => void;
11
12
  }
12
13
  /** @hidden */
13
14
  export declare const GridDetailCell: (props: GridDetailCellProps) => JSX.Element;
@@ -18,7 +18,12 @@ var React = require("react");
18
18
  var GridDetailCell = function (props) {
19
19
  var colSpan = props.colSpan, ariaColIndex = props.ariaColIndex, dataItem = props.dataItem, dataIndex = props.dataIndex, id = props.id;
20
20
  var navigationAttributes = (0, kendo_react_data_tools_1.useTableKeyboardNavigation)(id);
21
- return (React.createElement("td", __assign({ className: "k-table-td k-detail-cell", colSpan: colSpan, "aria-colindex": ariaColIndex, role: 'gridcell' }, navigationAttributes),
21
+ var onContextMenu = React.useCallback(function (event) {
22
+ if (props.onContextMenu) {
23
+ props.onContextMenu.call(undefined, event, props.dataItem);
24
+ }
25
+ }, [props.onContextMenu, props.dataItem]);
26
+ return (React.createElement("td", __assign({ onContextMenu: onContextMenu, className: "k-table-td k-detail-cell", colSpan: colSpan, "aria-colindex": ariaColIndex, role: 'gridcell' }, navigationAttributes),
22
27
  React.createElement(props.detail, { dataItem: dataItem, dataIndex: dataIndex })));
23
28
  };
24
29
  exports.GridDetailCell = GridDetailCell;
@@ -45,6 +45,11 @@ var GridEditCell = function (props) {
45
45
  });
46
46
  }
47
47
  }, [props.onChange, props.dataItem, props.dataIndex, props.field]);
48
+ var onContextMenu = React.useCallback(function (event) {
49
+ if (props.onContextMenu) {
50
+ props.onContextMenu.call(undefined, event, props.dataItem, props.field);
51
+ }
52
+ }, [props.onContextMenu, props.dataItem, props.field]);
48
53
  var inputChange = React.useCallback(function (e) {
49
54
  if (props.onChange) {
50
55
  props.onChange({
@@ -58,20 +63,20 @@ var GridEditCell = function (props) {
58
63
  }, [props.onChange, props.dataItem, props.dataIndex, props.field]);
59
64
  switch (props.editor) {
60
65
  case 'numeric':
61
- defaultRendering = (React.createElement("td", __assign({ colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_b = {}, _b[constants_1.GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _b), { role: 'gridcell' }, navigationAttributes),
66
+ defaultRendering = (React.createElement("td", __assign({ onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_b = {}, _b[constants_1.GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _b), { role: 'gridcell' }, navigationAttributes),
62
67
  React.createElement(kendo_react_inputs_1.NumericTextBox, { width: "100%", value: (data === undefined) ? null : data, onChange: inputChange })));
63
68
  break;
64
69
  case 'date':
65
- defaultRendering = (React.createElement("td", __assign({ colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_c = {}, _c[constants_1.GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _c), { role: 'gridcell' }, navigationAttributes),
70
+ defaultRendering = (React.createElement("td", __assign({ onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_c = {}, _c[constants_1.GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _c), { role: 'gridcell' }, navigationAttributes),
66
71
  React.createElement(kendo_react_dateinputs_1.DatePicker, { width: "100%", value: data, onChange: inputChange })));
67
72
  break;
68
73
  case 'boolean':
69
- defaultRendering = (React.createElement("td", __assign({ colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_d = {}, _d[constants_1.GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _d), { role: 'gridcell' }, navigationAttributes),
74
+ defaultRendering = (React.createElement("td", __assign({ onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_d = {}, _d[constants_1.GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _d), { role: 'gridcell' }, navigationAttributes),
70
75
  React.createElement("input", { checked: data || false, id: inputId, type: "checkbox", className: "k-checkbox k-checkbox-md k-rounded-md", onChange: handleOnChange }),
71
76
  React.createElement("label", { className: "k-checkbox-label", htmlFor: inputId })));
72
77
  break;
73
78
  default:
74
- defaultRendering = (React.createElement("td", __assign({ colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_e = {}, _e[constants_1.GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _e), { role: 'gridcell' }, navigationAttributes),
79
+ defaultRendering = (React.createElement("td", __assign({ onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses, "aria-colindex": props.ariaColumnIndex, "aria-selected": props.isSelected }, (_e = {}, _e[constants_1.GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _e), { role: 'gridcell' }, navigationAttributes),
75
80
  React.createElement("input", { style: { width: '100%' }, className: "k-input", value: data || '', onChange: handleOnChange })));
76
81
  }
77
82
  return props.render ?
@@ -42,10 +42,15 @@ var GridGroupCell = function (props) {
42
42
  });
43
43
  }
44
44
  }, [expanded, onChange, dataItem, dataIndex]);
45
+ var onContextMenu = React.useCallback(function (event) {
46
+ if (props.onContextMenu) {
47
+ props.onContextMenu.call(undefined, event, props.dataItem, props.field);
48
+ }
49
+ }, [props.onContextMenu, props.dataItem, props.field]);
45
50
  var renderCellCollapse = function (colspan, styles) {
46
51
  var baseMessage = expanded ? messages_1.groupCollapse : messages_1.groupExpand;
47
52
  var message = localization.toLanguageString(baseMessage, messages_1.messages[baseMessage]);
48
- return (React.createElement("td", __assign({ className: 'k-table-td', style: __assign(__assign({}, props.style), styles), colSpan: colspan, key: 'g-colspan', role: 'gridcell', "aria-selected": false, "aria-expanded": expanded, "aria-colindex": ariaColumnIndex, onKeyDown: onKeyDownHandler }, navigationAttributes),
53
+ return (React.createElement("td", __assign({ className: 'k-table-td', style: __assign(__assign({}, props.style), styles), colSpan: colspan, key: 'g-colspan', role: 'gridcell', "aria-selected": false, "aria-expanded": expanded, "aria-colindex": ariaColumnIndex, onKeyDown: onKeyDownHandler, onContextMenu: onContextMenu }, navigationAttributes),
49
54
  React.createElement("p", { className: "k-reset" },
50
55
  React.createElement("a", { onClick: function (e) {
51
56
  e.preventDefault();
@@ -66,7 +71,7 @@ var GridGroupCell = function (props) {
66
71
  };
67
72
  if (columnIndex === undefined || level === undefined || columnIndex < level ||
68
73
  columnsCount === undefined || rowType !== 'groupHeader' || dataItem[definedField] === undefined) {
69
- defaultRendering = (React.createElement("td", { style: props.style, key: 'g' + columnIndex, className: (0, kendo_react_common_1.classNames)('k-table-td', 'k-group-cell', { 'k-grid-content-sticky': props.locked }), role: "gridcell" }));
74
+ defaultRendering = (React.createElement("td", { style: props.style, key: 'g' + columnIndex, className: (0, kendo_react_common_1.classNames)('k-table-td', 'k-group-cell', { 'k-grid-content-sticky': props.locked }), role: "gridcell", onContextMenu: onContextMenu }));
70
75
  }
71
76
  else if (columnIndex <= level && !props.locked) {
72
77
  defaultRendering = renderCellCollapse(columnsCount - columnIndex, {});
@@ -74,7 +79,7 @@ var GridGroupCell = function (props) {
74
79
  else if (columnIndex <= level && props.locked) {
75
80
  defaultRendering = (React.createElement(React.Fragment, null,
76
81
  renderCellCollapse(0, { position: 'sticky', zIndex: 2 }),
77
- React.createElement("td", { className: 'k-table-td', role: 'gridcell', colSpan: (columnsCount - columnIndex), style: { borderLeftWidth: 0, borderRightWidth: 0 } })));
82
+ React.createElement("td", { className: 'k-table-td', role: 'gridcell', colSpan: (columnsCount - columnIndex), style: { borderLeftWidth: 0, borderRightWidth: 0 }, onContextMenu: onContextMenu })));
78
83
  }
79
84
  return render ?
80
85
  render.call(undefined, defaultRendering, props) :
@@ -61,7 +61,7 @@ var Footer = /** @class */ (function (_super) {
61
61
  return (React.createElement("div", { className: "k-grid-footer", role: "presentation" },
62
62
  React.createElement("div", { ref: function (div) { _this.footerWrap = div; }, className: "k-grid-footer-wrap", style: this.scrollbarWidth ? {} : { borderWidth: 0 }, role: "presentation" },
63
63
  React.createElement("table", { ref: function (table) { _this.table = table; }, className: (0, kendo_react_common_2.classNames)('k-table k-grid-footer-table', (_a = {
64
- 'k-grid-md': !this.props.size
64
+ 'k-table-md': !this.props.size
65
65
  },
66
66
  _a["k-table-".concat(kendo_react_common_2.kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
67
67
  _a), this.props.className), role: "presentation" },
@@ -49,7 +49,7 @@ var GroupPanel = /** @class */ (function (_super) {
49
49
  _this.onGroupSortChange(event, index, groupDesc, dir);
50
50
  }, onPress: _this.props.pressHandler, onDrag: _this.props.dragHandler, onRelease: _this.props.releaseHandler })); });
51
51
  return (React.createElement("div", { ref: this.props.refCallback, className: "k-grouping-header", role: "toolbar", "aria-label": (0, kendo_react_intl_1.provideLocalizationService)(this).toLanguageString(messages_1.groupPanelAriaLabel, messages_1.messages[messages_1.groupPanelAriaLabel]) },
52
- React.createElement("div", { className: "k-chip-list k-chip-list-md" }, groups),
52
+ React.createElement("div", { className: "k-chip-list k-chip-list-md", role: "none" }, groups),
53
53
  React.createElement("div", { className: "k-grouping-drop-container" },
54
54
  !groups.length && (0, kendo_react_intl_1.provideLocalizationService)(this).toLanguageString(messages_1.groupPanelEmpty, messages_1.messages[messages_1.groupPanelEmpty]),
55
55
  "\u00A0")));
@@ -54,4 +54,8 @@ export interface GridCellProps extends Omit<CellProps, 'onChange' | 'render'> {
54
54
  * @hidden
55
55
  */
56
56
  locked?: boolean | undefined;
57
+ /**
58
+ * The event that is fired when the ContextMenu is activated.
59
+ */
60
+ onContextMenu?: (event: React.MouseEvent<HTMLElement>, dataItem: any, field?: string) => void;
57
61
  }
@@ -1,7 +1,7 @@
1
1
  import { ComponentType } from 'react';
2
2
  import { DataResult, SortDescriptor, CompositeFilterDescriptor, GroupDescriptor } from '@progress/kendo-data-query';
3
3
  import { GridGroupableSettings } from './GridGroupableSettings';
4
- import { GridSortChangeEvent, GridFilterChangeEvent, GridPageChangeEvent, GridExpandChangeEvent, GridSelectionChangeEvent, GridHeaderSelectionChangeEvent, GridRowClickEvent, GridItemChangeEvent, GridDataStateChangeEvent, GridColumnResizeEvent, GridColumnReorderEvent, GridGroupChangeEvent, GridEvent, GridRowDoubleClickEvent, GridNavigationActionEvent, GridKeyDownEvent } from './events';
4
+ import { GridSortChangeEvent, GridFilterChangeEvent, GridPageChangeEvent, GridExpandChangeEvent, GridSelectionChangeEvent, GridHeaderSelectionChangeEvent, GridRowClickEvent, GridItemChangeEvent, GridDataStateChangeEvent, GridColumnResizeEvent, GridColumnReorderEvent, GridGroupChangeEvent, GridEvent, GridRowDoubleClickEvent, GridNavigationActionEvent, GridKeyDownEvent, GridContextMenuEvent } from './events';
5
5
  import { ScrollMode } from '../ScrollMode';
6
6
  import { GridCellProps } from './GridCellProps';
7
7
  import { GridFilterCellProps } from './GridFilterCellProps';
@@ -305,4 +305,8 @@ export interface GridProps extends KendoReactComponentBaseProps {
305
305
  * @default `medium`
306
306
  */
307
307
  size?: 'small' | 'medium';
308
+ /**
309
+ * The event that is fired when the ContextMenu is activated.
310
+ */
311
+ onContextMenu?: (event: GridContextMenuEvent) => void;
308
312
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SortDescriptor, CompositeFilterDescriptor, GroupDescriptor, State } from '@progress/kendo-data-query';
2
3
  import { Grid } from '../Grid';
3
4
  import { Page } from '../paging/Page';
@@ -119,6 +120,23 @@ export interface GridHeaderSelectionChangeEvent extends GridEvent {
119
120
  */
120
121
  selectedField: string;
121
122
  }
123
+ /**
124
+ * Represents the object of the `onContextMenu` Grid event.
125
+ */
126
+ export interface GridContextMenuEvent extends GridEvent {
127
+ /**
128
+ * The data object that represents the current row.
129
+ */
130
+ dataItem: any;
131
+ /**
132
+ * The field to which the cell is bound.
133
+ */
134
+ field?: string;
135
+ /**
136
+ * A React Synthetic Event.
137
+ */
138
+ syntheticEvent: React.MouseEvent<any>;
139
+ }
122
140
  /**
123
141
  * Represents the object of the `GridNavigationActionEvent` Grid event.
124
142
  */
@@ -8,7 +8,7 @@ exports.packageMetadata = {
8
8
  name: '@progress/kendo-react-grid',
9
9
  productName: 'KendoReact',
10
10
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
11
- publishDate: 1678699632,
11
+ publishDate: 1678802439,
12
12
  version: '',
13
13
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
14
14
  };