From d013a3befe3d57f5aede08fc5b3b9ead5754070a Mon Sep 17 00:00:00 2001 From: Arkerthan <arkerthan@gmail.com> Date: Thu, 3 Dec 2020 15:01:57 +0100 Subject: [PATCH] add Row as parent of Option class --- src/gui/options/options.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gui/options/options.js b/src/gui/options/options.js index b9fc196c852..a70c53a33f3 100644 --- a/src/gui/options/options.js +++ b/src/gui/options/options.js @@ -1,4 +1,11 @@ App.UI.OptionsGroup = (function() { + class Row { + /** + * @param {HTMLDivElement} container + */ + render(container) {} // jshint ignore:line + } + /** * @typedef value * @property {*} value @@ -12,13 +19,14 @@ App.UI.OptionsGroup = (function() { * @property {Function} [callback] */ - class Option { + class Option extends Row { /** * @param {string} description can be SC markup * @param {string} property * @param {object} [object=V] */ constructor(description, property, object = V) { + super(); this.description = description; this.property = property; this.object = object; @@ -298,9 +306,9 @@ App.UI.OptionsGroup = (function() { return class { constructor() { /** - * @type {Array<Option>} + * @type {Array<Row>} */ - this.options = []; + this.rows = []; } /** @@ -319,7 +327,7 @@ App.UI.OptionsGroup = (function() { */ addOption(name, property, object = V) { const option = new Option(name, property, object); - this.options.push(option); + this.rows.push(option); return option; } @@ -329,8 +337,9 @@ App.UI.OptionsGroup = (function() { if (this.doubleColumn) { container.classList.add("double"); } - for (/** @type {Option} */ const option of this.options) { - option.render(container); + + for (/** @type {Row} */ const row of this.rows) { + row.render(container); } return container; -- GitLab