@platform/ui.datagrid
Version:
Isolated tabular DataGrid.
16 lines (15 loc) • 570 B
JavaScript
import { coord } from '../common';
export function undo(grid, stage, kind) {
return function (action) {
const { actionType } = action;
if (stage === 'BEFORE' && actionType === 'change') {
const changes = action.changes.map((item) => {
const [row, column, from, to] = item;
const key = coord.cell.toKey(column, row);
const change = { key, from, to };
return change;
});
grid.fire({ type: 'GRID/undo', payload: { kind, changes } });
}
};
}