forked from MapComplete/MapComplete
		
	
		
			
				
	
	
		
			257 lines
		
	
	
		
			No EOL
		
	
	
		
			4.6 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			257 lines
		
	
	
		
			No EOL
		
	
	
		
			4.6 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| 
 | |
| 
 | |
|  Available types for text fields 
 | |
| =================================
 | |
| 
 | |
| 
 | |
| 
 | |
| ## Table of contents
 | |
| 
 | |
| 1. [Available types for text fields](#available-types-for-text-fields)
 | |
|     + [string](#string)
 | |
|     + [text](#text)
 | |
|     + [date](#date)
 | |
|     + [nat](#nat)
 | |
|     + [int](#int)
 | |
|     + [distance](#distance)
 | |
|     + [direction](#direction)
 | |
|     + [wikidata](#wikidata)
 | |
|     + [pnat](#pnat)
 | |
|     + [float](#float)
 | |
|     + [pfloat](#pfloat)
 | |
|     + [email](#email)
 | |
|     + [url](#url)
 | |
|     + [phone](#phone)
 | |
|     + [opening_hours](#opening_hours)
 | |
|     + [color](#color)
 | |
| 
 | |
| 
 | |
| 
 | |
| The listed types here trigger a special input element. Use them in `tagrendering.freeform.type` of your tagrendering to activate them
 | |
| 
 | |
| 
 | |
| 
 | |
| ### string 
 | |
| 
 | |
| 
 | |
| 
 | |
| A simple piece of text
 | |
| 
 | |
| 
 | |
| 
 | |
| ### text 
 | |
| 
 | |
| 
 | |
| 
 | |
| A longer piece of text. Uses an textArea instead of a textField
 | |
| 
 | |
| 
 | |
| 
 | |
| ### date 
 | |
| 
 | |
| 
 | |
| 
 | |
| A date with date picker
 | |
| 
 | |
| 
 | |
| 
 | |
| ### nat 
 | |
| 
 | |
| 
 | |
| 
 | |
| A positive number or zero
 | |
| 
 | |
| 
 | |
| 
 | |
| ### int 
 | |
| 
 | |
| 
 | |
| 
 | |
| A number
 | |
| 
 | |
| 
 | |
| 
 | |
| ### distance 
 | |
| 
 | |
| 
 | |
| 
 | |
| A geographical distance 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"]
 | |
| 
 | |
| 
 | |
| 
 | |
| ### direction 
 | |
| 
 | |
| 
 | |
| 
 | |
| A geographical direction, in degrees. 0° is north, 90° is east, ... Will return a value between 0 (incl) and 360 (excl)
 | |
| 
 | |
| 
 | |
| 
 | |
| ### wikidata 
 | |
| 
 | |
| 
 | |
| 
 | |
| A wikidata identifier, e.g. Q42. 
 | |
| 
 | |
| ### Helper arguments 
 | |
| 
 | |
|  
 | |
| 
 | |
| name | doc
 | |
| ------ | -----
 | |
| key | the value of this tag will initialize search (default: name)
 | |
| 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. This is either a list OR a hash of languages to a list
 | |
| removePostfixes | remove these snippets of text from the end of the passed string to search. This is either a list OR a hash of languages to a list
 | |
| instanceOf | A list of Q-identifier which indicates that the search results _must_ be an entity of this type, e.g. [`Q5`](https://www.wikidata.org/wiki/Q5) for humans
 | |
| notInstanceof | A list of Q-identifiers which indicates that the search results _must not_ be an entity of this type, e.g. [`Q79007`](https://www.wikidata.org/wiki/Q79007) to filter away all streets from the search results
 | |
| 
 | |
|  
 | |
| 
 | |
| ### Example usage 
 | |
| 
 | |
|  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
 | |
| 
 | |
| ```json
 | |
| "freeform": {
 | |
|     "key": "name:etymology:wikidata",
 | |
|     "type": "wikidata",
 | |
|     "helperArgs": [
 | |
|         "name",
 | |
|         {
 | |
|             "removePostfixes": {"en": [
 | |
|                 "street",
 | |
|                 "boulevard",
 | |
|                 "path",
 | |
|                 "square",
 | |
|                 "plaza",
 | |
|             ],
 | |
|              "nl": ["straat","plein","pad","weg",laan"]
 | |
|              },
 | |
| 
 | |
|             "#": "Remove streets and parks from the search results:"
 | |
|              "notInstanceOf": ["Q79007","Q22698"]
 | |
|         }
 | |
| 
 | |
|     ]
 | |
| }
 | |
| ```
 | |
| 
 | |
| Another example is to search for species and trees:
 | |
| 
 | |
| ```json
 | |
|  "freeform": {
 | |
|         "key": "species:wikidata",
 | |
|         "type": "wikidata",
 | |
|         "helperArgs": [
 | |
|           "species",
 | |
|           {
 | |
|           "instanceOf": [10884, 16521]
 | |
|         }]
 | |
|       }
 | |
| ```
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| ### pnat 
 | |
| 
 | |
| 
 | |
| 
 | |
| A strict positive number
 | |
| 
 | |
| 
 | |
| 
 | |
| ### float 
 | |
| 
 | |
| 
 | |
| 
 | |
| A decimal
 | |
| 
 | |
| 
 | |
| 
 | |
| ### pfloat 
 | |
| 
 | |
| 
 | |
| 
 | |
| A positive decimal (inclusive zero)
 | |
| 
 | |
| 
 | |
| 
 | |
| ### email 
 | |
| 
 | |
| 
 | |
| 
 | |
| An email adress
 | |
| 
 | |
| 
 | |
| 
 | |
| ### url 
 | |
| 
 | |
| 
 | |
| 
 | |
| The validatedTextField will format URLs to always be valid and have a https://-header (even though the 'https'-part will be hidden from the user
 | |
| 
 | |
| 
 | |
| 
 | |
| ### phone 
 | |
| 
 | |
| 
 | |
| 
 | |
| A phone number
 | |
| 
 | |
| 
 | |
| 
 | |
| ### opening_hours 
 | |
| 
 | |
| 
 | |
| 
 | |
| Has extra elements to easily input when a POI is opened. 
 | |
| 
 | |
| ### Helper arguments 
 | |
| 
 | |
|  
 | |
| 
 | |
| name | doc
 | |
| ------ | -----
 | |
| 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
 | |
| 
 | |
|  
 | |
| 
 | |
| ### Example usage 
 | |
| 
 | |
|  To add a conditional (based on time) access restriction:
 | |
| 
 | |
| ```
 | |
| 
 | |
| "freeform": {
 | |
|     "key": "access:conditional",
 | |
|     "type": "opening_hours",
 | |
|     "helperArgs": [
 | |
|         {
 | |
|           "prefix":"no @ (",
 | |
|           "postfix":")"
 | |
|         }
 | |
|     ]
 | |
| }
 | |
| ```
 | |
| 
 | |
| *Don't forget to pass the prefix and postfix in the rendering as well*: `{opening_hours_table(opening_hours,yes @ &LPARENS, &RPARENS )`
 | |
| 
 | |
| 
 | |
| 
 | |
| ### color 
 | |
| 
 | |
| 
 | |
| 
 | |
| Shows a color picker 
 | |
| 
 | |
| This document is autogenerated from [UI/Input/ValidatedTextField.ts](https://github.com/pietervdvn/MapComplete/blob/develop/UI/Input/ValidatedTextField.ts) |