@kitten-science/kitten-scientists
Version:
Add-on for the wonderful incremental browser game: https://kittensgame.com/web/
44 lines • 1.35 kB
JavaScript
import { CollapsiblePanel } from "./CollapsiblePanel.js";
export class SettingsPanel extends CollapsiblePanel {
setting;
settingItem;
get isExpanded() {
return this._mainChildVisible;
}
// SettingListItem interface
get elementLabel() {
return this.head.element;
}
get readOnly() {
return true;
}
set readOnly(_value) {
/* noop */
}
async check() {
this.setting.enabled = true;
this.requestRefresh();
}
async uncheck() {
this.setting.enabled = false;
this.requestRefresh();
}
/**
* Constructs a settings panel that is used to contain a major section of the UI.
*
* @param host - A reference to the host.
* @param settingItem - The UI element to be placed in the head of the panel.
* @param setting - An setting for which this is the settings panel.
* @param options - Options for this panel.
*/
constructor(parent, setting, settingItem, options) {
super(parent, settingItem, options);
this.element = settingItem.element;
this.settingItem = settingItem;
this.setting = setting;
}
toString() {
return `[${SettingsPanel.name}#${this.componentId}]: '${this.settingItem.elementLabel.text()}'`;
}
}
//# sourceMappingURL=SettingsPanel.js.map