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