UNPKG

@platform/ui.datagrid

Version:

Isolated tabular DataGrid.

50 lines (49 loc) 1.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.calc = void 0; var tslib_1 = require("tslib"); var common_1 = require("../../common"); function calc(args) { var _this = this; var grid = args.grid, getFunc = args.getFunc; var refsTable = grid.refsTable; var getCells = function () { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () { return (0, tslib_1.__generator)(this, function (_a) { return [2, grid.data.cells]; }); }); }; var table = common_1.func.table({ getCells: getCells, getFunc: getFunc, refsTable: refsTable }); var changes = function (args) { if (args === void 0) { args = {}; } return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () { var cells, res; return (0, tslib_1.__generator)(this, function (_a) { switch (_a.label) { case 0: cells = args.cells; return [4, table.calculate({ cells: cells })]; case 1: res = _a.sent(); return [2, res]; } }); }); }; var update = function (args) { if (args === void 0) { args = {}; } return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () { var cells, res; return (0, tslib_1.__generator)(this, function (_a) { switch (_a.label) { case 0: cells = args.cells; return [4, changes({ cells: cells })]; case 1: res = _a.sent(); grid.changeCells(res.map); return [2, res]; } }); }); }; return { changes: changes, update: update }; } exports.calc = calc;