forked from MapComplete/MapComplete
basic checkbox implementation
This commit is contained in:
parent
00fb99defe
commit
0e3d9d930b
4 changed files with 38 additions and 10 deletions
31
UI/LayerSelection.ts
Normal file
31
UI/LayerSelection.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { UIElement } from "./UIElement";
|
||||
import { FilteredLayer } from "../Logic/FilteredLayer";
|
||||
import { CheckBox } from "./Base/CheckBox";
|
||||
|
||||
export class LayerSelection extends UIElement{
|
||||
|
||||
private readonly _checkboxes: UIElement[];
|
||||
|
||||
constructor(layers: FilteredLayer[]) {
|
||||
super(undefined);
|
||||
this._checkboxes = [];
|
||||
for (const layer of layers) {
|
||||
this._checkboxes.push(new CheckBox(layer.isDisplayed, `isEnabled ${layer.layerDef.name}`, `isDisabled ${layer.layerDef.name}`));
|
||||
}
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
let html = ``;
|
||||
|
||||
for (const checkBox of this._checkboxes) {
|
||||
const checkBoxHTML = checkBox.Render();
|
||||
const checkBoxListItem = `<li>${checkBoxHTML}</li>`;
|
||||
|
||||
html = html + checkBoxListItem;
|
||||
}
|
||||
|
||||
|
||||
return `<ul>${html}</ul>`;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue