chore: fix JS syntax to be compatible with browser >= 2020
Safari only supports public field since 2021…
This commit is contained in:
parent
46016cb10b
commit
c5e3dfb95c
3 changed files with 19 additions and 14 deletions
|
@ -2,13 +2,12 @@ import { DomUtil, DomEvent } from '../../vendors/leaflet/leaflet-src.esm.js'
|
||||||
import { translate } from './i18n.js'
|
import { translate } from './i18n.js'
|
||||||
|
|
||||||
export class Panel {
|
export class Panel {
|
||||||
MODE = 'condensed'
|
|
||||||
CLASSNAME = 'left'
|
|
||||||
|
|
||||||
constructor(map) {
|
constructor(map) {
|
||||||
this.parent = map._container
|
this.parent = map._container
|
||||||
this.map = map
|
this.map = map
|
||||||
this.container = DomUtil.create('div', '', this.parent)
|
this.container = DomUtil.create('div', '', this.parent)
|
||||||
|
this.mode = 'condensed'
|
||||||
|
this.classname = 'left'
|
||||||
DomEvent.disableClickPropagation(this.container)
|
DomEvent.disableClickPropagation(this.container)
|
||||||
DomEvent.on(this.container, 'contextmenu', DomEvent.stopPropagation) // Do not activate our custom context menu.
|
DomEvent.on(this.container, 'contextmenu', DomEvent.stopPropagation) // Do not activate our custom context menu.
|
||||||
DomEvent.on(this.container, 'wheel', DomEvent.stopPropagation)
|
DomEvent.on(this.container, 'wheel', DomEvent.stopPropagation)
|
||||||
|
@ -16,7 +15,7 @@ export class Panel {
|
||||||
}
|
}
|
||||||
|
|
||||||
open(e) {
|
open(e) {
|
||||||
this.container.className = `with-transition panel ${this.CLASSNAME} ${this.MODE}`
|
this.container.className = `with-transition panel ${this.classname} ${this.mode}`
|
||||||
this.container.innerHTML = ''
|
this.container.innerHTML = ''
|
||||||
const actionsContainer = DomUtil.create('ul', 'toolbox', this.container)
|
const actionsContainer = DomUtil.create('ul', 'toolbox', this.container)
|
||||||
const body = DomUtil.create('div', 'body', this.container)
|
const body = DomUtil.create('div', 'body', this.container)
|
||||||
|
@ -45,12 +44,12 @@ export class Panel {
|
||||||
}
|
}
|
||||||
|
|
||||||
resize() {
|
resize() {
|
||||||
if (this.MODE === 'expanded') {
|
if (this.mode === 'expanded') {
|
||||||
this.MODE = 'condensed'
|
this.mode = 'condensed'
|
||||||
this.container.classList.remove('expanded')
|
this.container.classList.remove('expanded')
|
||||||
this.container.classList.add('condensed')
|
this.container.classList.add('condensed')
|
||||||
} else {
|
} else {
|
||||||
this.MODE = 'expanded'
|
this.mode = 'expanded'
|
||||||
this.container.classList.remove('condensed')
|
this.container.classList.remove('condensed')
|
||||||
this.container.classList.add('expanded')
|
this.container.classList.add('expanded')
|
||||||
}
|
}
|
||||||
|
@ -66,10 +65,16 @@ export class Panel {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EditPanel extends Panel {
|
export class EditPanel extends Panel {
|
||||||
CLASSNAME = 'right dark'
|
constructor(map) {
|
||||||
|
super(map)
|
||||||
|
this.classname = 'right dark'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FullPanel extends Panel {
|
export class FullPanel extends Panel {
|
||||||
CLASSNAME = 'full dark'
|
constructor(map) {
|
||||||
MODE = 'expanded'
|
super(map)
|
||||||
|
this.classname = 'full dark'
|
||||||
|
this.mode = 'expanded'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,13 +207,13 @@ U.Map = L.Map.extend({
|
||||||
if (L.Util.queryString('share')) {
|
if (L.Util.queryString('share')) {
|
||||||
this.share.open()
|
this.share.open()
|
||||||
} else if (this.options.onLoadPanel === 'databrowser') {
|
} else if (this.options.onLoadPanel === 'databrowser') {
|
||||||
this.panel.MODE = 'expanded'
|
this.panel.mode = 'expanded'
|
||||||
this.openBrowser()
|
this.openBrowser()
|
||||||
} else if (this.options.onLoadPanel === 'datalayers') {
|
} else if (this.options.onLoadPanel === 'datalayers') {
|
||||||
this.panel.MODE = 'condensed'
|
this.panel.mode = 'condensed'
|
||||||
this.openBrowser()
|
this.openBrowser()
|
||||||
} else if (this.options.onLoadPanel === 'caption') {
|
} else if (this.options.onLoadPanel === 'caption') {
|
||||||
this.panel.MODE = 'condensed'
|
this.panel.mode = 'condensed'
|
||||||
this.displayCaption()
|
this.displayCaption()
|
||||||
} else if (['facet', 'datafilters'].includes(this.options.onLoadPanel)) {
|
} else if (['facet', 'datafilters'].includes(this.options.onLoadPanel)) {
|
||||||
this.openFacet()
|
this.openFacet()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from time import sleep
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from playwright.sync_api import expect
|
from playwright.sync_api import expect
|
||||||
|
|
Loading…
Reference in a new issue