UNPKG

@tomino/dynamic-form-semantic-ui

Version:

Semantic UI form renderer based on dynamic form generation

43 lines 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const mobx_1 = require("mobx"); class CellHighlighter { constructor(rows = 1, columns = 1) { this.lastHightLight = []; this.highlightMultiple = mobx_1.action((cells) => { for (let cell of cells) { this.grid[cell.row][cell.column] = cell.className; this.lastHightLight.push([cell.row, cell.column]); } }); this.grid = []; this.lastHightLight = []; for (let i = 1; i <= rows; i++) { let row = {}; for (let j = 1; j <= columns; j++) { row[j] = ''; } this.grid[i] = mobx_1.observable(row); } } clearHighlight() { for (let cell of this.lastHightLight) { this.grid[cell[0]][cell[1]] = ''; } this.lastHightLight = []; } highlight(row = 1, column = 1, className = '', width = 1) { if (row === '' || column === '') { return; } for (let i = 0; i < width; i++) { this.grid[row][column + i] = className; this.lastHightLight.push([row, column + i]); } } find(row = 1, column = 1) { return this.grid[row][column]; } } exports.CellHighlighter = CellHighlighter; //# sourceMappingURL=cell_highlighter.js.map