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

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
28 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
6d99cb7
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu May 16, 2024
cd22a9a
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu May 20, 2024
bf25e5b
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu May 22, 2024
6a8fdd8
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu May 29, 2024
6ecda63
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu May 31, 2024
b1e18c4
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 3, 2024
2786c5a
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 4, 2024
e471bf9
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 5, 2024
a0f4f39
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 6, 2024
16c49f7
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 7, 2024
a1d2d47
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 10, 2024
88a7ed7
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 12, 2024
dfe8173
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 17, 2024
c2b1c93
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 17, 2024
44ef1d8
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 19, 2024
6e724b9
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 19, 2024
5f30eab
Merge branch 'main' into issue-2437/table-tabbing-in-edit-mode
ElishaSamPeterPrabhu Jun 20, 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 @@ -19,7 +19,6 @@ import {
COLUMN_DEF_CELL_EDITOR_ARGS_KEY,
COLUMN_DEF_DATATYPE_LINK,
KEYBOARD_ENTER,
KEYBOARD_ESCAPE,
COLUMN_DEF_DATATYPE_BADGE,
} from '../../../modus-table.constants';
import NavigateTableCells from '../../../utilities/table-cell-navigation.utility';
Expand Down Expand Up @@ -102,12 +101,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 All @@ -133,15 +150,18 @@ 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,
cellElement: this.cellEl,
});
} else if (key === KEYBOARD_ESCAPE) {
this.editMode = false;
this.cellEl.focus();
} else return;

event.stopPropagation();
Expand Down