UNPKG

@wcardinal/wcardinal-geditor

Version:

WebGL-based graphic editor, tester and viewer for supervisory systems

80 lines 2.81 kB
import { EShapeTableRowSelection } from "./e-shape-table-row-selection"; var EShapeTableRow = /** @class */ (function () { function EShapeTableRow(parent, onChange) { this._height = 40; this._onChange = onChange; this._isCellUpdateAllowed = true; this._isCellUpdateCalled = false; this.selection = new EShapeTableRowSelection(parent); } EShapeTableRow.prototype.toDirty = function () { this.updateCells(); }; EShapeTableRow.prototype.disallowCellUpdate = function () { this._isCellUpdateAllowed = false; this._isCellUpdateCalled = false; }; EShapeTableRow.prototype.allowCellUpdate = function (invoke) { this._isCellUpdateAllowed = true; var isCellUpdatedCalled = this._isCellUpdateCalled; if (invoke && isCellUpdatedCalled) { this.updateCells(); } }; EShapeTableRow.prototype.updateCells = function () { if (this._isCellUpdateAllowed) { this._onChange(); } else { this._isCellUpdateCalled = true; } }; Object.defineProperty(EShapeTableRow.prototype, "height", { get: function () { return this._height; }, set: function (height) { height = Math.max(5, height); if (this._height !== height) { this._height = height; this.updateCells(); } }, enumerable: false, configurable: true }); EShapeTableRow.prototype.copy = function (source) { this.disallowCellUpdate(); this._height = source._height; this.allowCellUpdate(false); this.updateCells(); return this; }; EShapeTableRow.prototype.serialize = function (manager) { var selectionId = this.selection.serialize(manager); return manager.addResource("[".concat(this._height, ",").concat(selectionId, "]")); }; EShapeTableRow.prototype.deserialize = function (target, manager) { var resources = manager.resources; if (0 <= target && target < resources.length) { var parsed = manager.getExtension(target); if (parsed == null) { parsed = JSON.parse(resources[target]); manager.setExtension(target, parsed); } var isChanged = false; var height = parsed[0]; if (this._height !== height) { this._height = height; isChanged = true; } this.selection.deserialize(parsed[1], manager); if (isChanged) { this._onChange(); } } }; return EShapeTableRow; }()); export { EShapeTableRow }; //# sourceMappingURL=e-shape-table-row.js.map