Remove empty spaces
Default Setting by my editor. Let me know I you want to keep them.
This commit is contained in:
parent
8f8e5f7636
commit
61964a801f
6 changed files with 22 additions and 26 deletions
|
@ -1,5 +1,5 @@
|
|||
export class UIEventSource<T>{
|
||||
|
||||
|
||||
public data: T;
|
||||
private _callbacks = [];
|
||||
|
||||
|
@ -7,7 +7,6 @@ export class UIEventSource<T>{
|
|||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
public addCallback(callback: ((latestData: T) => void)): UIEventSource<T> {
|
||||
if(callback === console.log){
|
||||
// This ^^^ actually works!
|
||||
|
@ -49,19 +48,19 @@ export class UIEventSource<T>{
|
|||
sink.setData(source.data?.data);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return sink;
|
||||
}
|
||||
|
||||
|
||||
public map<J>(f: ((T) => J),
|
||||
extraSources: UIEventSource<any>[] = [],
|
||||
g: ((J) => T) = undefined ): UIEventSource<J> {
|
||||
const self = this;
|
||||
|
||||
|
||||
const newSource = new UIEventSource<J>(
|
||||
f(this.data)
|
||||
);
|
||||
|
||||
|
||||
const update = function () {
|
||||
newSource.setData(f(self.data));
|
||||
}
|
||||
|
@ -70,17 +69,17 @@ export class UIEventSource<T>{
|
|||
for (const extraSource of extraSources) {
|
||||
extraSource?.addCallback(update);
|
||||
}
|
||||
|
||||
|
||||
if(g !== undefined) {
|
||||
newSource.addCallback((latest) => {
|
||||
self.setData(g(latest));
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return newSource;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public syncWith(otherSource: UIEventSource<T>, reverseOverride = false): UIEventSource<T> {
|
||||
this.addCallback((latest) => otherSource.setData(latest));
|
||||
const self = this;
|
||||
|
@ -94,11 +93,11 @@ export class UIEventSource<T>{
|
|||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public stabilized(millisToStabilize) : UIEventSource<T>{
|
||||
|
||||
|
||||
const newSource = new UIEventSource<T>(this.data);
|
||||
|
||||
|
||||
let currentCallback = 0;
|
||||
this.addCallback(latestData => {
|
||||
currentCallback++;
|
||||
|
@ -109,10 +108,10 @@ export class UIEventSource<T>{
|
|||
}
|
||||
}, millisToStabilize)
|
||||
});
|
||||
|
||||
|
||||
return newSource;
|
||||
}
|
||||
|
||||
|
||||
public static Chronic(millis: number, asLong: () => boolean = undefined): UIEventSource<Date> {
|
||||
const source = new UIEventSource<Date>(undefined);
|
||||
|
||||
|
@ -125,7 +124,7 @@ export class UIEventSource<T>{
|
|||
|
||||
run();
|
||||
return source;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -28,5 +28,5 @@ export default class CheckBox extends UIElement{
|
|||
return Translations.W(this._showDisabled).Render();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -11,7 +11,7 @@ export class RadioButton<T> extends InputElement<T> {
|
|||
private readonly value: UIEventSource<T>;
|
||||
private readonly _elements: InputElement<T>[]
|
||||
private readonly _selectFirstAsDefault: boolean;
|
||||
|
||||
|
||||
constructor(elements: InputElement<T>[],
|
||||
selectFirstAsDefault = true) {
|
||||
super(undefined);
|
||||
|
|
|
@ -40,7 +40,6 @@ export default class QuestionBox extends UIElement {
|
|||
})
|
||||
));
|
||||
|
||||
|
||||
this._skippedQuestionsButton = Translations.t.general.skippedQuestions.Clone()
|
||||
.onClick(() => {
|
||||
self._skippedQuestions.setData([]);
|
||||
|
@ -64,19 +63,19 @@ export default class QuestionBox extends UIElement {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (tagRendering.GetRenderValue(this._tags.data) !== undefined) {
|
||||
// This value is known and can be rendered
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
for (let i = 0; i < this._tagRenderingQuestions.length; i++) {
|
||||
let tagRendering = this._tagRenderings[i];
|
||||
|
||||
|
||||
if(this.IsKnown(tagRendering)){
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,6 @@ export default class TagRenderingQuestion extends UIElement {
|
|||
if (csCount < Constants.userJourney.tagsVisibleAt) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (tags === undefined) {
|
||||
return Translations.t.general.noTagsSelected.SetClass("subtle").Render();
|
||||
}
|
||||
|
@ -89,8 +88,8 @@ export default class TagRenderingQuestion extends UIElement {
|
|||
return tags.asHumanString(true, true);
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
).AddClass("block")
|
||||
}
|
||||
|
||||
private GenerateInputElement(): InputElement<TagsFilter> {
|
||||
|
@ -268,7 +267,6 @@ export default class TagRenderingQuestion extends UIElement {
|
|||
|
||||
}
|
||||
|
||||
|
||||
InnerRender(): string {
|
||||
return new Combine([
|
||||
this._question,
|
||||
|
|
|
@ -87,11 +87,11 @@ export default class ReviewForm extends InputElement<Review> {
|
|||
}
|
||||
|
||||
InnerRender(): string {
|
||||
|
||||
|
||||
if(!this.userDetails.data.loggedIn){
|
||||
return Translations.t.reviews.plz_login.Render();
|
||||
}
|
||||
|
||||
|
||||
return new Combine([
|
||||
new Combine([this._stars, this._postingAs]).SetClass("review-form-top"),
|
||||
this._comment,
|
||||
|
|
Loading…
Reference in a new issue