forked from MapComplete/MapComplete
Reformat all files with prettier
This commit is contained in:
parent
e22d189376
commit
b541d3eab4
382 changed files with 50893 additions and 35566 deletions
|
|
@ -1,37 +1,43 @@
|
|||
import {InputElement} from "./InputElement";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import BaseUIElement from "../BaseUIElement";
|
||||
import {Translation} from "../i18n/Translation";
|
||||
import {SubstitutedTranslation} from "../SubstitutedTranslation";
|
||||
import FeaturePipelineState from "../../Logic/State/FeaturePipelineState";
|
||||
import { InputElement } from "./InputElement"
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
import BaseUIElement from "../BaseUIElement"
|
||||
import { Translation } from "../i18n/Translation"
|
||||
import { SubstitutedTranslation } from "../SubstitutedTranslation"
|
||||
import FeaturePipelineState from "../../Logic/State/FeaturePipelineState"
|
||||
|
||||
export default class InputElementWrapper<T> extends InputElement<T> {
|
||||
private readonly _inputElement: InputElement<T>;
|
||||
private readonly _inputElement: InputElement<T>
|
||||
private readonly _renderElement: BaseUIElement
|
||||
|
||||
constructor(inputElement: InputElement<T>, translation: Translation, key: string,
|
||||
tags: UIEventSource<any>, state: FeaturePipelineState) {
|
||||
constructor(
|
||||
inputElement: InputElement<T>,
|
||||
translation: Translation,
|
||||
key: string,
|
||||
tags: UIEventSource<any>,
|
||||
state: FeaturePipelineState
|
||||
) {
|
||||
super()
|
||||
this._inputElement = inputElement;
|
||||
this._inputElement = inputElement
|
||||
const mapping = new Map<string, BaseUIElement>()
|
||||
|
||||
mapping.set(key, inputElement)
|
||||
|
||||
// Bit of a hack: the SubstitutedTranslation expects a special rendering, but those are formatted '{key()}' instead of '{key}', so we substitute it first
|
||||
translation = translation.OnEveryLanguage((txt) => txt.replace("{" + key + "}", "{" + key + "()}"))
|
||||
translation = translation.OnEveryLanguage((txt) =>
|
||||
txt.replace("{" + key + "}", "{" + key + "()}")
|
||||
)
|
||||
this._renderElement = new SubstitutedTranslation(translation, tags, state, mapping)
|
||||
}
|
||||
|
||||
GetValue(): UIEventSource<T> {
|
||||
return this._inputElement.GetValue();
|
||||
return this._inputElement.GetValue()
|
||||
}
|
||||
|
||||
IsValid(t: T): boolean {
|
||||
return this._inputElement.IsValid(t);
|
||||
return this._inputElement.IsValid(t)
|
||||
}
|
||||
|
||||
protected InnerConstructElement(): HTMLElement {
|
||||
return this._renderElement.ConstructElement();
|
||||
return this._renderElement.ConstructElement()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue