forked from MapComplete/MapComplete
Butchering the UI framework
This commit is contained in:
parent
8d404b1ba9
commit
6415e195d1
90 changed files with 1012 additions and 3101 deletions
|
@ -3,13 +3,12 @@ import {UIEventSource} from "../../Logic/UIEventSource";
|
|||
|
||||
|
||||
export default class InputElementMap<T, X> extends InputElement<X> {
|
||||
|
||||
public readonly IsSelected: UIEventSource<boolean>;
|
||||
private readonly _inputElement: InputElement<T>;
|
||||
private isSame: (x0: X, x1: X) => boolean;
|
||||
private readonly fromX: (x: X) => T;
|
||||
private readonly toX: (t: T) => X;
|
||||
private readonly _value: UIEventSource<X>;
|
||||
public readonly IsSelected: UIEventSource<boolean>;
|
||||
|
||||
constructor(inputElement: InputElement<T>,
|
||||
isSame: (x0: X, x1: X) => boolean,
|
||||
|
@ -41,19 +40,19 @@ export default class InputElementMap<T, X> extends InputElement<X> {
|
|||
return this._value;
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
return this._inputElement.InnerRender();
|
||||
}
|
||||
|
||||
IsValid(x: X): boolean {
|
||||
if(x === undefined){
|
||||
if (x === undefined) {
|
||||
return false;
|
||||
}
|
||||
const t = this.fromX(x);
|
||||
if(t === undefined){
|
||||
if (t === undefined) {
|
||||
return false;
|
||||
}
|
||||
return this._inputElement.IsValid(t);
|
||||
}
|
||||
|
||||
|
||||
protected InnerConstructElement(): HTMLElement {
|
||||
return this._inputElement.ConstructElement();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue