wip: allow to open browser in condensed mode
This commit is contained in:
parent
5b78d6f0ff
commit
41e7b34813
4 changed files with 19 additions and 12 deletions
|
@ -73,6 +73,7 @@ export default class Browser {
|
|||
|
||||
addDataLayer(datalayer, parent) {
|
||||
let className = `orderable datalayer ${datalayer.getHidableClass()}`
|
||||
if (this.map.ui.PANEL_MODE !== 'condensed') className += ' show-list'
|
||||
const container = DomUtil.create(
|
||||
'div',
|
||||
className,
|
||||
|
|
|
@ -273,6 +273,7 @@ export const SCHEMA = {
|
|||
['none', translate('None')],
|
||||
['caption', translate('Caption')],
|
||||
['databrowser', translate('Data browser')],
|
||||
['datalayers', translate('Layers')],
|
||||
['facet', translate('Facet search')],
|
||||
],
|
||||
default: 'none',
|
||||
|
|
|
@ -141,7 +141,7 @@ U.Map = L.Map.extend({
|
|||
delete this.options.displayDataBrowserOnLoad
|
||||
}
|
||||
if (this.options.datalayersControl === 'expanded') {
|
||||
this.options.onLoadPanel = 'databrowser'
|
||||
this.options.onLoadPanel = 'datalayers'
|
||||
}
|
||||
|
||||
this.ui.on(
|
||||
|
@ -214,14 +214,19 @@ U.Map = L.Map.extend({
|
|||
}
|
||||
this.initShortcuts()
|
||||
this.onceDataLoaded(function () {
|
||||
if (L.Util.queryString('share')) this.share.open()
|
||||
else if (this.options.onLoadPanel === 'databrowser') this.openBrowser()
|
||||
else if (this.options.onLoadPanel === 'caption') this.displayCaption()
|
||||
else if (
|
||||
this.options.onLoadPanel === 'facet' ||
|
||||
this.options.onLoadPanel === 'datafilters'
|
||||
)
|
||||
if (L.Util.queryString('share')) {
|
||||
this.share.open()
|
||||
} else if (this.options.onLoadPanel === 'databrowser') {
|
||||
this.openBrowser()
|
||||
} else if (this.options.onLoadPanel === 'datalayers') {
|
||||
this.ui.PANEL_MODE = 'condensed'
|
||||
this.openBrowser()
|
||||
} else if (this.options.onLoadPanel === 'caption') {
|
||||
this.ui.PANEL_MODE = 'condensed'
|
||||
this.displayCaption()
|
||||
} else if (['facet', 'datafilters'].includes(this.options.onLoadPanel)) {
|
||||
this.openFacet()
|
||||
}
|
||||
const slug = L.Util.queryString('feature')
|
||||
if (slug && this.features_index[slug]) this.features_index[slug].view()
|
||||
if (L.Util.queryString('edit')) {
|
||||
|
@ -305,7 +310,7 @@ U.Map = L.Map.extend({
|
|||
// Specific case for datalayersControl
|
||||
// which accepts "expanded" value, on top of true/false/null
|
||||
if (L.Util.queryString('datalayersControl') === 'expanded') {
|
||||
options.datalayersControl = 'expanded'
|
||||
options.onLoadPanel = 'datalayers'
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1525,14 +1530,13 @@ U.Map = L.Map.extend({
|
|||
const creditsBuilder = new U.FormBuilder(this, creditsFields)
|
||||
credits.appendChild(creditsBuilder.build())
|
||||
this.ui.openPanel({ data: { html: container }, className: 'dark' })
|
||||
|
||||
},
|
||||
|
||||
edit: function () {
|
||||
if (!this.editEnabled) return
|
||||
if (this.options.editMode !== 'advanced') return
|
||||
const container = L.DomUtil.create('div', 'umap-edit-container')
|
||||
title = L.DomUtil.create('h3', '', container)
|
||||
const title = L.DomUtil.create('h3', '', container)
|
||||
title.textContent = L._('Edit map properties')
|
||||
this._editControls(container)
|
||||
this._editShapeProperties(container)
|
||||
|
|
|
@ -5,6 +5,7 @@ U.UI = L.Evented.extend({
|
|||
ALERTS: Array(),
|
||||
ALERT_ID: null,
|
||||
TOOLTIP_ID: null,
|
||||
PANEL_MODE: 'expanded',
|
||||
|
||||
initialize: function (parent) {
|
||||
this.parent = parent
|
||||
|
@ -22,7 +23,7 @@ U.UI = L.Evented.extend({
|
|||
},
|
||||
|
||||
resetPanelClassName: function () {
|
||||
this._panel.className = 'with-transition'
|
||||
this._panel.className = `with-transition ${this.PANEL_MODE}`
|
||||
},
|
||||
|
||||
openPanel: function (e) {
|
||||
|
|
Loading…
Reference in a new issue