forked from MapComplete/MapComplete
Fixed part of the special renderings
This commit is contained in:
parent
eec762b71f
commit
e480c97676
11 changed files with 156 additions and 147 deletions
38
test.ts
38
test.ts
|
@ -1,27 +1,31 @@
|
|||
import {RadioButton} from "./UI/Input/RadioButton";
|
||||
import {FixedInputElement} from "./UI/Input/FixedInputElement";
|
||||
import {SubstitutedTranslation} from "./UI/SubstitutedTranslation";
|
||||
import {UIEventSource} from "./Logic/UIEventSource";
|
||||
import {Translation} from "./UI/i18n/Translation";
|
||||
import TagRenderingAnswer from "./UI/Popup/TagRenderingAnswer";
|
||||
import TagRenderingConfig from "./Customizations/JSON/TagRenderingConfig";
|
||||
import EditableTagRendering from "./UI/Popup/EditableTagRendering";
|
||||
import SpecialVisualizations from "./UI/SpecialVisualizations";
|
||||
import State from "./State";
|
||||
import Combine from "./UI/Base/Combine";
|
||||
import {FixedUiElement} from "./UI/Base/FixedUiElement";
|
||||
|
||||
|
||||
const tagsSource = new UIEventSource({
|
||||
id:'id',
|
||||
name:'name',
|
||||
surface:'asphalt'
|
||||
surface:'asphalt',
|
||||
image: "https://i.imgur.com/kX3rl3v.jpg",
|
||||
"image:1": "https://i.imgur.com/kX3rl3v.jpg",
|
||||
_country:"be",
|
||||
// "opening_hours":"mo-fr 09:00-18:00"
|
||||
})
|
||||
|
||||
const config = new TagRenderingConfig({
|
||||
render: "Rendering {name} {id} {surface}"
|
||||
}, null, "test")
|
||||
const state = new State(undefined)
|
||||
State.state = state
|
||||
|
||||
new EditableTagRendering(
|
||||
tagsSource,
|
||||
config
|
||||
).AttachTo("extradiv")
|
||||
const allSpecials = SpecialVisualizations.specialVisualizations.map(spec => {
|
||||
try{
|
||||
|
||||
|
||||
window.v = tagsSource
|
||||
return new Combine([spec.funcName, spec.constr(state, tagsSource, spec.args.map(a => a.defaultValue ?? "")).SetClass("block")])
|
||||
.SetClass("flex flex-col border border-black p-2 m-2");
|
||||
}catch(e){
|
||||
console.error(e)
|
||||
return new FixedUiElement("Could not construct "+spec.funcName+" due to "+e).SetClass("alert")
|
||||
}
|
||||
})
|
||||
new Combine(allSpecials).AttachTo("maindiv")
|
Loading…
Add table
Add a link
Reference in a new issue