UNPKG

@platform/ui.datagrid

Version:

Isolated tabular DataGrid.

20 lines (19 loc) 759 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.undo = void 0; var common_1 = require("../common"); function undo(grid, stage, kind) { return function (action) { var actionType = action.actionType; if (stage === 'BEFORE' && actionType === 'change') { var changes = action.changes.map(function (item) { var row = item[0], column = item[1], from = item[2], to = item[3]; var key = common_1.coord.cell.toKey(column, row); var change = { key: key, from: from, to: to }; return change; }); grid.fire({ type: 'GRID/undo', payload: { kind: kind, changes: changes } }); } }; } exports.undo = undo;