Skip to content

Commit

Permalink
Merge pull request smeup#2324 from smeup/fix/tbl-cell-blur-event-in-inp
Browse files Browse the repository at this point in the history
Handle TBL blur event in INP
  • Loading branch information
lucafoscili authored Dec 19, 2024
2 parents 50866f7 + 03d4236 commit 1694cde
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,21 @@ export class KupInputPanel {
/*-------------------------------------------------*/

#getCell(id: string) {
return this.inputPanelCells.reduce<KupDataCell>((cell, { cells }) => {
if (!cell) {
return cells.find(({ column }) => column.name === id).cell;
}
return cell;
}, null);
return this.inputPanelCells.reduce<KupDataCell | null>(
(cell, { cells }) => {
if (!cell) {
const foundCell = cells.find(
({ column }) => column.name === id
);
if (foundCell) {
return foundCell.cell;
}
return null;
}
return cell;
},
null
);
}

#renderRow(inputPanelCell: InputPanelCells) {
Expand Down Expand Up @@ -1640,6 +1649,11 @@ export class KupInputPanel {
const currCell = this.#getCell(column.name);
const originalCell = this.#originalData.rows[0].cells[column.name];

if (!currCell) {
// that means INP received a blur event was emitted, probably, by a TBL shape's cell applied to an INP cell
return;
}

// Required cell check
if ((cell as KupInputPanelCell).mandatory) {
this.#setCellError(
Expand Down

0 comments on commit 1694cde

Please sign in to comment.