mapcomplete/Docs/SpecialInputElements.md

148 lines
2.9 KiB
Markdown
Raw Normal View History

2021-11-07 17:18:10 +01:00
2021-11-08 02:36:01 +01:00
2021-11-07 17:18:10 +01:00
Available types for text fields
2021-10-29 13:53:00 +02:00
=================================
2021-05-11 10:14:33 +02:00
2021-11-07 17:18:10 +01:00
The listed types here trigger a special input element. Use them in `tagrendering.freeform.type` of your tagrendering to activate them
2021-05-11 10:14:33 +02:00
## string
A basic string
## text
2021-11-08 02:36:01 +01:00
A string, but allows input of longer strings more comfortably and supports newlines (a text area)
2021-05-11 10:14:33 +02:00
## date
A date
2021-07-24 02:42:37 +02:00
## direction
A geographical direction, in degrees. 0° is north, 90° is east, ... Will return a value between 0 (incl) and 360 (excl)
## length
2021-11-07 17:18:10 +01:00
A geographical length in meters (rounded at two points). Will give an extra minimap with a measurement tool. Arguments: [ zoomlevel, preferredBackgroundMapType (comma separated) ], e.g. `["21", "map,photo"]
2021-07-24 02:42:37 +02:00
2021-05-11 10:14:33 +02:00
## wikidata
2021-11-07 17:18:10 +01:00
A wikidata identifier, e.g. Q42.
2021-11-08 02:36:01 +01:00
2021-11-07 17:18:10 +01:00
### Helper arguments
2021-11-07 17:18:10 +01:00
name | doc
------ | -----
key | the value of this tag will initialize search (default: name)
2021-11-07 17:18:10 +01:00
options | A JSON-object of type `{ removePrefixes: string[], removePostfixes: string[] }`.
subarg | doc
-------- | -----
removePrefixes | remove these snippets of text from the start of the passed string to search
removePostfixes | remove these snippets of text from the end of the passed string to search
2021-11-07 17:18:10 +01:00
2021-11-08 02:36:01 +01:00
2021-11-07 17:18:10 +01:00
### Example usage
2021-11-07 17:18:10 +01:00
The following is the 'freeform'-part of a layer config which will trigger a search for the wikidata item corresponding with the name of the selected feature. It will also remove '-street', '-square', ... if found at the end of the name
2021-10-29 03:59:28 +02:00
```
"freeform": {
2021-10-29 13:35:33 +02:00
"key": "name:etymology:wikidata",
"type": "wikidata",
"helperArgs": [
"name",
{
"removePostfixes": [
"street",
"boulevard",
"path",
"square",
"plaza",
]
}
]
}
```
2021-05-11 10:14:33 +02:00
## int
A number
## nat
A positive number or zero
## pnat
A strict positive number
## float
A decimal
## pfloat
A positive decimal (incl zero)
## email
An email adress
## url
A url
## phone
A phone number
## opening_hours
2021-11-07 17:18:10 +01:00
Has extra elements to easily input when a POI is opened.
2021-11-08 02:36:01 +01:00
2021-11-07 17:18:10 +01:00
### Helper arguments
2021-11-07 17:18:10 +01:00
name | doc
------ | -----
2021-11-07 17:18:10 +01:00
options | A JSON-object of type `{ prefix: string, postfix: string }`.
subarg | doc
-------- | -----
prefix | Piece of text that will always be added to the front of the generated opening hours. If the OSM-data does not start with this, it will fail to parse
postfix | Piece of text that will always be added to the end of the generated opening hours
2021-11-07 17:18:10 +01:00
2021-11-08 02:36:01 +01:00
2021-11-07 17:18:10 +01:00
### Example usage
2021-11-07 17:18:10 +01:00
To add a conditional (based on time) access restriction:
```
2021-10-29 03:59:28 +02:00
2021-10-29 13:35:33 +02:00
"freeform": {
"key": "access:conditional",
"type": "opening_hours",
"helperArgs": [
{
"prefix":"no @ (",
"postfix":")"
}
]
}
```
2021-11-07 17:18:10 +01:00
*Don't forget to pass the prefix and postfix in the rendering as well*: `{opening_hours_table(opening_hours,yes @ &LPARENS, &RPARENS )`
2021-05-11 10:14:33 +02:00
## color
2021-11-08 02:36:01 +01:00
Shows a color picker
This document is autogenerated from ValidatedTextField.ts