forked from MapComplete/MapComplete
More work on the custom theme generator, kindof works now
This commit is contained in:
parent
1fa6a8edfb
commit
ee9c9e201f
24 changed files with 1192 additions and 2265 deletions
|
@ -1,6 +1,5 @@
|
|||
import {InputElement} from "./InputElement";
|
||||
import {UIElement} from "../UIElement";
|
||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
import Translations from "../i18n/Translations";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
|
||||
|
@ -9,6 +8,9 @@ export class InputElementWrapper<T> extends InputElement<T>{
|
|||
private input: InputElement<T>;
|
||||
private post: UIElement ;
|
||||
|
||||
IsSelected: UIEventSource<boolean>
|
||||
|
||||
|
||||
constructor(
|
||||
pre: UIElement | string,
|
||||
input: InputElement<T>,
|
||||
|
@ -21,6 +23,7 @@ export class InputElementWrapper<T> extends InputElement<T>{
|
|||
this.input = input;
|
||||
// this.post =typeof(post) === 'string' ? new FixedUiElement(post) : post
|
||||
this.post = Translations.W(post)
|
||||
this.IsSelected = input.IsSelected;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import {UIEventSource} from "../../Logic/UIEventSource";
|
|||
import {UIElement} from "../UIElement";
|
||||
import Combine from "../Base/Combine";
|
||||
import {SubtleButton} from "../Base/SubtleButton";
|
||||
import TagInput from "./TagInput";
|
||||
import TagInput from "./SingleTagInput";
|
||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
import {MultiInput} from "./MultiInput";
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {InputElement} from "./InputElement";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import {Utils} from "../../Utils";
|
||||
|
||||
export class RadioButton<T> extends InputElement<T> {
|
||||
IsSelected: UIEventSource<boolean> = new UIEventSource<boolean>(false);
|
||||
|
@ -15,7 +16,7 @@ export class RadioButton<T> extends InputElement<T> {
|
|||
constructor(elements: InputElement<T>[],
|
||||
selectFirstAsDefault = true) {
|
||||
super(undefined);
|
||||
this._elements = elements;
|
||||
this._elements = Utils.NoNull(elements);
|
||||
this._selectFirstAsDefault = selectFirstAsDefault;
|
||||
const self = this;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ export default class SingleTagInput extends InputElement<string> {
|
|||
this.value = new TextField<string>({
|
||||
placeholder: "value - if blank, matches if key is NOT present",
|
||||
fromString: str => str,
|
||||
toString: str => str
|
||||
toString: str => str,
|
||||
}
|
||||
);
|
||||
this.operator = new DropDown<string>("", [
|
|
@ -65,13 +65,17 @@ export class TextField<T> extends InputElement<T> {
|
|||
});
|
||||
}
|
||||
|
||||
public static KeyInput(): TextField<string>{
|
||||
public static KeyInput(allowEmpty : boolean = false): TextField<string>{
|
||||
return new TextField<string>({
|
||||
placeholder: "key",
|
||||
fromString: str => {
|
||||
if (str?.match(/^[a-zA-Z][a-zA-Z0-9:_-]*$/)) {
|
||||
return str;
|
||||
}
|
||||
if(str === "" && allowEmpty){
|
||||
return "";
|
||||
}
|
||||
|
||||
return undefined
|
||||
},
|
||||
toString: str => str
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue