fix: table button migration issues (#7825)
This commit is contained in:
parent
90fda1ccae
commit
20c1b56932
|
|
@ -1023,6 +1023,17 @@ export const revertButtonStyleToButtonColor = (
|
|||
delete currentDSL.prevMenuStyle;
|
||||
}
|
||||
}
|
||||
if (currentDSL.type === "TABLE_WIDGET") {
|
||||
if (currentDSL.hasOwnProperty("primaryColumns")) {
|
||||
Object.keys(currentDSL.primaryColumns).forEach((column) => {
|
||||
if (currentDSL.primaryColumns[column].columnType === "button") {
|
||||
currentDSL.primaryColumns[column].buttonColor =
|
||||
currentDSL.primaryColumns[column].buttonStyle;
|
||||
delete currentDSL.primaryColumns[column].buttonStyle;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (currentDSL.children && currentDSL.children.length) {
|
||||
currentDSL.children = currentDSL.children.map((child) =>
|
||||
revertButtonStyleToButtonColor(child),
|
||||
|
|
|
|||
|
|
@ -1607,6 +1607,24 @@ describe("Table Widget selectedRow bindings update", () => {
|
|||
computedValue:
|
||||
"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.action))}}",
|
||||
},
|
||||
customColumn1: {
|
||||
index: 4,
|
||||
width: 150,
|
||||
id: "customColumn1",
|
||||
horizontalAlignment: "LEFT",
|
||||
verticalAlignment: "CENTER",
|
||||
columnType: "button",
|
||||
textSize: "PARAGRAPH",
|
||||
enableFilter: true,
|
||||
enableSort: true,
|
||||
isVisible: true,
|
||||
isCellVisible: true,
|
||||
isDisabled: false,
|
||||
isDerived: true,
|
||||
label: "Delete",
|
||||
onClick: "{{showAlert('Hello')}}",
|
||||
computedValue: "",
|
||||
},
|
||||
},
|
||||
delimiter: ",",
|
||||
derivedColumns: {},
|
||||
|
|
@ -1759,6 +1777,24 @@ describe("Table Widget selectedRow bindings update", () => {
|
|||
computedValue:
|
||||
"{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.action))}}",
|
||||
},
|
||||
customColumn1: {
|
||||
index: 4,
|
||||
width: 150,
|
||||
id: "customColumn1",
|
||||
horizontalAlignment: "LEFT",
|
||||
verticalAlignment: "CENTER",
|
||||
columnType: "button",
|
||||
textSize: "PARAGRAPH",
|
||||
enableFilter: true,
|
||||
enableSort: true,
|
||||
isVisible: true,
|
||||
isCellVisible: true,
|
||||
isDisabled: false,
|
||||
isDerived: true,
|
||||
label: "Delete",
|
||||
onClick: "{{showAlert('Hello')}}",
|
||||
computedValue: "",
|
||||
},
|
||||
},
|
||||
delimiter: ",",
|
||||
derivedColumns: {},
|
||||
|
|
@ -1797,6 +1833,6 @@ describe("Table Widget selectedRow bindings update", () => {
|
|||
},
|
||||
],
|
||||
};
|
||||
expect(JSON.stringify(newDsl) === JSON.stringify(outputDsl));
|
||||
expect(newDsl).toStrictEqual(outputDsl);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -325,10 +325,9 @@ const getUpdatedColumns = (
|
|||
"currentRow",
|
||||
);
|
||||
}
|
||||
updatedColumns[sanitizedColumnId] = {
|
||||
...columnProps,
|
||||
onClick: newOnClickBindingValue,
|
||||
};
|
||||
updatedColumns[sanitizedColumnId] = columnProps;
|
||||
if (newOnClickBindingValue)
|
||||
updatedColumns[sanitizedColumnId].onClick = newOnClickBindingValue;
|
||||
}
|
||||
}
|
||||
return updatedColumns;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user