Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table: Update Edit mode #2443

Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
8edec1e
Update table cell
ElishaSamPeterPrabhu Apr 16, 2024
7c77adf
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Apr 16, 2024
a6db3af
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Apr 17, 2024
ba8e63e
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Apr 18, 2024
c6e407b
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Apr 22, 2024
f30269a
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Apr 25, 2024
c94d7fe
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Apr 26, 2024
ee232c9
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu May 2, 2024
aa9cae0
Update any to unkown
ElishaSamPeterPrabhu May 2, 2024
0898391
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu May 3, 2024
8dfe44d
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu May 15, 2024
7f02b3a
Update table cell
ElishaSamPeterPrabhu Apr 16, 2024
28a882c
Update any to unkown
ElishaSamPeterPrabhu May 2, 2024
213b4a7
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Aug 30, 2024
f3a8c6c
Merge branch 'issue-2437/table-tabbing-in-edit-mode' of https://githu…
ElishaSamPeterPrabhu Aug 30, 2024
859f3eb
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
prashanthr6383 Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import {
COLUMN_DEF_CELL_EDITOR_ARGS_KEY,
COLUMN_DEF_DATATYPE_LINK,
KEYBOARD_ENTER,
KEYBOARD_ESCAPE,
COLUMN_DEF_DATATYPE_BADGE,
KEYBOARD_ESCAPE,
} from '../../../modus-table.constants';
import NavigateTableCells from '../../../utilities/table-cell-navigation.utility';
import { CellFormatter } from '../../../utilities/table-cell-formatter.utility';
Expand Down Expand Up @@ -164,12 +164,30 @@ export class ModusTableCellMain {
};

handleCellKeydown = (event: KeyboardEvent) => {
if (event.defaultPrevented) return;

const key = event.key?.toLowerCase();
const isCellEditable = this.cell.column.columnDef[this.cellEditableKey];

if (isCellEditable && !this.editMode && key === KEYBOARD_ENTER) {
if (event.defaultPrevented) return;

if (key === KEYBOARD_ENTER && isCellEditable) {
this.editMode = !this.editMode;

event.preventDefault();
}

if (key === 'tab' && isCellEditable) {
this.editMode = !this.editMode;
const nextCell = this.cellEl.nextElementSibling?.querySelector(
'modus-table-cell-main'
) as unknown as ModusTableCellMain;
if (nextCell) {
nextCell.editMode = true;
(nextCell as unknown as HTMLElement).focus();
}
event.preventDefault();
}

if (isCellEditable && !this.editMode) {
this.editMode = true;
event.stopPropagation();
} else {
Expand Down Expand Up @@ -204,7 +222,13 @@ export class ModusTableCellMain {

handleCellEditorKeyDown = (event: KeyboardEvent, newValue: string, oldValue: string) => {
const key = event.key?.toLowerCase();
if (key === KEYBOARD_ENTER) {
if (key === 'tab') {
this.handleCellEditorValueChange(newValue, oldValue);
NavigateTableCells({
eventKey: 'tab',
cellElement: this.cellEl,
});
} else if (key === KEYBOARD_ENTER) {
this.handleCellEditorValueChange(newValue, oldValue);
NavigateTableCells({
eventKey: KEYBOARD_ENTER,
Expand All @@ -213,7 +237,6 @@ export class ModusTableCellMain {
} else if (key === KEYBOARD_ESCAPE) {
this.editMode = false;
this.cellEl.focus();
this.destroyErrorTooltip();
} else return;

event.stopPropagation();
Expand Down