forked from MapComplete/MapComplete
Small refactoring: use checkbox for sharescreen instead of toggles
This commit is contained in:
parent
68c3585d72
commit
592bc4ae0b
2 changed files with 26 additions and 25 deletions
|
@ -2,6 +2,21 @@ import {InputElement} from "./InputElement";
|
|||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import {Utils} from "../../Utils";
|
||||
import BaseUIElement from "../BaseUIElement";
|
||||
import InputElementMap from "./InputElementMap";
|
||||
|
||||
export class CheckBox extends InputElementMap<number[], boolean> {
|
||||
constructor(el: BaseUIElement , defaultValue?: boolean) {
|
||||
super(
|
||||
new CheckBoxes([el]),
|
||||
(x0, x1) => x0 === x1,
|
||||
t => t.length > 0,
|
||||
x => x ? [0] : []
|
||||
);
|
||||
if(defaultValue !== undefined){
|
||||
this.GetValue().setData(defaultValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Supports multi-input
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue