Skip to content

Commit 25f340f

Browse files
authored
fix(core): the editActiveCell() first editor arg should be optional (#1997)
1 parent 13b7246 commit 25f340f

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

frameworks/angular-slickgrid/src/demos/examples/example03.component.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
OperatorType,
1919
SortComparers,
2020
SlickGlobalEditorLock,
21+
type SlickGrid,
2122
type SliderOption,
2223
type VanillaCalendarOption,
2324
} from '../../library';
@@ -70,7 +71,7 @@ export class Example3Component implements OnInit {
7071
columnDefinitions!: Column[];
7172
gridOptions!: GridOption;
7273
dataset!: any[];
73-
gridObj: any;
74+
gridObj: SlickGrid | undefined;
7475
hideSubTitle = false;
7576
isAutoEdit = true;
7677
alertWarning: any;
@@ -630,7 +631,7 @@ export class Example3Component implements OnInit {
630631

631632
changeAutoCommit() {
632633
this.gridOptions.autoCommitEdit = !this.gridOptions.autoCommitEdit;
633-
this.gridObj.setOptions({
634+
this.gridObj?.setOptions({
634635
autoCommitEdit: this.gridOptions.autoCommitEdit,
635636
});
636637
return true;
@@ -680,7 +681,7 @@ export class Example3Component implements OnInit {
680681

681682
setAutoEdit(isAutoEdit: boolean) {
682683
this.isAutoEdit = isAutoEdit;
683-
this.gridObj.setOptions({ autoEdit: isAutoEdit }); // change the grid option dynamically
684+
this.gridObj?.setOptions({ autoEdit: isAutoEdit }); // change the grid option dynamically
684685
return true;
685686
}
686687

@@ -689,7 +690,7 @@ export class Example3Component implements OnInit {
689690
// const item = this.angularGrid.dataView.getItem(command.row);
690691
if (command && SlickGlobalEditorLock.cancelCurrentEdit()) {
691692
command.undo();
692-
this.gridObj.gotoCell(command.row, command.cell, false);
693+
this.gridObj?.gotoCell(command.row, command.cell, false);
693694
}
694695
}
695696

packages/common/src/core/__tests__/slickGrid.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ describe('SlickGrid core file', () => {
359359
});
360360
grid.setData(data);
361361
grid.setActiveCell(0, 0);
362-
grid.editActiveCell(InputEditor as any, true);
362+
grid.editActiveCell(undefined, true);
363363
expect(grid.getCellEditor()).toBeTruthy();
364364

365365
const onBeforeSpy = vi.spyOn(grid.onBeforeCellEditorDestroy, 'notify');

packages/common/src/core/slickGrid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6195,7 +6195,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
61956195
}
61966196
}
61976197

6198-
editActiveCell(editor: Editor | EditorConstructor, preClickModeOn?: boolean | null, e?: Event): void {
6198+
editActiveCell(editor?: Editor | EditorConstructor, preClickModeOn?: boolean | null, e?: Event): void {
61996199
this.makeActiveCellEditable(editor, preClickModeOn, e);
62006200
}
62016201

packages/composite-editor-component/src/slick-composite-editor.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ export class SlickCompositeEditorComponent implements ExternalResource {
564564
this._editorContainers,
565565
this._compositeOptions
566566
) as typeof SlickCompositeEditor;
567-
this.grid.editActiveCell(compositeEditor as any);
567+
this.grid.editActiveCell(compositeEditor as unknown as Editor);
568568

569569
// --
570570
// Add a few Event Handlers

0 commit comments

Comments
 (0)