<mosaica-view-picker>¶
A drop-down menu for switching views.
Use the view picker when the bundle lays its items out in more than one way and viewers should choose the layout. Each view that belongs to no group is one entry, and so is each group of views. When there is only one entry, the picker shows nothing.
Choosing a group opens the view the viewer last left that group on, or the group's first view.
When the current view's group shares keys with the chosen group, the picker opens the view under
the current key instead, so that the viewer stays on the same year or quarter. Viewers step
between the views inside a group with <mosaica-key-picker>.
import '@mosaicajs/components/view-picker';
Attributes¶
| Attribute | Property | Type | Default | Description |
|---|---|---|---|---|
viewer-url |
viewerUrl |
string |
'' |
The base URL of the Mosaica viewer server, for the store the element builds: a full URL such as https://maps.example.org, or a path such as /mosaica. Unset, the page's own origin. Read only by the map, the explorer and <mosaica-store>. Changing it builds a new store. |
token |
token |
string |
'' |
A viewer token for the store the element builds. Without token or authorise, only an open server (serve.open) answers. Read only by the map, the explorer and <mosaica-store>. Changing it builds a new store. |
artifacts-per-tile |
artifactsPerTile |
number | null |
null |
The most artifacts one level of a layer shows per map tile, for the store the element builds. Unset, 50, or the server's selection.max_artifacts_per_tile if lower. A value above that maximum is refused. Read only by the map, the explorer and <mosaica-store>. Changing it builds a new store. |
Properties¶
Set as JavaScript properties; they have no attribute.
| Property | Type | Default | Description |
|---|---|---|---|
store |
Store | null |
null |
The store to use, ahead of one from context or one the element would build. The element never disposes it. |
authorise |
TokenSupplier | null |
null |
A function that returns a viewer token, used instead of token and called again before the token expires. A different function builds a new store, so keep it stable across renders. Set it together with viewer-url: a store built from viewer-url alone first sends a request with no token, and is replaced when authorise arrives. |
activeStore |
Store | null |
read-only | The store this element is using, or null if it has none. |
source |
StoreSource |
read-only | Where activeStore came from. |
Methods¶
| Method | Returns | Description |
|---|---|---|
dispose() |
void |
Dispose of the store this element built. Removing the element from the page does not, so call this when you are done with the element. A store you passed in is left to you. |
Events¶
Each bubbles and is composed. Events gives each detail.
| Event | Fired when |
|---|---|
mosaica-viewswitch |
The view changed. |
Parts¶
Styled from outside the element with ::part().
| Part | Description |
|---|---|
field |
The select and its chevron, shown as the view's title in bold. |
select |
The select. |
CSS custom properties¶
The theme tokens apply to this element.