PopupTemplate class
A layout template for a popup.
Properties
content | A HTML string for the main content of the popup that contains placeholders for properties of the feature it is being displayed for. Placeholders can be in the format "{propertyName}" or "{propertyName/subPropertyName}". |
date |
If the property is a date object, these options specify how it should be formatted when displayed. Uses Date.toLocaleString. If not specified, dates will be converted to strings using Date.toISOString |
detect |
Specifies if hyperlinks and email addresses should automatically be detected and rendered as clickable links.
Default: |
fill |
The background color of the popup template. |
hyperlink |
Format options for hyperlink strings. |
number |
If the property is a number, these options specify how it should be formatted when displayed. Uses Number.toLocaleString. |
sandbox |
Specifies if content should be wrapped with a sandboxed iframe. Unless explicitly set to false, the content will be sandboxed within an iframe by default. When enabled, all content will be wrapped in a sandboxed iframe with scripts, forms, pointer lock and top navigation disabled. Popups will be allowed so that links can be opened in a new page or tab. Older browsers that don't support the srcdoc parameter on iframes will be limited to rendering a small amount of content. |
single |
If a description is available, it will be written as the content rather than as a table of properties.
Default: |
text |
The default text color of the popup template. |
title | A HTML string for the title of the popup that contains placeholders for properties of the feature it is being displayed for. Placeholders can be in the format "{propertyName}" or "{propertyName/subPropertyName}". |
Methods
apply |
Generates popup content by applying a template to a set of properties.
If no template is specified, |
Property Details
content
A HTML string for the main content of the popup that contains placeholders for properties of the feature it is being displayed for. Placeholders can be in the format "{propertyName}" or "{propertyName/subPropertyName}".
content?: string | PropertyInfo[] | Array<string | PropertyInfo[]>
Property Value
string | PropertyInfo[] | Array<string | PropertyInfo[]>
dateFormat
If the property is a date object, these options specify how it should be formatted when displayed. Uses Date.toLocaleString. If not specified, dates will be converted to strings using Date.toISOString
dateFormat?: DateTimeFormatOptions
Property Value
DateTimeFormatOptions
detectHyperlinks
Specifies if hyperlinks and email addresses should automatically be detected and rendered as clickable links.
Default: true
detectHyperlinks?: boolean
Property Value
boolean
fillColor
The background color of the popup template.
fillColor?: string
Property Value
string
hyperlinkFormat
Format options for hyperlink strings.
hyperlinkFormat?: HyperLinkFormatOptions
Property Value
numberFormat
If the property is a number, these options specify how it should be formatted when displayed. Uses Number.toLocaleString.
numberFormat?: NumberFormatOptions
Property Value
NumberFormatOptions
sandboxContent
Specifies if content should be wrapped with a sandboxed iframe. Unless explicitly set to false, the content will be sandboxed within an iframe by default. When enabled, all content will be wrapped in a sandboxed iframe with scripts, forms, pointer lock and top navigation disabled. Popups will be allowed so that links can be opened in a new page or tab. Older browsers that don't support the srcdoc parameter on iframes will be limited to rendering a small amount of content.
sandboxContent?: boolean
Property Value
boolean
singleDescription
If a description is available, it will be written as the content rather than as a table of properties.
Default: true
singleDescription?: boolean
Property Value
boolean
textColor
The default text color of the popup template.
textColor?: string
Property Value
string
title
A HTML string for the title of the popup that contains placeholders for properties of the feature it is being displayed for. Placeholders can be in the format "{propertyName}" or "{propertyName/subPropertyName}".
title?: string
Property Value
string
Method Details
applyTemplate(Properties, PopupTemplate)
Generates popup content by applying a template to a set of properties.
If no template is specified, title
or name
properties will be used as fallbacks for the title if available.
For content, a description
property will be used or else all properties will be converted into a table.
static function applyTemplate(prop: Properties, template?: PopupTemplate): HTMLElement
Parameters
- prop
- Properties
The properties object generate the popup content from.
- template
- PopupTemplate
The template to apply.
Returns
HTMLElement