fix: Icon button click should not de-select row in table widget (#8197)
This commit is contained in:
parent
4fde9d63be
commit
fdac6428b4
|
|
@ -155,4 +155,15 @@ describe("Table Widget property pane feature validation", function() {
|
|||
expect(someText).to.equal("Successful tobias.funke@reqres.in");
|
||||
});
|
||||
});
|
||||
it("Table widget test on button icon click, row should not get deselected", () => {
|
||||
cy.get(widgetsPage.tableIconBtn)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(commonlocators.TextInside).should("have.text", "Tobias Funke");
|
||||
//click icon button again
|
||||
cy.get(widgetsPage.tableIconBtn)
|
||||
.last()
|
||||
.click({ force: true });
|
||||
cy.get(commonlocators.TextInside).should("have.text", "Tobias Funke");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@
|
|||
"toggleChartType": ".t--property-control-charttype .t--js-toggle",
|
||||
"inputToggleOnClick": ".t--property-control-onclick div.CodeMirror-lines",
|
||||
"tableBtn": ".t--draggable-tablewidget .bp3-button",
|
||||
"tableIconBtn": ".t--draggable-tablewidget .bp3-icon",
|
||||
"toastAction": ".Toastify__toast-container--top-right .t--toast-action",
|
||||
"toastActionText": ".Toastify__toast-container--top-right .t--toast-action span",
|
||||
"defaultColName": "[data-rbd-draggable-id='customColumn1'] input",
|
||||
|
|
|
|||
|
|
@ -142,15 +142,15 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
columnProperties,
|
||||
originalIndex,
|
||||
);
|
||||
let isSelected = false;
|
||||
if (this.props.multiRowSelection) {
|
||||
isSelected =
|
||||
Array.isArray(this.props.selectedRowIndices) &&
|
||||
this.props.selectedRowIndices.includes(rowIndex);
|
||||
} else {
|
||||
isSelected = this.props.selectedRowIndex === rowIndex;
|
||||
}
|
||||
if (columnProperties.columnType === "button") {
|
||||
let isSelected = false;
|
||||
if (this.props.multiRowSelection) {
|
||||
isSelected =
|
||||
Array.isArray(this.props.selectedRowIndices) &&
|
||||
this.props.selectedRowIndices.includes(rowIndex);
|
||||
} else {
|
||||
isSelected = this.props.selectedRowIndex === rowIndex;
|
||||
}
|
||||
const buttonProps = {
|
||||
isSelected: isSelected,
|
||||
onCommandClick: (action: string, onComplete: () => void) =>
|
||||
|
|
@ -183,7 +183,6 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
: undefined,
|
||||
});
|
||||
} else if (columnProperties.columnType === "image") {
|
||||
const isSelected = !!props.row.isSelected;
|
||||
const isCellVisible = cellProperties.isCellVisible ?? true;
|
||||
const onClick = columnProperties.onClick
|
||||
? () =>
|
||||
|
|
@ -220,7 +219,7 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
return renderMenuButton(menuButtonProps, isHidden, cellProperties);
|
||||
} else if (columnProperties.columnType === "iconButton") {
|
||||
const iconButtonProps = {
|
||||
isSelected: !!props.row.isSelected,
|
||||
isSelected: isSelected,
|
||||
onCommandClick: (action: string, onComplete: () => void) =>
|
||||
this.onCommandClick(rowIndex, action, onComplete),
|
||||
columnActions: [
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user