mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
exposed updatedDate (#4263)
This commit is contained in:
parent
cb8eb5aa95
commit
8c8c38aa85
1 changed files with 17 additions and 1 deletions
|
|
@ -52,6 +52,7 @@ export function Table({
|
|||
properties,
|
||||
variablesExposedForPreview,
|
||||
exposeToCodeHinter,
|
||||
exposedVariables,
|
||||
}) {
|
||||
const {
|
||||
color,
|
||||
|
|
@ -114,6 +115,7 @@ export function Table({
|
|||
function handleCellValueChange(index, key, value, rowData) {
|
||||
const changeSet = tableDetails.changeSet;
|
||||
const dataUpdates = tableDetails.dataUpdates || [];
|
||||
const clonedTableData = _.cloneDeep(tableData);
|
||||
|
||||
let obj = changeSet ? changeSet[index] || {} : {};
|
||||
obj = _.set(obj, key, value);
|
||||
|
|
@ -131,10 +133,18 @@ export function Table({
|
|||
...dataUpdates,
|
||||
[index]: { ...obj },
|
||||
};
|
||||
|
||||
Object.keys(newChangeset).forEach((key) => {
|
||||
clonedTableData[key] = {
|
||||
..._.merge(clonedTableData[key], newChangeset[key]),
|
||||
};
|
||||
});
|
||||
|
||||
const changesToBeSavedAndExposed = { dataUpdates: newDataUpdates, changeSet: newChangeset };
|
||||
mergeToTableDetails(changesToBeSavedAndExposed);
|
||||
|
||||
fireEvent('onCellValueChanged');
|
||||
return setExposedVariables(changesToBeSavedAndExposed);
|
||||
return setExposedVariables({ ...changesToBeSavedAndExposed, updatedData: clonedTableData });
|
||||
}
|
||||
|
||||
function getExportFileBlob({ columns, data, fileType, fileName }) {
|
||||
|
|
@ -431,6 +441,12 @@ export function Table({
|
|||
);
|
||||
}, [JSON.stringify(globalFilteredRows.map((row) => row.original))]);
|
||||
|
||||
useEffect(() => {
|
||||
if (_.isEmpty(changeSet)) {
|
||||
setExposedVariable('updatedData', tableData);
|
||||
}
|
||||
}, [JSON.stringify(changeSet)]);
|
||||
|
||||
function downlaodPopover() {
|
||||
return (
|
||||
<Popover
|
||||
|
|
|
|||
Loading…
Reference in a new issue