forked from MapComplete/MapComplete
New dependency system for TagDependantUIElement
This commit is contained in:
parent
d7809b88bc
commit
a8314b39e6
6 changed files with 22 additions and 15 deletions
|
@ -83,6 +83,10 @@ export class Map extends LayerDefinition {
|
|||
k: new Tag("map_source:attribution", "no"),
|
||||
txt: "There is no attribution at all"
|
||||
},
|
||||
{
|
||||
k: new Tag("map_source:attribution", "none"),
|
||||
txt: "There is no attribution at all"
|
||||
}
|
||||
]
|
||||
}).OnlyShowIf(new Tag("map_source", "OpenStreetMap"))
|
||||
]
|
||||
|
|
|
@ -17,9 +17,9 @@ export class OnlyShowIfConstructor implements TagDependantUIElementConstructor{
|
|||
this._embedded = embedded;
|
||||
}
|
||||
|
||||
construct(tags: UIEventSource<any>, changes: Changes): TagDependantUIElement {
|
||||
return new OnlyShowIf(tags,
|
||||
this._embedded.construct(tags, changes),
|
||||
construct(dependencies): TagDependantUIElement {
|
||||
return new OnlyShowIf(dependencies.tags,
|
||||
this._embedded.construct(dependencies),
|
||||
this._tagsFilter);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,9 +86,9 @@ export class TagRenderingOptions implements TagDependantUIElementConstructor {
|
|||
}) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
OnlyShowIf(tagsFilter: TagsFilter) : TagDependantUIElementConstructor{
|
||||
return new OnlyShowIfConstructor(tagsFilter, this);
|
||||
|
||||
OnlyShowIf(dependencies): TagDependantUIElementConstructor {
|
||||
return new OnlyShowIfConstructor(dependencies, this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,8 +111,8 @@ export class TagRenderingOptions implements TagDependantUIElementConstructor {
|
|||
}
|
||||
|
||||
|
||||
construct(tags: UIEventSource<any>, changes: Changes): TagDependantUIElement {
|
||||
return new TagRendering(tags, changes, this.options);
|
||||
construct(dependencies: { tags: UIEventSource<any>, changes: Changes }): TagDependantUIElement {
|
||||
return new TagRendering(dependencies.tags, dependencies.changes, this.options);
|
||||
}
|
||||
|
||||
IsKnown(properties: any): boolean {
|
||||
|
|
|
@ -5,7 +5,7 @@ import {UIElement} from "../UI/UIElement";
|
|||
|
||||
export interface TagDependantUIElementConstructor {
|
||||
|
||||
construct(tags: UIEventSource<any>, changes: Changes): TagDependantUIElement;
|
||||
construct(dependencies: {tags: UIEventSource<any>, changes: Changes}): TagDependantUIElement;
|
||||
IsKnown(properties: any): boolean;
|
||||
IsQuestioning(properties: any): boolean;
|
||||
Priority(): number;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue