Skip to content

Commit

Permalink
enable vertical arrow key navigation in luxon editors
Browse files Browse the repository at this point in the history
  • Loading branch information
olifolkerd committed Feb 19, 2023
1 parent bda0577 commit e61575d
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 1 deletion.
27 changes: 27 additions & 0 deletions dist/js/tabulator_esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5722,6 +5722,7 @@ function range(cell, onRendered, success, cancel, editorParams){
//input element
function date(cell, onRendered, success, cancel, editorParams){
var inputFormat = editorParams.format,
vertNav = editorParams.verticalNavigation || "editor",
DT = inputFormat ? (window.DateTime || luxon.DateTime) : null;

//create and style input
Expand Down Expand Up @@ -5843,6 +5844,14 @@ function date(cell, onRendered, success, cancel, editorParams){
case 36:
e.stopPropagation();
break;

case 38: //up arrow
case 40: //down arrow
if(vertNav == "editor"){
e.stopImmediatePropagation();
e.stopPropagation();
}
break;
}
});

Expand All @@ -5852,6 +5861,7 @@ function date(cell, onRendered, success, cancel, editorParams){
//input element
function time(cell, onRendered, success, cancel, editorParams){
var inputFormat = editorParams.format,
vertNav = editorParams.verticalNavigation || "editor",
DT = inputFormat ? (window.DateTime || luxon.DateTime) : null,
newDatetime;

Expand Down Expand Up @@ -5961,6 +5971,14 @@ function time(cell, onRendered, success, cancel, editorParams){
case 36:
e.stopPropagation();
break;

case 38: //up arrow
case 40: //down arrow
if(vertNav == "editor"){
e.stopImmediatePropagation();
e.stopPropagation();
}
break;
}
});

Expand All @@ -5970,6 +5988,7 @@ function time(cell, onRendered, success, cancel, editorParams){
//input element
function datetime(cell, onRendered, success, cancel, editorParams){
var inputFormat = editorParams.format,
vertNav = editorParams.verticalNavigation || "editor",
DT = inputFormat ? (window.DateTime || luxon.DateTime) : null,
newDatetime;

Expand Down Expand Up @@ -6078,6 +6097,14 @@ function datetime(cell, onRendered, success, cancel, editorParams){
case 36:
e.stopPropagation();
break;

case 38: //up arrow
case 40: //down arrow
if(vertNav == "editor"){
e.stopImmediatePropagation();
e.stopPropagation();
}
break;
}
});

Expand Down
2 changes: 1 addition & 1 deletion dist/js/tabulator_esm.js.map

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/js/modules/Edit/defaults/editors/date.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//input element
export default function(cell, onRendered, success, cancel, editorParams){
var inputFormat = editorParams.format,
vertNav = editorParams.verticalNavigation || "editor",
DT = inputFormat ? (window.DateTime || luxon.DateTime) : null;

//create and style input
Expand Down Expand Up @@ -122,6 +123,14 @@ export default function(cell, onRendered, success, cancel, editorParams){
case 36:
e.stopPropagation();
break;

case 38: //up arrow
case 40: //down arrow
if(vertNav == "editor"){
e.stopImmediatePropagation();
e.stopPropagation();
}
break;
}
});

Expand Down
9 changes: 9 additions & 0 deletions src/js/modules/Edit/defaults/editors/datetime.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//input element
export default function(cell, onRendered, success, cancel, editorParams){
var inputFormat = editorParams.format,
vertNav = editorParams.verticalNavigation || "editor",
DT = inputFormat ? (window.DateTime || luxon.DateTime) : null,
newDatetime;

Expand Down Expand Up @@ -109,6 +110,14 @@ export default function(cell, onRendered, success, cancel, editorParams){
case 36:
e.stopPropagation();
break;

case 38: //up arrow
case 40: //down arrow
if(vertNav == "editor"){
e.stopImmediatePropagation();
e.stopPropagation();
}
break;
}
});

Expand Down
9 changes: 9 additions & 0 deletions src/js/modules/Edit/defaults/editors/time.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//input element
export default function(cell, onRendered, success, cancel, editorParams){
var inputFormat = editorParams.format,
vertNav = editorParams.verticalNavigation || "editor",
DT = inputFormat ? (window.DateTime || luxon.DateTime) : null,
newDatetime;

Expand Down Expand Up @@ -110,6 +111,14 @@ export default function(cell, onRendered, success, cancel, editorParams){
case 36:
e.stopPropagation();
break;

case 38: //up arrow
case 40: //down arrow
if(vertNav == "editor"){
e.stopImmediatePropagation();
e.stopPropagation();
}
break;
}
});

Expand Down

0 comments on commit e61575d

Please sign in to comment.