forked from MapComplete/MapComplete
Studio: WIP
This commit is contained in:
parent
a1843b006c
commit
b6142c758c
27 changed files with 29013 additions and 6886 deletions
|
|
@ -8,6 +8,7 @@ import PointRenderingConfigJson from "./PointRenderingConfigJson"
|
|||
import LineRenderingConfigJson from "./LineRenderingConfigJson"
|
||||
import { QuestionableTagRenderingConfigJson } from "./QuestionableTagRenderingConfigJson"
|
||||
import RewritableConfigJson from "./RewritableConfigJson"
|
||||
import { Translatable } from "./Translatable"
|
||||
|
||||
/**
|
||||
* Configuration for a single layer
|
||||
|
|
@ -30,7 +31,7 @@ export interface LayerConfigJson {
|
|||
* group: Basic
|
||||
* question: What is the name of this layer?
|
||||
*/
|
||||
name?: string | Record<string, string>
|
||||
name?: Translatable
|
||||
|
||||
/**
|
||||
* A description for the features shown in this layer.
|
||||
|
|
@ -39,7 +40,7 @@ export interface LayerConfigJson {
|
|||
* group: Basic
|
||||
* question: How would you describe the features that are shown on this layer?
|
||||
*/
|
||||
description?: string | Record<string, string>
|
||||
description?: Translatable
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -203,9 +204,13 @@ export interface LayerConfigJson {
|
|||
/**
|
||||
* The title shown in a popup for elements of this layer.
|
||||
*
|
||||
* group: infobox
|
||||
* group: title
|
||||
* question: What title should be shown on the infobox?
|
||||
* types: Use a dynamic tagRendering ; use a fixed value
|
||||
* typesdefault: 0
|
||||
*
|
||||
*/
|
||||
title?: string | TagRenderingConfigJson
|
||||
title?: TagRenderingConfigJson | string
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -313,7 +318,7 @@ export interface LayerConfigJson {
|
|||
* question: What is the word to describe this object?
|
||||
* inline: Add <b>{value}</b> here
|
||||
*/
|
||||
title: string | Record<string, string>
|
||||
title: Translatable
|
||||
/**
|
||||
* A single tag (encoded as <code>key=value</code>) out of all the tags to add onto the newly created point.
|
||||
* Note that the icon in the UI will be chosen automatically based on the tags provided here.
|
||||
|
|
@ -332,7 +337,7 @@ export interface LayerConfigJson {
|
|||
*
|
||||
* question: How would you describe this feature?
|
||||
*/
|
||||
description?: string | Record<string, string>
|
||||
description?: Translatable
|
||||
|
||||
/**
|
||||
* The URL of an example image which shows a real-life example of what such a feature might look like.
|
||||
|
|
@ -368,7 +373,8 @@ export interface LayerConfigJson {
|
|||
}[]
|
||||
|
||||
/**
|
||||
* All the tag renderings.
|
||||
* question: Which tagRenderings should be shown in the infobox?
|
||||
*
|
||||
* A tag rendering is a block that either shows the known value or asks a question.
|
||||
*
|
||||
* Refer to the class `TagRenderingConfigJson` to see the possibilities.
|
||||
|
|
@ -388,6 +394,7 @@ export interface LayerConfigJson {
|
|||
* These will be grouped and questions will be asked together
|
||||
*
|
||||
* group: tagrenderings
|
||||
*
|
||||
*/
|
||||
tagRenderings?: (
|
||||
| string
|
||||
|
|
|
|||
|
|
@ -3,9 +3,12 @@ import { TagRenderingConfigJson } from "./TagRenderingConfigJson"
|
|||
|
||||
export interface MappingConfigJson {
|
||||
/**
|
||||
* @inheritDoc
|
||||
* quesiton: What tags should be matched to show this option?
|
||||
*
|
||||
* If in 'question'-mode and the contributor selects this option, these tags will be applied to the object
|
||||
*/
|
||||
if: TagConfigJson
|
||||
|
||||
/**
|
||||
* Shown if the 'if is fulfilled
|
||||
* Type: rendered
|
||||
|
|
@ -143,16 +146,30 @@ export interface MappingConfigJson {
|
|||
*/
|
||||
export interface QuestionableTagRenderingConfigJson extends TagRenderingConfigJson {
|
||||
/**
|
||||
* If it turns out that this tagRendering doesn't match _any_ value, then we show this question.
|
||||
* If undefined, the question is never asked and this tagrendering is read-only
|
||||
* The id of the tagrendering, should be an unique string.
|
||||
* Used to keep the translations in sync. Only used in the tagRenderings-array of a layerConfig, not requered otherwise.
|
||||
*
|
||||
* question: What is the id of this tagRendering?
|
||||
*/
|
||||
question?: string | Record<string, string>
|
||||
id: string
|
||||
|
||||
/**
|
||||
* A hint which is shown in subtle text under the question.
|
||||
* This can give some extra information on what the answer should ook like
|
||||
* Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes
|
||||
*
|
||||
* question: What are common options?
|
||||
*/
|
||||
questionHint?: string | Record<string, string>
|
||||
mappings?: MappingConfigJson[]
|
||||
|
||||
/**
|
||||
* If true, use checkboxes instead of radio buttons when asking the question
|
||||
*
|
||||
* question: Should a contributor be allowed to select multiple mappings?
|
||||
*
|
||||
* iftrue: allow to select multiple mappigns
|
||||
* iffalse: only allow to select a single mapping
|
||||
* ifunset: only allow to select a single mapping
|
||||
*/
|
||||
multiAnswer?: boolean
|
||||
|
||||
/**
|
||||
* Allow freeform text input from the user
|
||||
|
|
@ -201,12 +218,19 @@ export interface QuestionableTagRenderingConfigJson extends TagRenderingConfigJs
|
|||
}
|
||||
|
||||
/**
|
||||
* If true, use checkboxes instead of radio buttons when asking the question
|
||||
* If it turns out that this tagRendering doesn't match _any_ value, then we show this question.
|
||||
* If undefined, the question is never asked and this tagrendering is read-only
|
||||
*/
|
||||
multiAnswer?: boolean
|
||||
question?: string | Record<string, string>
|
||||
|
||||
/**
|
||||
* Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes
|
||||
* A hint which is shown in subtle text under the question.
|
||||
* This can give some extra information on what the answer should ook like
|
||||
*/
|
||||
mappings?: MappingConfigJson[]
|
||||
questionHint?: string | Record<string, string>
|
||||
|
||||
/**
|
||||
* A list of labels. These are strings that are used for various purposes, e.g. to filter them away
|
||||
*/
|
||||
labels?: string[]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,11 @@
|
|||
import { TagConfigJson } from "./TagConfigJson"
|
||||
import { Translatable } from "./Translatable"
|
||||
|
||||
/**
|
||||
* A TagRenderingConfigJson is a single piece of code which converts one ore more tags into a HTML-snippet.
|
||||
* For an _editable_ tagRendering, use 'QuestionableTagRenderingConfigJson' instead, which extends this one
|
||||
*/
|
||||
export interface TagRenderingConfigJson {
|
||||
/**
|
||||
* The id of the tagrendering, should be an unique string.
|
||||
* Used to keep the translations in sync. Only used in the tagRenderings-array of a layerConfig, not requered otherwise.
|
||||
*
|
||||
* Use 'questions' to trigger the question box of this group (if a group is defined)
|
||||
*/
|
||||
id?: string
|
||||
|
||||
/**
|
||||
* A list of labels. These are strings that are used for various purposes, e.g. to filter them away
|
||||
*/
|
||||
labels?: string[]
|
||||
|
||||
/**
|
||||
* A list of css-classes to apply to the entire tagRendering if the answer is known (not applied on the question).
|
||||
* This is only for advanced users
|
||||
|
|
@ -38,8 +26,7 @@ export interface TagRenderingConfigJson {
|
|||
* type: rendered
|
||||
*/
|
||||
render?:
|
||||
| string
|
||||
| Record<string, string>
|
||||
| Translatable
|
||||
| { special: Record<string, string | Record<string, string>> & { type: string } }
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export type Translatable = string | Record<string, string>
|
||||
Loading…
Add table
Add a link
Reference in a new issue