Skip to content

Commit 3852aca

Browse files
authored
Remove sender from event handlers for 19 update (#788)
1 parent 2f5e47c commit 3852aca

34 files changed

Lines changed: 89 additions & 91 deletions

File tree

samples/grids/grid/change-icons-custom/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default class Sample extends React.Component<any, any> {
2626
this.setState({});
2727
}
2828

29-
public onSelect(_buttonGroup: IgrButtonGroup, args: IgrComponentValueChangedEventArgs) {
29+
public onSelect(args: IgrComponentValueChangedEventArgs) {
3030
this.changeRefs(args.detail);
3131
}
3232

@@ -117,7 +117,7 @@ export default class Sample extends React.Component<any, any> {
117117
public render(): JSX.Element {
118118
return (
119119
<div className="container sample ig-typography">
120-
<IgrButtonGroup select={this.onSelect} style={{ width: 'fit-content' }}>
120+
<IgrButtonGroup onSelect={this.onSelect} style={{ width: 'fit-content' }}>
121121
<IgrToggleButton value="material" key="material" selected>
122122
<span key="text">Material Icons</span>
123123
</IgrToggleButton>

samples/grids/grid/clipboard-operations/src/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client';
33
import './index.css';
44

55
import { IgrButton, IgrInput, IgrSwitch, IgrCheckboxChangeEventArgs, IgrComponentDataValueChangedEventArgs, IgrComponentValueChangedEventArgs } from 'igniteui-react';
6-
import { IgrGridBaseDirective, IgrGridModule, IgrColumnComponentEventArgs } from 'igniteui-react-grids';
6+
import { IgrGridModule, IgrColumnComponentEventArgs } from 'igniteui-react-grids';
77
import { IgrGrid, IgrColumn } from 'igniteui-react-grids';
88
import { NwindData } from './NwindData';
99

@@ -24,7 +24,7 @@ export default function App() {
2424
defaultSeparator = gridRef.current.clipboardOptions.separator;
2525
}, []);
2626

27-
const onColumnInit = (grid: IgrGridBaseDirective, args: IgrColumnComponentEventArgs) => {
27+
const onColumnInit = (args: IgrColumnComponentEventArgs) => {
2828
let column = args.detail;
2929
column.formatter = (val: any) => "** " + val + " **"
3030
column.header = "🎉" + column.field;
@@ -71,7 +71,7 @@ export default function App() {
7171
</IgrButton>
7272
</div>
7373
<div className="container fill">
74-
<IgrGrid autoGenerate={false} cellSelection="multiple" data={data} ref={gridRef} columnInit={onColumnInit}>
74+
<IgrGrid autoGenerate={false} cellSelection="multiple" data={data} ref={gridRef} onColumnInit={onColumnInit}>
7575
<IgrColumn field="ProductID" header="Product ID">
7676
</IgrColumn>
7777
<IgrColumn field="ProductName" header="Product Name">

samples/grids/grid/conditional-row-selectors/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default class Sample extends React.Component<any, any> {
9090
return this._componentRenderer;
9191
}
9292

93-
public webGridRowSelectionConditional(sender: IgrGrid, eventArgs: IgrRowSelectionEventArgs): void {
93+
public webGridRowSelectionConditional(eventArgs: IgrRowSelectionEventArgs): void {
9494
const event = eventArgs.detail;
9595
if (!event.added.length && event.removed.length) {
9696
// ignore de-select

samples/grids/grid/editing-events/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default class Sample extends React.Component<any, any> {
8787
return this._componentRenderer;
8888
}
8989

90-
public webGridEditingEventsCellEdit(sender: IgrGrid, args: IgrGridEditEventArgs): void {
90+
public webGridEditingEventsCellEdit(args: IgrGridEditEventArgs): void {
9191
var d = args.detail;
9292

9393
if (d.column != null && d.column.field == "UnitsOnOrder") {

samples/grids/grid/editing-excel-style/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default class Sample extends React.Component<any, any> {
3939
autoGenerate={false}
4040
data={this.nwindData}
4141
primaryKey="ProductID"
42-
gridKeydown={this.webGridEditingExcelStyle}
42+
onGridKeydown={this.webGridEditingExcelStyle}
4343
ref={this.grid1Ref}>
4444
<IgrColumn
4545
field="ProductID"
@@ -95,7 +95,7 @@ export default class Sample extends React.Component<any, any> {
9595
return this._componentRenderer;
9696
}
9797

98-
public webGridEditingExcelStyle(sender: IgrGrid, args: IgrGridKeydownEventArgs): void {
98+
public webGridEditingExcelStyle(args: IgrGridKeydownEventArgs): void {
9999
var key = (args.detail.event as any).keyCode;
100100
var grid = args.detail.target.grid;
101101
var activeElem = grid.navigation.activeNode;

samples/grids/grid/editing-lifecycle/src/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,56 +100,56 @@ export default class Sample extends React.Component<any, any> {
100100
container.appendChild(title);
101101
}
102102

103-
public webGridRowEditEnter(sender: IgrGrid, args: IgrGridEditEventArgs): void {
103+
public webGridRowEditEnter(args: IgrGridEditEventArgs): void {
104104
let container = document.getElementById("container");
105105
const message = document.createElement("p");
106106
message.textContent = `=> 'rowEditEnter' with 'RowID':` + args.detail.rowID;
107107
container.appendChild(message);
108108
}
109109

110-
public webGridRowEdit(sender: IgrGrid, args: IgrGridEditEventArgs): void {
110+
public webGridRowEdit(args: IgrGridEditEventArgs): void {
111111
let container = document.getElementById("container");
112112
const message = document.createElement("p");
113113
message.textContent = `=> 'rowEdit'`;
114114
container.appendChild(message);
115115
}
116116

117-
public webGridRowEditDone(sender: IgrGrid, args: IgrGridEditDoneEventArgs): void {
117+
public webGridRowEditDone(args: IgrGridEditDoneEventArgs): void {
118118
let container = document.getElementById("container");
119119
const message = document.createElement("p");
120120
message.textContent = `=> 'rowEditDone'`;
121121
container.appendChild(message);
122122
}
123123

124-
public webGridRowEditExit(sender: IgrGrid, args: IgrGridEditDoneEventArgs): void {
124+
public webGridRowEditExit(args: IgrGridEditDoneEventArgs): void {
125125
let container = document.getElementById("container");
126126
const message = document.createElement("p");
127127
message.textContent = `=> 'rowEditExit' << End of cycle >>`;
128128
container.appendChild(message);
129129
}
130130

131-
public webGridCellEditEnter(sender: IgrGrid, args: IgrGridEditEventArgs): void {
131+
public webGridCellEditEnter(args: IgrGridEditEventArgs): void {
132132
let container = document.getElementById("container");
133133
const message = document.createElement("p");
134134
message.textContent = `=> 'cellEditEnter' with 'value':` + args.detail.oldValue, args.detail.cancel;
135135
container.appendChild(message);
136136
}
137137

138-
public webGridCellEdit(sender: IgrGrid, args: IgrGridEditEventArgs): void {
138+
public webGridCellEdit(args: IgrGridEditEventArgs): void {
139139
let container = document.getElementById("container");
140140
const message = document.createElement("p");
141141
message.textContent = `=> 'cellEdit' with 'newValue':` + args.detail.newValue, args.detail.cancel;
142142
container.appendChild(message);
143143
}
144144

145-
public webGridCellEditDone(sender: IgrGrid, args: IgrGridEditDoneEventArgs): void {
145+
public webGridCellEditDone(args: IgrGridEditDoneEventArgs): void {
146146
let container = document.getElementById("container");
147147
const message = document.createElement("p");
148148
message.textContent = `=> 'cellEditDone'`;
149149
container.appendChild(message);
150150
}
151151

152-
public webGridCellEditExit(sender: IgrGrid, args: IgrGridEditDoneEventArgs): void {
152+
public webGridCellEditExit(args: IgrGridEditDoneEventArgs): void {
153153
let container = document.getElementById("container");
154154
const message = document.createElement("p");
155155
message.textContent = `=> 'cellEditExit'`;

samples/grids/grid/keyboard-mrl-navigation/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export default class Sample extends React.Component<any, any> {
168168
return this._componentRenderer;
169169
}
170170

171-
public webGridMRLCustomNavigationEvent(sender: IgrGrid, args: IgrGridKeydownEventArgs): void {
171+
public webGridMRLCustomNavigationEvent(args: IgrGridKeydownEventArgs): void {
172172
const target = args.detail.target;
173173
const grid: IgrGrid = this.grid;
174174
if ((args.detail.event as any).key.toLowerCase() === 'enter') {

samples/grids/grid/multi-cell-selection-mode/src/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import React, { useEffect, useRef, useState } from 'react';
1+
import React, { useRef } from 'react';
22
import ReactDOM from 'react-dom/client';
33
import './index.css';
44

5-
import { IgrGridBaseDirective, IgrGridCellEventArgs, IgrGridModule } from 'igniteui-react-grids';
6-
import { IgrGrid, IgrColumn } from 'igniteui-react-grids';
5+
import { IgrColumn, IgrGrid, IgrGridModule, IgrGridSelectionRangeEventArgs } from 'igniteui-react-grids';
76
import { InvoicesData } from './InvoicesData';
87

98
import 'igniteui-react-grids/grids/combined';
@@ -19,15 +18,16 @@ export default function App() {
1918
const data = new InvoicesData();
2019
const rightGridRef = useRef(null);
2120

22-
function onGridRangeSelected(grid: IgrGridBaseDirective): void {
21+
function onGridRangeSelected(evt: IgrGridSelectionRangeEventArgs): void {
22+
const grid = evt.target as IgrGrid;
2323
rightGridRef.current.data = grid.getSelectedData(false, false);
2424
}
2525

2626
return (
2727
<>
2828
<div className="container sample">
2929
<div className="container horizontal wrapper">
30-
<IgrGrid autoGenerate={false} cellSelection="multiple" data={data} rangeSelected={onGridRangeSelected} width="40%">
30+
<IgrGrid autoGenerate={false} cellSelection="multiple" data={data} onRangeSelected={onGridRangeSelected} width="40%">
3131
<IgrColumn field="ProductID" header="Product ID">
3232
</IgrColumn>
3333
<IgrColumn field="ProductName" header="Product Name">

samples/grids/grid/multi-column-headers-export/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export default class Sample extends React.Component<any, any> {
169169
return this._componentRenderer;
170170
}
171171

172-
public webGridExportEventMultiColumnHeaders(sender: IgrGridToolbarExporter, args: IgrExporterEventArgs): void {
172+
public webGridExportEventMultiColumnHeaders(args: IgrExporterEventArgs): void {
173173
if (args.detail.options) {
174174
args.detail.options.ignoreMultiColumnHeaders = false;
175175
}

samples/grids/grid/row-drag-base/src/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export default function App() {
1818
const data = new CustomersData();
1919
const rightGridRef = useRef<IgrGrid>(null);
2020

21-
function onGridRowDragEnd(grid: IgrGrid, evt: IgrRowDragEndEventArgs): void {
21+
function onGridRowDragEnd(evt: IgrRowDragEndEventArgs): void {
22+
const grid = evt.target as IgrGrid;
2223
const ghostElement = evt.detail.dragDirective.ghostElement;
2324
if (ghostElement != null) {
2425
const dragElementPos = ghostElement.getBoundingClientRect();
@@ -36,7 +37,7 @@ export default function App() {
3637
return (
3738
<div className="container sample">
3839
<div className="container horizontal wrapper">
39-
<IgrGrid data={data} width="40%" primaryKey='ID' autoGenerate={false} rowDraggable={true} rowDragEnd={onGridRowDragEnd}>
40+
<IgrGrid data={data} width="40%" primaryKey='ID' autoGenerate={false} rowDraggable={true} onRowDragEnd={onGridRowDragEnd}>
4041
<IgrColumn field="ID" width="100px"></IgrColumn>
4142
<IgrColumn field="CompanyName" width="100px"></IgrColumn>
4243
<IgrColumn field="ContactName" width="100px"></IgrColumn>

0 commit comments

Comments
 (0)