Skip to content

Commit 8cc3f55

Browse files
committed
selection.grid.BaseModel: hasEditorFocus() #6431
1 parent 017d867 commit 8cc3f55

4 files changed

Lines changed: 24 additions & 8 deletions

File tree

src/selection/grid/BaseModel.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@ class BaseModel extends Model {
2222
get dataFields() {
2323
return this.view.parent.columns.map(column => column.dataField)
2424
}
25+
26+
/**
27+
* Checks if an event path contains a grid cell editor
28+
* @param {Object} data
29+
* @param {Object[]} data.path
30+
* @returns {Boolean}
31+
*/
32+
hasEditorFocus({path}) {
33+
for (const node of path) {
34+
if (node.cls?.includes('neo-grid-editor')) {
35+
return true
36+
}
37+
}
38+
39+
return false
40+
}
2541
}
2642

2743
export default Neo.setupClass(BaseModel);

src/selection/grid/CellModel.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,28 @@ class CellModel extends BaseModel {
5454
* @param {Object} data
5555
*/
5656
onKeyDownDown(data) {
57-
this.onNavKeyRow(1)
57+
!this.hasEditorFocus(data) && this.onNavKeyRow(1)
5858
}
5959

6060
/**
6161
* @param {Object} data
6262
*/
6363
onKeyDownLeft(data) {
64-
this.onNavKeyColumn(-1)
64+
!this.hasEditorFocus(data) && this.onNavKeyColumn(-1)
6565
}
6666

6767
/**
6868
* @param {Object} data
6969
*/
7070
onKeyDownRight(data) {
71-
this.onNavKeyColumn(1)
71+
!this.hasEditorFocus(data) && this.onNavKeyColumn(1)
7272
}
7373

7474
/**
7575
* @param {Object} data
7676
*/
7777
onKeyDownUp(data) {
78-
this.onNavKeyRow(-1)
78+
!this.hasEditorFocus(data) && this.onNavKeyRow(-1)
7979
}
8080

8181
/**

src/selection/grid/ColumnModel.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ class ColumnModel extends BaseModel {
6666
* @param {Object} data
6767
*/
6868
onKeyDownLeft(data) {
69-
this.onNavKeyColumn(-1)
69+
!this.hasEditorFocus(data) && this.onNavKeyColumn(-1)
7070
}
7171

7272
/**
7373
* @param {Object} data
7474
*/
7575
onKeyDownRight(data) {
76-
this.onNavKeyColumn(1)
76+
!this.hasEditorFocus(data) && this.onNavKeyColumn(1)
7777
}
7878

7979
/**

src/selection/grid/RowModel.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ class RowModel extends BaseModel {
5555
* @param {Object} data
5656
*/
5757
onKeyDownDown(data) {
58-
this.onNavKeyRow(1)
58+
!this.hasEditorFocus(data) && this.onNavKeyRow(1)
5959
}
6060

6161
/**
6262
* @param {Object} data
6363
*/
6464
onKeyDownUp(data) {
65-
this.onNavKeyRow(-1)
65+
!this.hasEditorFocus(data) && this.onNavKeyRow(-1)
6666
}
6767

6868
/**

0 commit comments

Comments
 (0)